using System; namespace AsterNET.Manager.Event { /// /// A NewCallerIdEvent is triggered when the caller id of a channel changes.
/// It is implemented in channel.c ///
public class NewCallerIdEvent : ManagerEvent { private string callerId; private string callerIdNum; private string callerIdName; private string cidCallingPresTxt; private int cidCallingPres; public NewCallerIdEvent(ManagerConnection source) : base(source) { } /// /// Get/Set the new caller id. /// public string CallerId { get { return callerId; } set { this.callerId = value; } } /// /// Get/Set the new Caller*ID Name if set or "≶Unknown>" if none has been set. /// public string CallerIdName { get { return callerIdName; } set { this.callerIdName = value; } } /// /// Get/Set the new Caller*ID Numb. /// public string CallerIdNum { get { return callerIdNum; } set { this.callerIdNum = value; } } /// /// Get the CallerId presentation/screening. /// public int CidCallingPresNumeric { get { return cidCallingPres; } } /// /// Get/Sets the CallerId presentation/screening in the form "%d (%s)". /// public string CidCallingPres { get { return cidCallingPres.ToString() + " (" + cidCallingPresTxt + ")"; } set { string s = value; if (s == null || s.Length == 0) return; int spaceIdx = s.IndexOf(' '); if (spaceIdx <= 0) spaceIdx = s.Length; try { this.cidCallingPres = int.Parse(s.Substring(0, spaceIdx)); } catch (FormatException) { return; } if (s.Length > spaceIdx + 3) this.cidCallingPresTxt = s.Substring(spaceIdx + 2, (s.Length - 1) - (spaceIdx + 2)); } } } }