private void btnAddPhoneLine_Click(object sender, RoutedEventArgs e)
        {
            AccountModel  model      = new AccountModel();
            AccountWindow accountWin = new AccountWindow(this, model);
            bool?         ok         = accountWin.ShowDialog();

            if (ok != null && ok == true)
            {
                int           keepaliveInterval = 5;
                KeepAliveMode keepalive         = KeepAliveMode.NONE;
                if (cbKeepAlive.SelectedItem != null)
                {
                    keepalive = (KeepAliveMode)cbKeepAlive.SelectedItem;
                }
                try
                {
                    keepaliveInterval = int.Parse(tbKeepAliveInterval.Text);
                }
                catch { }
                var line = Model.AddPhoneLine(model.SIPAccount, model.TransportType, model.NatConfig, model.SRTPMode, keepalive, keepaliveInterval);

                //if (Model.SelectedLine == null)
                Model.SelectedLine = line;
            }
        }
        private void btnModifyPhoneLine_Click(object sender, RoutedEventArgs e)
        {
            if (Model.SelectedLine == null)
            {
                return;
            }

            AccountModel model = new AccountModel();

            model.DisplayName          = Model.SelectedLine.SIPAccount.DisplayName;
            model.Domain               = Model.SelectedLine.SIPAccount.DomainServerHost;
            model.UserName             = Model.SelectedLine.SIPAccount.UserName;
            model.RegisterName         = Model.SelectedLine.SIPAccount.RegisterName;
            model.Password             = Model.SelectedLine.SIPAccount.RegisterPassword;
            model.RegistrationRequired = Model.SelectedLine.SIPAccount.RegistrationRequired;
            model.OutboundProxy        = Model.SelectedLine.SIPAccount.OutboundProxy;
            model.TransportType        = Model.SelectedLine.Config.TransportType;
            model.SRTPMode             = Model.SelectedLine.Config.SRTPMode;
            model.AutoDetectNat        = Model.SelectedLine.Config.NatConfig.AutoDetect;
            model.NatTraversalMethod   = Model.SelectedLine.Config.NatConfig.TraversalMethodType;
            model.STUNServerAddress    = Model.SelectedLine.Config.NatConfig.StunServerAddress;

            AccountWindow accountWin = new AccountWindow(this, model);
            bool?         ok         = accountWin.ShowDialog();

            if (ok != null && ok == true)
            {
                Model.RemovePhoneLine();
                int           keepaliveInterval = 5;
                KeepAliveMode keepalive         = KeepAliveMode.NONE;
                if (cbKeepAlive.SelectedItem != null)
                {
                    keepalive = (KeepAliveMode)cbKeepAlive.SelectedItem;
                }
                try
                {
                    keepaliveInterval = int.Parse(tbKeepAliveInterval.Text);
                }
                catch { }

                var line = Model.AddPhoneLine(model.SIPAccount, model.TransportType, model.NatConfig, model.SRTPMode, keepalive, keepaliveInterval);

                //if (Model.SelectedLine == null)
                Model.SelectedLine = line;
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates a phone line and adds it to the collection.
        /// </summary>
        public IPhoneLine AddPhoneLine(SIPAccount account, Ozeki.Network.TransportType transportType, NatConfiguration natConfig, SRTPMode srtpMode, KeepAliveMode kepalive, int KeepaliveInterval)
        {
            var config = new PhoneLineConfiguration(account);

            config.TransportType = transportType;
            config.NatConfig     = natConfig;
            config.SRTPMode      = srtpMode;
            return(AddPhoneLine(config));
        }