/// <summary> /// Inicializa la información de los controles que se usarán para el teléfono /// </summary> void InitializeSoftphone() { try { UsuarioLinea ln = new UsuarioLinea().ObtenerLinea(int.Parse(AUsuarioData.sIdusuario)); _softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750); SIPAccount sa = new SIPAccount(true, ln.sDisplayName, ln.sUserName, ln.sRegisterName, ln.sRegisterPassword, ln.sDomainHost, ln.iDomainPort); _phoneLine = _softPhone.CreatePhoneLine(sa); _phoneLine.RegistrationStateChanged += _phoneLine_RegistrationStateChanged; _softPhone.IncomingCall += _softPhone_IncomingCall; _softPhone.RegisterPhoneLine(_phoneLine); _incomingCall = false; ConnectMedia(); } catch (Exception ex) { InvokeGUIThread(() => { txtDisplay.Text = ex.Message; }); } }
/// <summary> /// Registers the SIP account to the PBX. /// Calls cannot be made while the SIP account is not registered. /// If the SIP account requires no registration, the RegisterPhoneLine() must be called too to register the SIP account to the ISoftPhone. /// </summary> public void Register(bool registrationRequired, string displayName, string userName, string authenticationId, string registerPassword, string domainHost, int domainPort) { try { // We need to handle the event, when we have an incoming call. _softphone.IncomingCall += softphone_IncomingCall; // To register to a PBX, we need to create a SIP account var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort); // With the SIP account and the NAT configuration, we can create a phoneline. _phoneLine = _softphone.CreatePhoneLine(account); // The phoneline has states, we need to handle the event, when it is being changed. _phoneLine.RegistrationStateChanged += phoneLine_PhoneLineStateChanged; // If our phoneline is created, we can register that. _softphone.RegisterPhoneLine(_phoneLine); } catch (Exception ex) { lastError = -100; lastErrorText = "Error during SIP registration: " + ex; } }
/// <summary> /// Registers the SIP account to the PBX. /// Calls cannot be made while the SIP account is not registered. /// If the SIP account requires no registration, the RegisterPhoneLine() must be called too to register the SIP account to the ISoftPhone. /// </summary> public void Register(bool registrationRequired, string displayName, string userName, string authenticationId, string registerPassword, string domainHost, int domainPort) { try { // To register to a PBX, we need to create a SIP account var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort); Console.WriteLine("\nCreating SIP account {0}", account); // With the SIP account and the NAT configuration, we can create a phoneline. phoneLine = softphone.CreatePhoneLine(account); Console.WriteLine("Phoneline created."); // The phoneline has states, we need to handle the event, when it is being changed. phoneLine.RegistrationStateChanged += phoneLine_PhoneLineStateChanged; // If our phoneline is created, we can register that. softphone.RegisterPhoneLine(phoneLine); // For further information about the calling of the ConnectMedia(), please check the implementation of this method. ConnectMedia(); } catch (Exception ex) { Console.WriteLine("Error during SIP registration: " + ex.ToString()); } }
public void Run() { _log.Info("Starting server"); try { _config = new Config("config.txt"); } catch (FileNotFoundException) { _log.Fatal("Configuration file not found"); return; } _softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), _config.GetIntValue("sip.min"), _config.GetIntValue("sip.max"), _config.GetIntValue("sip.port")); _phoneLine = _softPhone.CreatePhoneLine(new SIPAccount(true, _config.GetStringValue("sip.displayname"), _config.GetStringValue("sip.username"), _config.GetStringValue("sip.username"), _config.GetStringValue("sip.password"), _config.GetStringValue("sip.host")), new NatConfiguration(_config.GetStringValue("externalip"), true)); _phoneLine.PhoneLineStateChanged += phoneLine_PhoneLineStateChanged; _softPhone.RegisterPhoneLine(_phoneLine); _softPhone.IncomingCall += softPhone_IncomingCall; // Wait 3 seconds and check if the line is registered. If not, shut down. System.Threading.Thread.Sleep(3000); if (_phoneLine.LineState != PhoneLineState.RegistrationSucceeded) { _log.Error(String.Format("Phone Line is not registered. State is {0}. Exiting.", _phoneLine.LineState.ToString())); return; } lock (_sync) System.Threading.Monitor.Wait(_sync); }
private void InitializeSoftPhone() { try { softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750); InvokeGUIThread(() => { lb_Log.Items.Add("Softphone created!"); }); softPhone.IncomingCall += new EventHandler <VoIPEventArgs <IPhoneCall> >(softPhone_inComingCall); SIPAccount sa = new SIPAccount(true, "1000", "1000", "1000", "1000", "192.168.115.103", 5060); InvokeGUIThread(() => { lb_Log.Items.Add("SIP account created!"); }); phoneLine = softPhone.CreatePhoneLine(sa); phoneLine.RegistrationStateChanged += phoneLine_PhoneLineInformation; InvokeGUIThread(() => { lb_Log.Items.Add("Phoneline created."); }); softPhone.RegisterPhoneLine(phoneLine); tb_Display.Text = string.Empty; lbl_NumberToDial.Text = sa.RegisterName; inComingCall = false; reDialNumber = string.Empty; localHeld = false; ConnectMedia(); } catch (Exception ex) { InvokeGUIThread(() => { lb_Log.Items.Add("Local IP error!"); }); } }
private void PhoneLineStateChanged(object sender, VoIPEventArgs <PhoneLineState> e) { _log.Debug("Line state changed to " + e.Item.ToString()); if (e.Item == PhoneLineState.RegistrationSucceeded) { _log.Info("Line Registered"); Dial(); } else if (e.Item == PhoneLineState.UnregSucceeded) { _log.Info("Line Unregistered"); _phoneLine = null; _softPhone = null; _complete = true; lock (_sync) { Monitor.Pulse(_sync); } } else if (e.Item == PhoneLineState.RegistrationFailed) { _log.Info("Registration failed. Try again"); Register(); } }
void Ozeki() { Console.WriteLine("@@@@@@@@@@@@@@ OZEKI: counter = " + counter); var config = new DirectIPPhoneLineConfig(local_ip, 5060 + counter); phoneLine = softphone.CreateDirectIPPhoneLine(config); //Console.WriteLine("OZEKI: IPPhoneLine Created"); phoneLine.RegistrationStateChanged += line_RegStateChanged; //Console.WriteLine("OZEKI: Po StateChanged, przed IncomingCall"); softphone.IncomingCall += softphone_IncomingCall; //Console.WriteLine("OZEKI: Po IncomingCall"); softphone.RegisterPhoneLine(phoneLine); //Console.WriteLine("OZEKI: po registerPhoneLine"); counter++; /* * try * { * while (!stopCall) * { * * } * } * catch (ThreadInterruptedException exception) * { * // Clean up. * } */ }
public void InitializeSoftPhone() { try { var userAgent = "MyFirstSoftPhone-3-example"; _message = new List <string>(); _softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750, userAgent); _message.Add("Softphone created!"); //InvokeGUIThread(() => { lb_Log.Items.Add("Softphone created!"); }); _softPhone.IncomingCall += softPhone_inComingCall; SIPAccount sa = new SIPAccount(true, "2001", "2001", "2001", "2001", "172.16.1.17"); _message.Add("SIP account created!"); //InvokeGUIThread(() => { lb_Log.Items.Add("SIP account created!"); }); _phoneLine = _softPhone.CreatePhoneLine(sa); _phoneLine.RegistrationStateChanged += phoneLine_PhoneLineInformation; _message.Add("Phoneline created."); //InvokeGUIThread(() => { lb_Log.Items.Add("Phoneline created."); }); _softPhone.RegisterPhoneLine(_phoneLine); _registerName = sa.RegisterName; _inComingCall = false; _reDialNumber = string.Empty; //_localHeld = false; ConnectMedia(); } catch (Exception ex) { _message.Add(ex.ToString()); } }
/// <summary> ///It initializes a softphone object with a SIP BPX, and it is for requisiting a SIP account that is nedded for a SIP PBX service. It registers this SIP ///account to the SIP PBX through an ’IphoneLine’ object which represents the telephoneline. ///If the telephone registration is successful we have a call ready softphone. In this example the softphone can be reached by dialing the number 891. /// </summary> private void InitializeSoftPhone() { try { softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750, 5700); softPhone.IncomingCall += new EventHandler<VoIPEventArgs<IPhoneCall>>(softPhone_IncomingCall); // arama geldiğinde çalışan fonksiyon. phoneLine = softPhone.CreatePhoneLine(new SIPAccount(true, "7134", "7134", "7134", "123456", "sip.kobikom.com", 5060), new NatConfiguration(NatTraversalMethod.None)); //phoneLine = softPhone.CreatePhoneLine(new SIPAccount(true, "oz875", "oz875", "oz875", "oz875", "192.168.112.100", 5060), new NatConfiguration(NatTraversalMethod.None)); phoneLine.PhoneLineStateChanged += new EventHandler<VoIPEventArgs<PhoneLineState>>(phoneLine_PhoneLineInformation); softPhone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { MessageBox.Show(String.Format("You didn't give your local IP adress, so the program won't run properly.\n {0}", ex.Message), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); var sb = new StringBuilder(); sb.AppendLine("Some error happened."); sb.AppendLine(); sb.AppendLine("Exception:"); sb.AppendLine(ex.Message); sb.AppendLine(); if (ex.InnerException != null) { sb.AppendLine("Inner Exception:"); sb.AppendLine(ex.InnerException.Message); sb.AppendLine(); } sb.AppendLine("StackTrace:"); sb.AppendLine(ex.StackTrace); MessageBox.Show(sb.ToString()); } }
private void InitializeSoftPhone() { try { var userAgent = "MyFirstSoftPhone-3-example"; _softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750, userAgent); InvokeGUIThread(() => { lb_Log.Items.Add("Softphone created!"); }); _softPhone.IncomingCall += softPhone_inComingCall; SIPAccount sa = new SIPAccount(true, "100", "100", "100", "123456", "192.168.1.6", 5060); InvokeGUIThread(() => { lb_Log.Items.Add("SIP account created!"); }); _phoneLine = _softPhone.CreatePhoneLine(sa); _phoneLine.RegistrationStateChanged += phoneLine_PhoneLineInformation; InvokeGUIThread(() => { lb_Log.Items.Add("Phoneline created."); }); _softPhone.RegisterPhoneLine(_phoneLine); tb_Display.Text = string.Empty; lbl_NumberToDial.Text = sa.RegisterName; _inComingCall = false; _reDialNumber = string.Empty; _localHeld = false; ConnectMedia(); } catch (Exception ex) { InvokeGUIThread(() => { lb_Log.Items.Add("Local IP error! " + ex); }); } }
private void OnPhoneLineStateChanged(IPhoneLine line) { var handler = PhoneLineStateChanged; if (handler != null) { handler(this, new GEventArgs <IPhoneLine>(line)); } }
private void OnRegisterPhoneLine(IPhoneLine phoneLine) { Check.IsTrue(_isRunning, "Failed to register phone line. The phone must be started first."); Check.Require(phoneLine, "phoneLine"); /*simplification. Up o now we only support IsRegistrationRequired = false*/ //Check.IsTrue(!phoneLine.SipAccount, "Registration is not supported. RegistrationRequired must be false."); //_phoneLine = phoneLine; throw new NotSupportedException("Failed to register phone. Phone regsitration is not supported."); }
private void button2_Click(object sender, EventArgs e) { var ipAddress = myIPTxt.Text; var config = new DirectIPPhoneLineConfig(ipAddress, 5060); phoneLine = softphone.CreateDirectIPPhoneLine(config); phoneLine.RegistrationStateChanged += line_RegStateChanged; softphone.IncomingCall += softphone_IncomingCall; softphone.RegisterPhoneLine(phoneLine); }
public void phoneLineInitialization() { var config = new DirectIPPhoneLineConfig(local_ip, 5060 + counter); phoneLine = softphone.CreateDirectIPPhoneLine(config); phoneLine.RegistrationStateChanged += line_RegStateChanged; softphone.IncomingCall += softphone_IncomingCall; softphone.RegisterPhoneLine(phoneLine); counter++; }
public void OzekiInitialization() { softphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000); var config = new DirectIPPhoneLineConfig(local_ip, 5060); phoneLine = softphone.CreateDirectIPPhoneLine(config); phoneLine.RegistrationStateChanged += line_RegStateChanged; softphone.IncomingCall += softphone_IncomingCall; softphone.RegisterPhoneLine(phoneLine); }
/// <summary> /// Line event unsubscriptions. /// </summary> private void UnsubscribeFromLineEvents(IPhoneLine line) { if (line == null) { return; } line.RegistrationStateChanged -= Line_RegistrationStateChanged; line.InstantMessaging.MessageReceived -= (Line_InstantMessageReceived); }
/// <summary> /// Creates a phone line and adds it to the collection. /// </summary> public IPhoneLine AddPhoneLine(PhoneLineConfiguration config) { IPhoneLine line = softPhone.CreatePhoneLine(config); SubscribeToLineEvents(line); // add to collection PhoneLines.Add(line); return(line); }
/// <summary> /// This will be called when a message summary received. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Line_MessageSummaryReceived(object sender, VoIPEventArgs <VoIPMessageSummary> e) { IPhoneLine line = sender as IPhoneLine; if (line == null) { return; } OnMessageSummaryReceived(new MessageSummaryArgs(line, e.Item)); }
/// <summary> /// Line event unsubscriptions. /// </summary> private void UnsubscribeFromLineEvents(IPhoneLine line) { if (line == null) { return; } line.PhoneLineStateChanged -= Line_PhoneLineStateChanged; line.OutofDialogInstantMessageReceived -= (Line_OutofDialogInstantMessageReceived); line.MessageSummaryReceived -= (Line_MessageSummaryReceived); }
/// <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) { IPhoneLine line = softPhone.CreatePhoneLine(account, natConfig, transportType, srtpMode); SubscribeToLineEvents(line); // add to collection PhoneLines.Add(line); return(line); }
public OutGoingCallEngine(string dialedNumber, ISoftPhone softPhone, IPhoneLine phoneLine) { _connector = new MediaConnector(); _videoSender = new PhoneCallVideoSender(); _audioSender = new PhoneCallAudioSender(); var dial = new DialParameters(dialedNumber) { CallType = CallType.AudioVideo }; Call = softPhone.CreateCallObject(phoneLine, dial); Call.CallStateChanged += _call_CallStateChanged; _videoSender.AttachToCall(Call); _audioSender.AttachToCall(Call); }
/// <summary> /// This will be called when an instant message received through a phone line. /// </summary> private void Line_OutofDialogInstantMessageReceived(object sender, VoIPEventArgs <MessageDataPackage> e) { IPhoneLine line = sender as IPhoneLine; if (line == null) { return; } MessageDataPackage data = e.Item; AddInstantMessage(data.Originator, data.Data); }
/// <summary> /// Registrar cuenta. /// </summary> /// <param name="account"></param> static void registerAccount(SIPAccount account) { try { phoneLine = softphone.CreatePhoneLine(account); phoneLine.RegistrationStateChanged += registrationStateChanged; softphone.RegisterPhoneLine(phoneLine); } catch (Exception e) { log.Error(e); } }
/// <summary> /// Closes the calls on the phone line and unregisters the SIP account. /// </summary> private void ClosePhoneLine(IPhoneLine line) { if (line == null) { return; } foreach (var call in line.PhoneCalls) { call.HangUp(); } softPhone.UnregisterPhoneLine(SelectedLine); }
/// <summary> /// Initializes the softphone logic /// Subscribes change events to get notifications. /// Register info event /// Incoming call event /// </summary> private void InitializeSoftPhone() { try { var displayName = txtDisplayName.Text; string userName = txtUsername.Text; string authenticationId = userName; string password = txtPassword.Text; string domain = txtDomain.Text; int port = int.Parse(txtPort.Text); var userAgent = "Snowday"; _softPhone = SoftPhoneFactory.CreateSoftPhone( SoftPhoneFactory.GetLocalIP(), 7000, 9000, userAgent); InvokeGUIThread(() => { lb_Log.Items.Add("Softphone created!"); }); _softPhone.IncomingCall += softPhone_inComingCall; SIPAccount account_S = new SIPAccount(true, displayName, userName, authenticationId, password, domain, port); InvokeGUIThread(() => { lb_Log.Items.Add("SIP account created!"); }); _phoneLine = _softPhone.CreatePhoneLine(account_S); _phoneLine.RegistrationStateChanged += phoneLine_PhoneLineInformation; InvokeGUIThread(() => { lb_Log.Items.Add("Phoneline created."); }); _softPhone.RegisterPhoneLine(_phoneLine); _inComingCall = false; ConnectMedia(); } catch (Exception ex) { InvokeGUIThread(() => { lb_Log.Items.Add("Local IP error! " + ex); }); } }
/// <summary> /// Extracts information from IPhoneLine object. /// </summary> /// <param name="line">The phone line object as information source.</param> /// <returns>The information about phone line.</returns> public static PhoneLineInfo AsPhoneLineInfo(this IPhoneLine line) { return(new PhoneLineInfo( line.SIPAccount.DisplayName, line.SIPAccount.UserName, line.SIPAccount.RegisterName, line.SIPAccount.RegisterPassword, line.SIPAccount.DomainServerPort != 5060 ? (line.SIPAccount.DomainServerHost + ":" + line.SIPAccount.DomainServerPort) : line.SIPAccount.DomainServerHost, line.SIPAccount.OutboundProxy, line.SIPAccount.RegistrationRequired, line.TransportType, line.SRTPMode )); }
public void RegisterGroup(Group group) { sipAccount = new SIPAccount(true, group.Name, group.Id, group.Id, "123456", "192.168.0.109", 5060); try { phoneLine = softPhone.CreatePhoneLine(sipAccount); phoneLine.RegistrationStateChanged += PhoneLine_RegistrationStateChanged; softPhone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void Register(string streamID) { sipAccount = new SIPAccount(true, streamID, streamID, streamID, streamID, "192.168.0.86", 5060); try { phoneLine = softPhone.CreatePhoneLine(sipAccount); phoneLine.RegistrationStateChanged += PhoneLine_RegistrationStateChanged; softPhone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { throw new Exception(ex.Message); } }
static void RegisterAccount(SIPAccount account) { try { phoneLine = softphone.CreatePhoneLine(account); phoneLine.Config.SRTPMode = SRTPMode.Force; phoneLine.RegistrationStateChanged += sipAccount_RegStateChanged; softphone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { Console.WriteLine("Error during SIP registration: " + ex); } }
static void RegisterAccount(SIPAccount account) { try { var phoneLineConfig = new PhoneLineConfiguration(account); phoneLineConfig.TransportType = TransportType.Tls; phoneLine = softphone.CreatePhoneLine(phoneLineConfig); phoneLine.RegistrationStateChanged += line_RegStateChanged; softphone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { Console.WriteLine("Error during SIP registration: " + ex.ToString()); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { IPhoneLine line = value as IPhoneLine; if (line == null) { return(false); } if (line.MessageSummary == null) { return(false); } return(true); }
void RegisterAccount(SIPAccount account) { try { phoneLine = softphone.CreatePhoneLine(account); phoneLine.RegistrationStateChanged += line_RegStateChanged; softphone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { message = "Error during SIP registration: " + ex; } }
/// <summary> ///It initializes a softphone object with a SIP PBX, and it is for requisiting a SIP account that is nedded for a SIP PBX service. It registers this SIP ///account to the SIP PBX through an ’IphoneLine’ object which represents the telephoneline. ///If the telephone registration is successful we have a call ready softphone. In this example the softphone can be reached by dialing the registername. /// </summary> /// <param name="registerName">The SIP ID what will registered into your PBX</param> /// <param name="domainHost">The address of your PBX</param> private void InitializeSoftPhone(string registerName, string domainHost) { try { softPhone = SoftPhoneFactory.CreateSoftPhone(5700, 5800); softPhone.IncomingCall += softPhone_IncomingCall; phoneLine = softPhone.CreatePhoneLine(new SIPAccount(true, registerName, registerName, registerName, registerName, domainHost, 5060)); phoneLine.RegistrationStateChanged += phoneLine_PhoneLineInformation; softPhone.RegisterPhoneLine(phoneLine); } catch (Exception ex) { Console.WriteLine("You didn't give your local IP adress, so the program won't run properly.\n {0}", ex.Message); } }
public MessageSummaryArgs(IPhoneLine phoneLine, MessageSummary messageSummary) { PhoneLine = phoneLine; MessageSummary = messageSummary; }
/// <summary> ///It initializes a softphone object with a SIP BPX, and it is for requisiting a SIP account that is nedded for a SIP PBX service. It registers this SIP ///account to the SIP PBX through an ’IphoneLine’ object which represents the telephoneline. ///If the telephone registration is successful we have a call ready softphone. In this example the softphone can be reached by dialing the number 891. /// </summary> private void InitializeSoftPhone() { try { if (Ozeki.VoIP.SDK.Protection.LicenseManager.Instance.LicenseType != Ozeki.VoIP.SDK.Protection.LicenseType.Activated) Ozeki.VoIP.SDK.Protection.LicenseManager.Instance.SetLicense(m_OzekiLicenseId, m_OzekiLicenseKey); using (BrightPlatformEntities objDbModel = new BrightPlatformEntities(UserSession.EntityConnection)) { int? _SipAcctId = objDbModel.users.FirstOrDefault(i => i.id == UserSession.CurrentUser.UserId).sip_id; if (!_SipAcctId.HasValue) { //MessageBox.Show( // string.Format("Your account is not yet configured for calling.{0}Please contact your administrator.", Environment.NewLine), // "Bright Sales", // MessageBoxButtons.OK, // MessageBoxIcon.Information //); BrightVision.Common.UI.NotificationDialog.Error( "Bright Sales", string.Format("Your account is not yet configured for calling.{0}Please contact your administrator.", Environment.NewLine) ); return; } sip_accounts sip = objDbModel.sip_accounts.FirstOrDefault(i => i.id == _SipAcctId); if (sip != null) objDbModel.Detach(sip); if (m_UserAudioSetting == null) m_UserAudioSetting = AudioSettingUtility.GetUserAudioSetting(); m_UserMicrophone = AudioSettingUtility.GetDefaultDeviceMicrophone(); m_UserSpeaker = AudioSettingUtility.GetDefaultDeviceSpeaker(); m_UserMicrophone.Volume = (float)m_UserAudioSetting.mic_volume / 10; m_UserSpeaker.Volume = (float)m_UserAudioSetting.speaker_volume / 10; try { softPhone = SoftPhoneFactory.CreateSoftPhone(SoftPhoneFactory.GetLocalIP(), 5700, 5750, 5780); } catch { } this.DisableUnwantedCodec(); softPhone.IncomingCall -= new EventHandler<VoIPEventArgs<IPhoneCall>>(softPhone_IncomingCall); softPhone.IncomingCall += new EventHandler<VoIPEventArgs<IPhoneCall>>(softPhone_IncomingCall); SIPAccount acc = new SIPAccount( true, sip.display_name.Trim(), sip.username.Trim(), sip.username.Trim(), sip.password, sip.sip_url.Trim(), 5060, "" ); // var acc = new SIPAccount(true, sip.display_name, sip.username, sip.username, sip.password, sip.sip_url, 5060,""); // NatConfiguration newNatConfiguration = new NatConfiguration(NatTraversalMethod.Auto, new NatRemoteServer("stun.ozekiphone.com", "", "")); phoneLine = softPhone.CreatePhoneLine(acc, Ozeki.Network.TransportType.Udp, SRTPMode.None); phoneLine.PhoneLineStateChanged -= new EventHandler<VoIPEventArgs<PhoneLineState>>(phoneLine_PhoneLineInformation); phoneLine.PhoneLineStateChanged += new EventHandler<VoIPEventArgs<PhoneLineState>>(phoneLine_PhoneLineInformation); softPhone.RegisterPhoneLine(phoneLine); objDbModel.Dispose(); } } catch (Exception ex) { } }
public PhoneLineInstantMessageArgs(IPhoneLine phoneLine, MessageDataPackage message) { PhoneLine = phoneLine; Message = message; }
/// <summary> /// Line event unsubscriptions. /// </summary> private void UnsubscribeFromLineEvents(IPhoneLine line) { if (line == null) return; line.RegistrationStateChanged -= Line_RegistrationStateChanged; line.InstantMessaging.MessageReceived -= (Line_InstantMessageReceived); }
/// <summary> /// Line event unsubscriptions. /// </summary> private void UnsubscribeFromLineEvents(IPhoneLine line) { if (line == null) return; line.PhoneLineStateChanged -= Line_PhoneLineStateChanged; line.OutofDialogInstantMessageReceived -= (Line_OutofDialogInstantMessageReceived); line.MessageSummaryReceived -= (Line_MessageSummaryReceived); }
private void OnPhoneLineStateChanged(IPhoneLine line) { var handler = PhoneLineStateChanged; if (handler != null) handler(this, new GEventArgs<IPhoneLine>(line)); }
/// <summary> /// Closes the calls on the phone line and unregisters the SIP account. /// </summary> private void ClosePhoneLine(IPhoneLine line) { if (line == null) return; foreach (var call in line.PhoneCalls) call.HangUp(); softPhone.UnregisterPhoneLine(SelectedLine); }