get_instance() public static method

public static get_instance ( ) : Broker
return Broker
Esempio n. 1
0
 private void acct_status_check()
 {
     if (enabled && state == "NOREG")
     {
         Broker.get_instance().reload_sofia(Sofia.RELOAD_CONFIG_MODE.SOFT);
     }
 }
Esempio n. 2
0
        public void edit()
        {
            if (Broker.get_instance().active_calls != 0)
            {
                MessageBoxResult mres = MessageBox.Show("Warning editing sofia settings will cause sofia to restart and will drop any active calls, do you want to continue?", "Restart Warning", MessageBoxButton.YesNo);
                if (mres != MessageBoxResult.Yes)
                {
                    return;
                }
            }
            GenericEditor editor = new GenericEditor();

            editor.Init("Editing Sofia Settings", values);
            editor.ShowDialog();
            if (editor.DialogResult == true)
            {
                if (master_profile_ok)
                {
                    reload_config(RELOAD_CONFIG_MODE.HARD);
                }
                else
                {
                    reload_config(RELOAD_CONFIG_MODE.MODULE);
                }
            }
        }
Esempio n. 3
0
        private void contact_call_click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;

            if (item == null)
            {
                return;
            }

            SearchAutoCompleteEntry entry = item.DataContext as SearchAutoCompleteEntry ?? search_box.SelectedItem as SearchAutoCompleteEntry;

            if (entry == null)
            {
                return;
            }
            Account acct = item.Tag as Account;

            if (acct != null)
            {
                Broker.get_instance().DialString(acct, entry.number);
            }
            else
            {
                Broker.get_instance().DialString(entry.number);
            }
        }
Esempio n. 4
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. 5
0
        protected void call_current_contact()
        {
            SearchAutoCompleteEntry entry = search_box.SelectedItem as SearchAutoCompleteEntry;

            if (entry != null)
            {
                Broker.get_instance().DialString(entry.number);
            }
        }
Esempio n. 6
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PreviewTextInput         += MainWindow_PreviewTextInput;
            txtNumber.PreviewKeyDown += txtNumber_PreviewKeyDown;
            //txtNumber.PreviewTextInput += MainWindow_PreviewTextInput;
            PreviewKeyDown += MainWindow_PreviewKeyDown;             //return must be handled seperately as buttons are triggered on down it seems
            MouseUp        += MainWindow_MouseUp;

            Call.CallStateChanged              += CallStateChanged;
            Call.ActiveCallChanged             += ActiveCallChanged;
            Account.accounts.CollectionChanged += accounts_CollectionChanged;
            Broker.FreeswitchLoaded            += FreeswitchLoaded;
            broker      = Broker.get_instance();
            DataContext = status;
            AccountDefaultConverter.normal_account_color  = (SolidColorBrush)Resources["GridRowSpecialFGColor"];
            AccountDefaultConverter.default_account_color = (SolidColorBrush)Resources["RowHighlightFGColor"];
            broker.call_activeChanged         += CallActiveChanged;
            broker.active_call_ringingChanged += CallRingingChanged;
            broker.MutedChanged              += MuteChanged;
            broker.DNDChanged                += DNDChanged;
            broker.CanEndChanged             += CanEndChanged;
            broker.themeChanged              += ThemeChanged;
            broker.UseNumberOnlyInputChanged += UseNumberOnlyInputChanged;
            UseNumberOnlyInputChanged(null, false);            //trigger an update
            broker.SpeakerphoneActiveChanged += SpeakerActiveChanged;
            CurrentCallInfo.Visibility        = Visibility.Hidden;
            Windows.systray_icon_setup();
            switch (broker.GUIStartup)
            {
            case "Calls":
                borderAccounts.Visibility = Visibility.Hidden;
                break;

            case "Accounts":
                borderCalls.Visibility = Visibility.Hidden;
                break;

            case "Dialpad":
                borderAccounts.Visibility = Visibility.Hidden;
                borderCalls.Visibility    = Visibility.Hidden;
                break;
            }
            ResizeForm();
            btnTransfer.ContextMenu    = broker.XFERContextMenu();
            borderTransfer.ContextMenu = broker.XFERContextMenu();
            if (broker.theme != "Steel")
            {
                ReloadTheme();
            }

            AcceptEnterForDoubleClick(btnConferenceCall, btnConferenceDoubleClick);
            SpeakerActiveChanged(null, false);
            MuteChanged(null, false);
            DNDChanged(null, false);
        }
Esempio n. 7
0
 protected void search_box_PreviewKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         call_current_contact();
     }
     else if (e.Key == Key.Escape)
     {
         Broker.get_instance().MainWindowRemoveFocus(true);
     }
 }
Esempio n. 8
0
        private void ContactInit()
        {
            ContactMenuItems = active_plugin.contact_plugin.ContactRightClickMenu();
            OurAutoCompleteBox box = Broker.get_instance().GetContactSearchBox();

            if (active_plugin.contact_plugin.HandleSearchBox(box))
            {
                box.Visibility = Visibility.Visible;
            }
            active_plugin.state = PluginData.PluginDataState.LOADED;
        }
