2013-01-18 15:55:50 +00:00
|
|
|
using System;
|
2015-01-03 15:37:29 +00:00
|
|
|
|
2014-01-08 14:16:39 +00:00
|
|
|
namespace AsterNET.Manager.Event
|
2013-01-18 15:55:50 +00:00
|
|
|
{
|
2015-01-03 15:37:29 +00:00
|
|
|
/// <summary>
|
|
|
|
/// A NewCallerIdEvent is triggered when the caller id of a channel changes.<br />
|
|
|
|
/// It is implemented in <code>channel.c</code>
|
|
|
|
/// </summary>
|
|
|
|
public class NewCallerIdEvent : ManagerEvent
|
|
|
|
{
|
|
|
|
private int cidCallingPres;
|
|
|
|
private string cidCallingPresTxt;
|
|
|
|
|
|
|
|
public NewCallerIdEvent(ManagerConnection source)
|
|
|
|
: base(source)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the new caller id.
|
|
|
|
/// </summary>
|
|
|
|
public string CallerId { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the new Caller*ID Name if set or "≶Unknown>" if none has been set.
|
|
|
|
/// </summary>
|
|
|
|
public string CallerIdName { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the new Caller*ID Numb.
|
|
|
|
/// </summary>
|
|
|
|
public string CallerIdNum { get; set; }
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Get the CallerId presentation/screening.
|
|
|
|
/// </summary>
|
|
|
|
public int CidCallingPresNumeric
|
|
|
|
{
|
|
|
|
get { return cidCallingPres; }
|
|
|
|
}
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Get/Sets the CallerId presentation/screening in the form "%d (%s)".
|
|
|
|
/// </summary>
|
|
|
|
public string CidCallingPres
|
|
|
|
{
|
|
|
|
get { return cidCallingPres + " (" + cidCallingPresTxt + ")"; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
string s = value;
|
|
|
|
if (s == null || s.Length == 0)
|
|
|
|
return;
|
2013-01-18 15:55:50 +00:00
|
|
|
|
2015-01-03 15:37:29 +00:00
|
|
|
int spaceIdx = s.IndexOf(' ');
|
|
|
|
if (spaceIdx <= 0)
|
|
|
|
spaceIdx = s.Length;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
cidCallingPres = int.Parse(s.Substring(0, spaceIdx));
|
|
|
|
}
|
|
|
|
catch (FormatException)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (s.Length > spaceIdx + 3)
|
|
|
|
cidCallingPresTxt = s.Substring(spaceIdx + 2, (s.Length - 1) - (spaceIdx + 2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-18 15:55:50 +00:00
|
|
|
}
|