add events DialEndEvent, QueueCallerJoinEvent, QueueCallerLeaveEvent for further Asterisk 13 support

This commit is contained in:
Herman van den Berg 2016-09-21 09:04:36 +02:00
parent 959c53de8c
commit e5df1f7195
7 changed files with 97 additions and 6 deletions

View file

@ -232,8 +232,11 @@
<Compile Include="Manager\Event\BridgeEvent.cs" /> <Compile Include="Manager\Event\BridgeEvent.cs" />
<Compile Include="Manager\Event\ChannelReloadEvent.cs" /> <Compile Include="Manager\Event\ChannelReloadEvent.cs" />
<Compile Include="Manager\Event\ChannelUpdateEvent.cs" /> <Compile Include="Manager\Event\ChannelUpdateEvent.cs" />
<Compile Include="Manager\Event\DialEndEvent.cs" />
<Compile Include="Manager\Event\DialBeginEvent.cs" /> <Compile Include="Manager\Event\DialBeginEvent.cs" />
<Compile Include="Manager\Event\FailedACLEvent.cs" /> <Compile Include="Manager\Event\FailedACLEvent.cs" />
<Compile Include="Manager\Event\QueueCallerJoinEvent.cs" />
<Compile Include="Manager\Event\QueueCallerLeaveEvent.cs" />
<Compile Include="Manager\Event\MeetmeMuteEvent.cs" /> <Compile Include="Manager\Event\MeetmeMuteEvent.cs" />
<Compile Include="Manager\Event\DTMFEvent.cs" /> <Compile Include="Manager\Event\DTMFEvent.cs" />
<Compile Include="Manager\Event\FaxReceivedEvent.cs" /> <Compile Include="Manager\Event\FaxReceivedEvent.cs" />

View file

@ -1,11 +1,9 @@
namespace AsterNET.Manager.Event namespace AsterNET.Manager.Event
{ {
/// <summary> /// <summary>
/// A dial begin event is triggered whenever a phone attempts to dial someone.<br/> /// A dial begin event is triggered whenever when a dial action has started.<br/>
/// This event is implemented in apps/app_dial.c.<br/> /// </summary>
/// Available since Asterisk 1.2. public class DialBeginEvent : DialEvent
/// </summary>
public class DialBeginEvent : DialEvent
{ {
/// <summary> /// <summary>
/// Creates a new DialBeginEvent. /// Creates a new DialBeginEvent.

View file

@ -0,0 +1,18 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// A dial begin event is triggered whenever when a dial action has completed.<br/>
/// </summary>
public class DialEndEvent : DialEvent
{
/// <summary>
/// Creates a new DialEndEvent.
/// </summary>
public DialEndEvent(ManagerConnection source)
: base(source)
{
}
public string Forward { get; set; }
}
}

View file

@ -0,0 +1,15 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// A QueueCallerJoinEvent is triggered when a channel joins a queue.<br/>
/// </summary>
public class QueueCallerJoinEvent : QueueEvent
{
public string Position { get; set; }
public QueueCallerJoinEvent(ManagerConnection source)
: base(source)
{
}
}
}

View file

@ -0,0 +1,15 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// A QueueCallerLeaveEvent is triggered when a channel leaves a queue.<br/>
/// </summary>
public class QueueCallerLeaveEvent : QueueEvent
{
public string Position { get; set; }
public QueueCallerLeaveEvent(ManagerConnection source)
: base(source)
{
}
}
}

View file

@ -96,6 +96,9 @@ namespace AsterNET.Manager
public delegate void BridgeEnterEventHandler(object sender, Event.BridgeEnterEvent e); public delegate void BridgeEnterEventHandler(object sender, Event.BridgeEnterEvent e);
public delegate void BridgeLeaveEventHandler(object sender, Event.BridgeLeaveEvent e); public delegate void BridgeLeaveEventHandler(object sender, Event.BridgeLeaveEvent e);
public delegate void DialBeginEventHandler(object sender, Event.DialBeginEvent e); public delegate void DialBeginEventHandler(object sender, Event.DialBeginEvent e);
public delegate void DialEndEventHandler(object sender, Event.DialEndEvent e);
public delegate void QueueCallerJoinEventHandler(object sender, Event.QueueCallerJoinEvent e);
public delegate void QueueCallerLeaveEventHandler(object sender, Event.QueueCallerLeaveEvent e);
@ -492,6 +495,21 @@ namespace AsterNET.Manager
/// </summary> /// </summary>
public event DialBeginEventHandler DialBegin; public event DialBeginEventHandler DialBegin;
/// <summary>
/// Raised when a dial action has completed.<br/>
/// </summary>
public event DialEndEventHandler DialEnd;
/// <summary>
/// Raised when a caller joins a Queue.<br/>
/// </summary>
public event QueueCallerJoinEventHandler QueueCallerJoin;
/// <summary>
/// Raised when a caller leaves a Queue.<br/>
/// </summary>
public event QueueCallerLeaveEventHandler QueueCallerLeave;
#endregion #endregion
#region Constructor - ManagerConnection() #region Constructor - ManagerConnection()
@ -602,6 +620,9 @@ namespace AsterNET.Manager
Helper.RegisterEventHandler(registeredEventHandlers, 91, typeof(BridgeLeaveEvent)); Helper.RegisterEventHandler(registeredEventHandlers, 91, typeof(BridgeLeaveEvent));
Helper.RegisterEventHandler(registeredEventHandlers, 92, typeof(BlindTransferEvent)); Helper.RegisterEventHandler(registeredEventHandlers, 92, typeof(BlindTransferEvent));
Helper.RegisterEventHandler(registeredEventHandlers, 93, typeof(DialBeginEvent)); Helper.RegisterEventHandler(registeredEventHandlers, 93, typeof(DialBeginEvent));
Helper.RegisterEventHandler(registeredEventHandlers, 94, typeof(DialEndEvent));
Helper.RegisterEventHandler(registeredEventHandlers, 95, typeof(QueueCallerJoinEvent));
Helper.RegisterEventHandler(registeredEventHandlers, 96, typeof(QueueCallerLeaveEvent));
#endregion #endregion
@ -1226,6 +1247,24 @@ namespace AsterNET.Manager
DialBegin(this, (DialBeginEvent)e); DialBegin(this, (DialBeginEvent)e);
} }
break; break;
case 94:
if (DialEnd != null)
{
DialEnd(this, (DialEndEvent)e);
}
break;
case 95:
if (QueueCallerJoin != null)
{
QueueCallerJoin(this, (QueueCallerJoinEvent)e);
}
break;
case 96:
if (QueueCallerLeave != null)
{
QueueCallerLeave(this, (QueueCallerLeaveEvent)e);
}
break;
default: default:
if (UnhandledEvent != null) if (UnhandledEvent != null)
UnhandledEvent(this, e); UnhandledEvent(this, e);

View file

@ -1,3 +1,6 @@
21.09.2016 (herman1vdb)
Added events DialEndEvent, QueueCallerJoinEvent, QueueCallerLeaveEvent for further Asterisk 13 support
20.09.2016 (herman1vdb) 20.09.2016 (herman1vdb)
Added DialBeginEvent Added DialBeginEvent