Esempio n. 9
0
        public ContactPluginManager()
        {
            OurAutoCompleteBox box = Broker.get_instance().GetContactSearchBox();

            if (Application.Current == null)
            {
                return;
            }
            Application.Current.Dispatcher.BeginInvoke((Action)(() => {
                box.Visibility = Visibility.Collapsed;
            }));
        }
Esempio n. 10
0
        public static void refresh_devices(bool force = false)
        {
            if (!force && !Broker.get_instance().fully_loaded)
            {
                return;
            }
            foreach (InternalAudioDevice device in _devices)
            {
                device.is_alive = false;
            }
            Utils.api_exec("pa", "rescan");
            XmlDocument doc = null;

            try{
                doc = XmlUtils.GetDocument(Utils.api_exec("pa", "devlist xml"));
            }catch (KeyNotFoundException) {
                MessageBox.Show("Portaudio did not return a device list most likely because it cannot find an active microphone or speaker it can use, FSClient will now exit.", "Missing Device List", MessageBoxButton.OK, MessageBoxImage.Error);
                Environment.Exit(-1);
                return;
            }
            XmlNode node = XmlUtils.GetNode(doc, "devices", 0);

            foreach (XmlNode child in node.ChildNodes)
            {
                AudioDevice dev = new AudioDevice(
                    cur_guid, XmlUtils.GetNodeAttrib(child, "name"),
                    int.Parse(XmlUtils.GetNodeAttrib(child, "inputs")),
                    int.Parse(XmlUtils.GetNodeAttrib(child, "outputs"))
                    );
                int  dev_id       = int.Parse(XmlUtils.GetNodeAttrib(child, "id"));
                bool found_device = false;
                foreach (InternalAudioDevice device in _devices)                //TODO: Probably should sort here
                {
                    if (device.device.name == dev.name && device.is_alive == false)
                    {
                        device.is_alive = true;
                        device.id       = dev_id;
                        found_device    = true;
                        break;
                    }
                }
                if (!found_device)
                {
                    InternalAudioDevice new_device = new InternalAudioDevice {
                        device = dev, is_alive = true, id = dev_id
                    };
                    cur_guid++;
                    _devices.Add(new_device);
                }
            }
            _pub_devices = (from c in _devices where c.is_alive select c.device).ToArray();
        }
Esempio n. 11
0
 public Call()
 {
     PropertyChanged += Call_PropertyChanged;
     start_time       = DateTime.Now;
     if (duration_timer == null)
     {
         duration_timer = new System.Threading.Timer(DurationTimerFired, null, 1000, 1000);
     }
     if (broker == null)
     {
         broker = Broker.get_instance();
     }
     visibility = Visibility.Visible;
 }
Esempio n. 12
0
        public override void LoadPlugins()
        {
            no_plugins_in_config = plugins.Count == 0;
            LoadActualPlugins("Contact", typeof(IContactPlugin), plugins);



            if (active_plugin != null)
            {
                Call.calls.CollectionChanged       += calls_CollectionChanged;
                Conference.users.CollectionChanged += confusers_CollectionChanged;
                Call.CallRightClickMenuShowing     += calls_RightClickMenuShowing;
                Broker.get_instance().XFERMenuOpenedHandler += broker_xferMenuOpened;
            }
        }
Esempio n. 13
0
        public static void systray_icon_setup()
        {
            if (systray_icon != null)
            {
                return;
            }
            systray_icon         = new System.Windows.Forms.NotifyIcon();
            systray_icon.Visible = true;

            systray_icon.Click += systray_icon_Click;

            dnd_icon    = Properties.Resources.phone_dnd;
            normal_icon = Properties.Resources.phone;
            systrayicon_SetIcon(normal_icon);
            Broker.get_instance().DNDChanged += BrokerDNDChanged;
        }
Esempio n. 14
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     PositionWindows();
     lblCaller.Text              = call.other_party_name + " - " + call.other_party_number;
     Title                       = "FSClient Incoming Call " + lblCaller.Text;
     prop_changed                = new System.ComponentModel.PropertyChangedEventHandler(call_PropertyChanged);
     call.PropertyChanged       += prop_changed;
     btnSendVoicemail.Visibility = call.CanSendToVoicemail() ? Visibility.Visible : Visibility.Hidden;
     btnTransfer.ContextMenu     = Broker.get_instance().XFERContextMenu();
     btnTransfer.DataContext     = call;
     if (Broker.get_instance().IncomingKeyboardFocus)
     {
         DelayedFunction.DelayedCall("BubbleTop", MakeUsTop, 500);
     }
     Show();
     Topmost = true;
 }
Esempio n. 15
0
 public HeadsetPluginManager()
 {
     broker = Broker.get_instance();
 }
Esempio n. 16
0
 private static void callback(object state)
 {
     Broker.get_instance().reload_sofia(Sofia.RELOAD_CONFIG_MODE.SOFT);
 }