PlayDTMF() public static method

public static PlayDTMF ( char dtmf, string uuid, bool no_close = false ) : void
dtmf char
uuid string
no_close bool
return void
Ejemplo n.º 1
0
        private void handle_key_action(char key)
        {
            if (txtNumber.IsReadOnly == false && txtNumber.IsKeyboardFocused)
            {
                int ind = txtNumber.CaretIndex;
                if (txtNumber.SelectionStart >= 0)
                {
                    status.dial_str = status.dial_str.Remove(txtNumber.SelectionStart, txtNumber.SelectionLength);
                }
                status.dial_str      = status.dial_str.Insert(ind, key.ToString());
                txtNumber.CaretIndex = ind + 1;
            }
            else
            {
                status.dial_str += key;
            }
            //status.dial_str += key;
            if (key != '*' && key != '#' && (key < '0' || key > '9') && (key < 'A' || key > 'D'))
            {
                return;
            }

            if (Call.active_call != null && Call.active_call.state == Call.CALL_STATE.Answered)
            {
                Call.active_call.send_dtmf(key.ToString());
            }
            else
            {
#if !NO_FS
                PortAudio.PlayDTMF(key, null, true);
                DelayedFunction.DelayedCall("PortAudioLastDigitHitStreamClose", close_streams, 5000);
#endif
            }
        }
Ejemplo n.º 2
0
        private static void HandleDTMFEvent(FSEvent evt, string uuid)
        {
            String digit = evt.get_header("DTMF-Digit");
            var    call  = (from c in calls where (c.leg_a_uuid == uuid || c.leg_b_uuid == uuid) && c.call_ended == false select c).SingleOrDefault();

            if (call != null && call.state == CALL_STATE.Answered && digit.Length == 1)
            {
                PortAudio.PlayDTMF(digit[0], call.leg_a_uuid);
            }
        }