Example #1
0
        private Broker()
        {
            _instance = this;
            upgrade_settings();
            Utils.PluginLog("", "");//clear file
            headset_plugin_manager = new HeadsetPluginManager();

            NewEvent += Call.NewFSEvent;
            NewEvent += Account.NewEvent;

            Call.CallStateChanged += CallStateChangedHandler;
            Call.ActiveCallChanged += ActiveCallChanged;

            init_us();
            DelayedFunction.DelayedCall("LoadContactManager", initContactManager, 1000);
        }
Example #2
0
        private void init_us()
        {
            if (is_inited)
                return;
            is_inited = true;
            try {
                if (!System.IO.File.Exists("conf/freeswitch.xml")) {
                    MessageBox.Show("conf/freeswitch.xml is not found, without it we must quit.", "Missing Base Configuration File", MessageBoxButton.OK, MessageBoxImage.Error);
                    Environment.Exit(-1);
                }
                if (System.IO.File.Exists("log/freeswitch.log")) {
                    try {
                        System.IO.File.WriteAllText("log/freeswitch.log", "");
                    }
                    catch (System.IO.IOException e) {
                        MessageBox.Show(
                            "Unable to truncate freeswitch.log (most likely due to FSCLient already running) due to: " + e.Message,
                            "Truncation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        Environment.Exit(-1);
                    }
                }
                Account.LoadSettings();

                recordings_folder = Properties.Settings.Default.RecordingPath;
                IncomingBalloons = Properties.Settings.Default.IncomingBalloons;
                IncomingTopMost = Properties.Settings.Default.FrontOnIncoming;
                ClearDTMFS = Properties.Settings.Default.ClearDTMFS;
                UseNumberOnlyInput = Properties.Settings.Default.UseNumberOnlyInput;
                CheckForUpdates = Properties.Settings.Default.CheckForUpdates;

                if (Properties.Settings.Default.Sofia != null)
                    sofia = Properties.Settings.Default.Sofia.GetSofia();
                else
                    sofia = new Sofia();

                if (Properties.Settings.Default.HeadsetPlugins != null)
                    headset_plugin_manager = HeadsetPluginManager.GetPluginManager(Properties.Settings.Default.HeadsetPlugins);
                else
                    headset_plugin_manager = new HeadsetPluginManager();
                headset_plugin_manager.LoadPlugins();

                if (Properties.Settings.Default.EventSocket != null)
                    event_socket = Properties.Settings.Default.EventSocket.GetEventSocket();
                else
                    event_socket = new EventSocket();

            }
            catch (Exception e) {
                MessageBoxResult res = MessageBox.Show(
                    "Unable to properly load our settings if you continue existing settings may be lost, do you want to continue?(No to exit)\n" +
                    e.Message, "Error Loading Settings", MessageBoxButton.YesNo);
                if (res != MessageBoxResult.Yes)
                    Environment.Exit(-1);
            }
            Thread t = new Thread(init_freeswitch);
            t.IsBackground = true;
            t.Start();
            t = new Thread(VersionCheck);
            t.IsBackground = true;
            t.Start();
        }