Esempio 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
            }
        }
Esempio n. 2
0
 private void close_streams()
 {
     if (broker.active_calls == 0)
     {
         PortAudio.CloseStreams();
     }
 }
Esempio n. 3
0
 public void switch_to()
 {
     if (active_call != this)
     {
         PortAudio.SwitchTo(portaudio_id);
     }
 }
Esempio n. 4
0
 public void unhold()
 {
     if (state == CALL_STATE.Hold)
     {
         PortAudio.SwitchTo(portaudio_id);
     }
 }
Esempio n. 5
0
        public void CreateCall(String number)
        {
            if (!enabled)
            {
                return;
            }
            Broker.get_instance().BringToFront(false);
            String var_str = "origination_caller_id_name='" + caller_id_name + "',origination_caller_id_number='" + caller_id_number + "'";

            if (secure_media)
            {
                var_str += ",sip_secure_media=true";
            }

            if (Broker.get_instance().DirectSipDial)
            {
                if (sip_regex == null)
                {
                    sip_regex = new Regex(@"^sip:(.+)$", RegexOptions.Compiled);
                }
                Match match = sip_regex.Match(number);
                if (match.Success)
                {
                    string sip_uri = match.Groups[1].Value;
                    PortAudio.Call("{" + var_str + ",gw_ref='" + gateway_id + "'}sofia/softphone/" + sip_uri);
                    return;
                }
            }
            PortAudio.Call("{" + var_str + "}sofia/gateway/" + gateway_id + "/" + number);
        }
Esempio n. 6
0
 public void hold()
 {
     if (state == CALL_STATE.Answered || (state == CALL_STATE.Ringing && this == active_call && is_outgoing))
     {
         PortAudio.HoldAll();
     }
 }
Esempio n. 7
0
        private void DeviceAdded(object sender, IHeadsetPlugin.DeviceEventArgs e)
        {
            IHeadsetPlugin plugin = sender as IHeadsetPlugin;
            DeviceData     data   = new DeviceData {
                device = e.device, host = new IDeviceHost(), active = false, in_use = false
            };

            data.plugin = (from p in plugins where p.plugin == plugin select p).Single();
            try {
                lock (devices_lock) {
                    devices.Add(data);
                }
                data.device.StatusChanged += DeviceStatusChanged;
                data.limitations           = data.device.Initalize(data.host);
                data.device.GetModel();
                if ((active_device_name == null && data.device.GetName() == last_active_device_name) || active_device_name == data.device.GetName())
                {
                    SetActiveDevice(data.device.GetName());
                    PortAudio.refresh_devices();
                }
            }
            catch (Exception exp) {
                HandleError(new PluginError {
                    device = data, exception = exp
                });
            }
        }
Esempio n. 8
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);
            }
        }
Esempio n. 9
0
 private void activateCurrentDevs()
 {
     if (SpeakerphoneActive)
     {
         PortAudio.SetInAndOutDev(SpeakerInDev, SpeakerOutDev);
     }
     else
     {
         PortAudio.SetInAndOutDev(HeadsetInDev, HeadsetOutDev);
     }
 }
Esempio n. 10
0
 public void reload_audio_devices(bool and_settings, bool no_save)
 {
     if (active_calls > 0)
     {
         MessageBox.Show("Unable to reload audio devices while calls are active");
         return;
     }
     if (and_settings && !no_save)
     {
         SaveAudioSettings();
     }
     audio_devices = PortAudio.get_devices(true);
     if (and_settings)
     {
         LoadAudioSettings();
     }
     activateCurrentDevs();
 }
Esempio n. 11
0
 private void HandleCallWaiting(Timer timer, Call c)
 {
     if (c.state != Call.CALL_STATE.Ringing || Call.active_call == c)
     {
         if (timer != null)
         {
             timer.Stop();
             timer.Dispose();
             return;
         }
     }
     if (timer == null)
     {
         timer          = new Timer(4000);
         timer.Elapsed += (s, e) => HandleCallWaiting(timer, c);
         timer.Start();
     }
     if (Call.active_call != null && Call.active_call.state == Call.CALL_STATE.Answered)
     {
         PortAudio.PlayInUUID(Call.active_call.leg_a_uuid, "tone_stream://%(200,100,440);loops=2;");
     }
 }
Esempio n. 12
0
 public void SetOutDev()
 {
     PortAudio.SetOutDev(guid);
 }
Esempio n. 13
0
 public void hangup()
 {
     PortAudio.Hangup(portaudio_id);
 }
Esempio n. 14
0
 public void answer()
 {
     PortAudio.Answer(portaudio_id);
 }
Esempio n. 15
0
 public void SetRingDev()
 {
     PortAudio.SetRingDev(guid);
 }
Esempio n. 16
0
 public void send_dtmf(string dtmf)
 {
     dtmfs += dtmf;
     PortAudio.SendDTMF(dtmf);
 }
Esempio n. 17
0
 public void SetInDev()
 {
     PortAudio.SetInDev(guid);
 }