/// <summary> /// Creates phone call information. /// </summary> /// /// <param name="callID">The identifier of the call.</param> /// <param name="phoneLineInfo">Associated phone line information.</param> /// <param name="dial">Dialed string.</param> /// <param name="type">The type of the call (incoming/outgoing).</param> public PhoneCallInfo(string callID, PhoneLineInfo phoneLineInfo, string dial, CallDirection type) { CallID = callID; PhoneLineInfo = phoneLineInfo; Dial = dial; Direction = type; }
/// <summary> /// Equality comparer. /// </summary> /// <param name="obj">Meant to be other PhoneCallInfo object.</param> /// <returns>Returns true if the two objects are equal, otherwise false.</returns> public override bool Equals(object obj) { if (obj == this) { return(true); } PhoneCallInfo other = obj as PhoneCallInfo; if (other == null) { return(false); } return (CallID.Equals(other.CallID) && PhoneLineInfo.Equals(other.PhoneLineInfo)); }
/// <summary> /// Equality comparer. /// </summary> /// <param name="obj">Meant to be other PhoneLineInfo object.</param> /// <returns>Returns true if the two objects are equal, otherwise false.</returns> public override bool Equals(object obj) { if (obj == this) { return(true); } PhoneLineInfo other = obj as PhoneLineInfo; if (other == null) { return(false); } return (DisplayName.Equals(other.DisplayName) && Username.Equals(other.Username) && RegisterName.Equals(other.RegisterName) && Password.Equals(other.Password) && Domain.Equals(other.Domain) && Proxy.Equals(other.Proxy) && RegRequired.Equals(other.RegRequired)); }
/// <summary> /// Message Summary Information received. /// </summary> /// <param name="info">The phone line associated with the message summary info.</param> /// <param name="summary">The summary information itself.</param> public void MessageSummaryReceived(PhoneLineInfo info, VoIPMessageSummary summary) { if (summary == null) { MWILogic.Reset(); return; } MWILogic.ChangeState(summary); }
public void CallGetDNDInfo(PhoneLineInfo lineInfo) { bool? dnd = softphoneEngine.GetDNDInfo(lineInfo); if (dnd != null) PhoneLineDNDInfo(lineInfo, dnd.Value); }
/// <summary> /// Calculates PhoneLineInfo objects from data held by the registration fields. /// </summary> /// <returns>The PhoneLineInfo.</returns> private PhoneLineInfo PhoneLineInfoFromRegFields() { bool regRequired = !chkbATAMode.Checked && chkbRegistrationRequired.Checked; var transportType = (TransportType)Enum.Parse(typeof(TransportType), cobTransport.Text, true); var srtpMode = (SRTPMode) Enum.Parse(typeof (SRTPMode), cobSRTPmode.Text, true); PhoneLineInfo SIPAccount = new PhoneLineInfo( tbDisplayName.Text, tbUserId.Text, tbRegisterName.Text, tbRegisterPassword.Text, tbDomainServer.Text, tbProxy.Text, regRequired, transportType, srtpMode); return SIPAccount; }
/// <summary> /// Fills all registration fields with information from PhoneLineInfo. /// </summary> /// <param name="info">The PhoneLineInfo object.</param> private void FillRegFields(PhoneLineInfo info) { tbDisplayName.Text = info.DisplayName; tbUserId.Text = info.Username; tbRegisterName.Text = info.RegisterName; tbRegisterPassword.Text = info.Password; tbDomainServer.Text = info.Domain; chkbRegistrationRequired.Checked = info.RegRequired; chkbATAMode.Checked = !info.RegRequired; }
/// <summary> /// Unregisters the associated phone line. /// </summary> /// <param name="phoneLineInfo">Phone information.</param> /// <remarks> /// Finds a phone line object associated with the information provided, /// and begin to unregister the associated phone line. /// </remarks> public void UnregisterPhoneLine(PhoneLineInfo phoneLineInfo) { if (disposed) return; if (!PhoneLinesBijection.ContainsKey(phoneLineInfo)) return; IPhoneLine line = PhoneLinesBijection.Get(phoneLineInfo); if (line.LineState == PhoneLineState.NoRegNeeded) { /* If the phone line has direct connection, where no registration * needed, simply just remove the given phone line from the bijection. * */ PhoneLinesBijection.RemoveBijection(phoneLineInfo); return; } /* Otherwise try to unregister the phone line. * */ softPhone.UnregisterPhoneLine(line); }
/// <summary> /// Set DoNotDisturb mode to phone line. /// </summary> /// <param name="lineInfo">Phone line.</param> /// <param name="dnd">DND.</param> public void SetDND(PhoneLineInfo lineInfo, bool dnd) { IPhoneLine line = PhoneLinesBijection.Get(lineInfo); if (line == null) return; line.DoNotDisturb = dnd; }
/// <summary> /// Creates a phone line object and tries to register or activate it. /// </summary> /// <param name="phoneLineInfo">The information required for registration, or for activation.</param> public void RegisterPhoneLine(PhoneLineInfo phoneLineInfo) { if (disposed) return; if (PhoneLinesBijection.ContainsKey(phoneLineInfo)) return; SIPAccount acc = phoneLineInfo.AsSIPAccount(); IPhoneLine line; if (natSettings==null) line = softPhone.CreatePhoneLine(acc, phoneLineInfo.TransportType, phoneLineInfo.SrtpMode); else line = softPhone.CreatePhoneLine(acc, new NatConfiguration(natSettings.TraversalMethodType, natSettings.ServerAddress), phoneLineInfo.TransportType, phoneLineInfo.SrtpMode); line.PhoneLineStateChanged += PhoneLineInformation; softPhone.RegisterPhoneLine(line); }
public VoIPMessageSummary GetMessageSummary(PhoneLineInfo info) { IPhoneLine line = PhoneLinesBijection.Get(info); if (line == null) return null; return line.MessageSummary; }
/// <summary> /// Returns the actual DoNotDisturb state of the given phone lines. /// </summary> /// <param name="lineInfo">The phone line.</param> /// <returns>Returns null if can't get info about DND.</returns> public bool? GetDNDInfo(PhoneLineInfo lineInfo) { IPhoneLine line = PhoneLinesBijection.Get(lineInfo); if (line == null) return null; return line.DoNotDisturb; }
public void ChangeSRTPSettings(PhoneLineInfo lineInfo) { IPhoneLine line = PhoneLinesBijection.Get(lineInfo); if (line == null) return; line.SRTPMode = lineInfo.SrtpMode; }
public void PhoneLineDNDInfo(PhoneLineInfo lineInfo, bool dnd) { if (!chbDND.Enabled) return; chbDND.Checked = dnd; }
private void AddCallToHistory(PhoneLineInfo line, string dial, CallDirection type) { PhoneCallInfo info = new PhoneCallInfo(line, dial, type); softphoneEngine.AddCallToHistory(info); lbCallHistory.Items.Add(info); }
/// <summary> /// Starts a call on the phone line described by phone line info. /// </summary> /// <param name="phoneLineInfo">The information about the phone line.</param> /// <param name="dial">The dialed number.</param> public void StartCall(PhoneLineInfo phoneLineInfo, string dial) { if (disposed) return; PhoneCallInfo callInfo = new PhoneCallInfo(phoneLineInfo, dial, CallDirection.Outgoing); if (phoneCallsBijection.ContainsKey(callInfo)) return; if (!PhoneLinesBijection.ContainsKey(phoneLineInfo)) return; IPhoneLine line = PhoneLinesBijection.Get(phoneLineInfo); if (line == null) return; /* When a call is created and started, the state of call is going to * change over time. The SoftphoneEngine needs to subscribe * itself to this component before start the call. * */ IPhoneCall call = softPhone.CreateCallObject(line, dial); call.CallStateChanged += call_CallStateChanged; call.CallErrorOccured += call_CallErrorOccured; call.Start(); }