/// <summary>
        /// Initializes the base softphone engine.
        /// </summary>
        internal void InitSoftphone(bool useFixIP)
        {
            // if the softphone is already created, then close it
            if (softPhone != null)
            {
                // unregister the phone lines, because if the local IP address changed, the existing registrations will not work
                foreach (var line in PhoneLines)
                {
                    if (line.LineState == PhoneLineState.RegistrationSucceeded || line.LineState == PhoneLineState.NoRegNeeded)
                    {
                        softPhone.UnregisterPhoneLine(line);
                    }
                }

                softPhone.IncomingCall -= (SoftPhone_IncomingCall);
                softPhone.Close();
            }

            // create new softphone
            if (LocalIP == null || !useFixIP)
            {
                softPhone = SoftPhoneFactory.CreateSoftPhone(MinPort, MaxPort, 5060);
            }
            else
            {
                softPhone = SoftPhoneFactory.CreateSoftPhone(LocalIP, MinPort, MaxPort, 5060);
            }

            softPhone.IncomingCall += (SoftPhone_IncomingCall);
        }
        private void ZakonczNasluch()
        {
            softphone.Close();
            softphone.UnregisterPhoneLine(phoneLine);
            phoneLine.Dispose();

            watekDoRozmow.Abort();
            watekDoRozmow = null;
        }
Exemple #3
0
 private void sipClient_Closing(object sender, FormClosingEventArgs e)
 {
     try
     {
         softphone.UnregisterPhoneLine(phoneLine1);
         this.Dispose();
         Application.Exit();
     }
     catch {}
 }
Exemple #4
0
 public void Dispose()
 {
     Try(() => _call?.HangUp());
     Try(() => _softphone?.UnregisterPhoneLine(_phoneLine));
     Try(() => _phoneLine.Dispose());
     Try(() => _mediaReceiver.Dispose());
     Try(() => _mediaSender.Dispose());
     Try(() => _connector.Dispose());
     Try(() => _speaker.Dispose());
     Try(() => _microphone.Dispose());
     Try(() => _softphone.Close());
 }
 private void btnResisger_Click(object sender, EventArgs e)
 {
     if (!isRegister)
     {
         InitializeSoftPhone();
         btnRegister.Text = "Registering";
         isRegister       = true;
     }
     else
     {
         isRegister       = false;
         btnRegister.Text = "Register";
         if (_phoneLineInformation.IsRegistered())
         {
             _softPhone.UnregisterPhoneLine(_phoneLine);
         }
         cbxStatus.SelectedIndex = 0;
         pbxStatus.Image         = Properties.Resources.presenceOffline;
     }
 }
 public static void RefeshRegister()
 {
     _softPhone.UnregisterPhoneLine(_phoneLine);
     _phoneLine = _softPhone.CreatePhoneLine(accountSipInfo);
     _softPhone.RegisterPhoneLine(_phoneLine);
 }
Exemple #7
0
 private void UnRegisterBegin()
 {
     _log.Info("Unregistering");
     _softPhone.UnregisterPhoneLine(_phoneLine);
 }
 private void ShutDown()
 {
     _log.Info("Shutting down");
     _softPhone.UnregisterPhoneLine(_phoneLine);
 }