From c124ebb0255c2fe45e3b6ad7e295c1943c6d82dd Mon Sep 17 00:00:00 2001 From: Jonas Swiatek Date: Mon, 16 Mar 2015 21:48:35 +0100 Subject: [PATCH] Event handlers for AttendedTransfer, BlindTransfer, BridgeEnter, BridgeLeave, BridgeCreate and BridgeDestroy, and added a gitignore-file --- .gitignore | 199 ++++++++++++++++++ Asterisk.2013/Asterisk.NET/AsterNET.csproj | 8 + .../Manager/Event/AttendedTransferEvent.cs | 88 ++++++++ .../Manager/Event/BlindTransferEvent.cs | 51 +++++ .../Manager/Event/BridgeActivityEvent.cs | 35 +++ .../Manager/Event/BridgeCreateEvent.cs | 14 ++ .../Manager/Event/BridgeDestroyEvent.cs | 14 ++ .../Manager/Event/BridgeEnterEvent.cs | 14 ++ .../Manager/Event/BridgeLeaveEvent.cs | 14 ++ .../Manager/Event/BridgeStateEvent.cs | 24 +++ .../Asterisk.NET/Manager/ManagerConnection.cs | 59 ++++++ 11 files changed, 520 insertions(+) create mode 100644 .gitignore create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/AttendedTransferEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/BlindTransferEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/BridgeActivityEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/BridgeCreateEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/BridgeDestroyEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEnterEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/BridgeLeaveEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/BridgeStateEvent.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6823d9a --- /dev/null +++ b/.gitignore @@ -0,0 +1,199 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studo 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +#NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding addin-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.[Cc]ache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +#Merge Crap +*.orig \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/AsterNET.csproj b/Asterisk.2013/Asterisk.NET/AsterNET.csproj index 769645e..74e638c 100644 --- a/Asterisk.2013/Asterisk.NET/AsterNET.csproj +++ b/Asterisk.2013/Asterisk.NET/AsterNET.csproj @@ -201,6 +201,13 @@ + + + + + + + @@ -237,6 +244,7 @@ + diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/AttendedTransferEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/AttendedTransferEvent.cs new file mode 100644 index 0000000..026e089 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/AttendedTransferEvent.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AsterNET.Manager.Event +{ + public class AttendedTransferEvent : ManagerEvent + { + public bool Result { get; set; } + public string OrigTransfererChannel { get; set; } + public string OrigTransfererChannelState { get; set; } + public string OrigTransfererChannelStatedesc { get; set; } + public string OrigTransfererCalleridNum { get; set; } + public string OrigTransfererCalleridName { get; set; } + public string OrigTransfererConnectedLineNum { get; set; } + public string OrigTransfererConnectedLineName { get; set; } + public string OrigTransfererLanguage { get; set; } + public string OrigTransfererAccountCode { get; set; } + public string OrigTransfererContext { get; set; } + public string OrigTransfererPriority { get; set; } + public string OrigTransfererUniqueId { get; set; } + public string OrigBridgeUniqueId { get; set; } + public string OrigBridgeType { get; set; } + public string OrigBridgetechnology { get; set; } + public string OrigBridgeCreator { get; set; } + public string OrigBridgeName { get; set; } + public string OrigBridgeNumChannels { get; set; } + + public string SecondTransfererChannel { get; set; } + public string SecondTransfererChannelState { get; set; } + public string SecondTransfererChannelStatedesc { get; set; } + public string SecondTransfererCalleridNum { get; set; } + public string SecondTransfererCalleridName { get; set; } + public string SecondTransfererConnectedLineNum { get; set; } + public string SecondTransfererConnectedLineName { get; set; } + public string SecondTransfererLanguage { get; set; } + public string SecondTransfererAccountCode { get; set; } + public string SecondTransfererContext { get; set; } + public string SecondTransfererExten { get; set; } + public string SecondTransfererPriority { get; set; } + public string SecondTransfererUniqueId { get; set; } + + public string SecondBridgeUniqueId { get; set; } + public string SecondBridgeType { get; set; } + public string SecondBridgeTechnology { get; set; } + public string SecondBridgeCreator { get; set; } + public string SecondBridgeName { get; set; } + public string SecondBridgeNumChannels { get; set; } + + public string TransfereeChannel { get; set; } + public string TransfereeChannelState { get; set; } + public string TransfereeChannelStatedesc { get; set; } + public string TransfereeCalleridNum { get; set; } + public string TransfereeCalleridName { get; set; } + public string TransfereeConnectedLineNum { get; set; } + public string TransfereeConnectedLineName { get; set; } + public string TransfereeLanguage { get; set; } + public string TransfereeAccountCode { get; set; } + public string TransfereeContext { get; set; } + public string TransfereeExten { get; set; } + public string TransfereePriority { get; set; } + public string TransfereeUniqueId { get; set; } + + public string TransferTargetChannel { get; set; } + public string TransferTargetChannelState { get; set; } + public string TransferTargetChannelStatedesc { get; set; } + public string TransferTargetCalleridNum { get; set; } + public string TransferTargetCalleridName { get; set; } + public string TransferTargetConnectedLineNum { get; set; } + public string TransferTargetConnectedLineName { get; set; } + public string TransferTargetLanguage { get; set; } + public string TransferTargetAccountCode { get; set; } + public string TransferTargetContext { get; set; } + public string TransferTargetPriority { get; set; } + public string TransferTargetUniqueId { get; set; } + + public bool IsExternal { get; set; } + public string DestType { get; set; } + public string DestBridgeUniqueId { get; set; } + + #region Constructor - AttendedTransferEvent(ManagerConnection source) + public AttendedTransferEvent(ManagerConnection source) + : base(source) + { + } + #endregion + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BlindTransferEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BlindTransferEvent.cs new file mode 100644 index 0000000..53e369d --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BlindTransferEvent.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AsterNET.Manager.Event +{ + public class BlindTransferEvent : ManagerEvent + { + public bool Result { get; set; } + public string TransfererChannel { get; set; } + public string TransfererChannelState { get; set; } + public string TransfererChannelStatedesc { get; set; } + public string TransfererCallerIdNum { get; set; } + public string TransfererCallerIdName { get; set; } + public string TransfererConnectedLineNum { get; set; } + public string TransfererConnectedLineName { get; set; } + public string TransfererLanguage { get; set; } + public string TransfererAccountCode { get; set; } + public string TransfererContext { get; set; } + public string TransfererPriority { get; set; } + public string TransfererUniqueId { get; set; } + public string TransfereeChannel { get; set; } + public string TransfereeChannelState { get; set; } + public string TransfereeChannelStateDesc { get; set; } + public string TransfereeCallerIdNum { get; set; } + public string TransfereeCallerIdName { get; set; } + public string TransfereeConnectedLineNum { get; set; } + public string TransfereeConnectedLineName { get; set; } + public string TransfereeLanguage { get; set; } + public string TransfereeAccountCode { get; set; } + public string TransfereeContext { get; set; } + public string TransfereeExten { get; set; } + public string TransfereePriority { get; set; } + public string TransfereeUniqueId { get; set; } + public string BridgeUniqueId { get; set; } + public string BridgeType { get; set; } + public string BridgeTechnology { get; set; } + public string BridgeCreator { get; set; } + public string BridgeName { get; set; } + public string BridgeNumChannels { get; set; } + public string IsExternal { get; set; } + public string Context { get; set; } + public string Extension { get; set; } + + #region Constructor - BlindTransferEvent(ManagerConnection source) + public BlindTransferEvent(ManagerConnection source) : base(source) + { + } + #endregion + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeActivityEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeActivityEvent.cs new file mode 100644 index 0000000..8c6e16e --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeActivityEvent.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace AsterNET.Manager.Event +{ + /// + /// + public abstract class BridgeActivityEvent : ManagerEvent + { + public string BridgeUniqueId { get; set; } + public string BridgeType { get; set; } + public string BridgeTechnology { get; set; } + public string BridgeCreator { get; set; } + public string BridgeName { get; set; } + public string BridgeNumChannels { get; set; } + public string ChannelState { get; set; } + public string ChannelStatedDesc { get; set; } + public string CallerIdNum { get; set; } + public string CallerIdName { get; set; } + public string ConnectedLineNum { get; set; } + public string ConnectedLineName { get; set; } + public string Language { get; set; } + public string AccountCode { get; set; } + public string Context { get; set; } + public string Exten { get; set; } + public string Priority { get; set; } + + #region Constructors + protected BridgeActivityEvent(ManagerConnection source) + : base(source) + { + } + #endregion + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeCreateEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeCreateEvent.cs new file mode 100644 index 0000000..e971f93 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeCreateEvent.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AsterNET.Manager.Event +{ + public class BridgeCreateEvent : BridgeStateEvent + { + public BridgeCreateEvent(ManagerConnection source) : base(source) + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeDestroyEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeDestroyEvent.cs new file mode 100644 index 0000000..29b98d2 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeDestroyEvent.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AsterNET.Manager.Event +{ + public class BridgeDestroyEvent : BridgeStateEvent + { + public BridgeDestroyEvent(ManagerConnection source) : base(source) + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEnterEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEnterEvent.cs new file mode 100644 index 0000000..4db0106 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEnterEvent.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AsterNET.Manager.Event +{ + public class BridgeEnterEvent : BridgeActivityEvent + { + public BridgeEnterEvent(ManagerConnection source) : base(source) + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeLeaveEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeLeaveEvent.cs new file mode 100644 index 0000000..b8584bb --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeLeaveEvent.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AsterNET.Manager.Event +{ + public class BridgeLeaveEvent : BridgeActivityEvent + { + public BridgeLeaveEvent(ManagerConnection source) : base(source) + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeStateEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeStateEvent.cs new file mode 100644 index 0000000..4d97b56 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeStateEvent.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; + +namespace AsterNET.Manager.Event +{ + /// + /// + public abstract class BridgeStateEvent : ManagerEvent + { + public string BridgeUniqueId { get; set; } + public string BridgeType { get; set; } + public string BridgeTechnology { get; set; } + public string BridgeCreator { get; set; } + public string BridgeName { get; set; } + public int BridgeNumChannels { get; set; } + + #region Constructors + protected BridgeStateEvent(ManagerConnection source) + : base(source) + { + } + #endregion + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index 487a9d7..3768cf7 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -89,6 +89,14 @@ namespace AsterNET.Manager public delegate void ConfbridgeEndEventHandler(object sender, Event.ConfbridgeEndEvent e); public delegate void ConfbridgeTalkingEventHandler(object sender, Event.ConfbridgeTalkingEvent e); public delegate void FailedACLEventHandler(object sender, Event.FailedACLEvent e); + public delegate void AttendedTransferEventHandler(object sender, Event.AttendedTransferEvent e); + public delegate void BlindTransferEventHandler(object sender, Event.BlindTransferEvent e); + public delegate void BridgeCreateEventHandler(object sender, Event.BridgeCreateEvent e); + public delegate void BridgeDestroyEventHandler(object sender, Event.BridgeDestroyEvent e); + public delegate void BridgeEnterEventHandler(object sender, Event.BridgeEnterEvent e); + public delegate void BridgeLeaveEventHandler(object sender, Event.BridgeLeaveEvent e); + + #endregion @@ -468,6 +476,14 @@ namespace AsterNET.Manager /// public event FailedACLEventHandler FailedACL; + public event AttendedTransferEventHandler AttendedTransfer; + public event BlindTransferEventHandler BlindTransfer; + + public event BridgeCreateEventHandler BridgeCreate; + public event BridgeDestroyEventHandler BridgeDestroy; + public event BridgeEnterEventHandler BridgeEnter; + public event BridgeLeaveEventHandler BridgeLeave; + #endregion #region Constructor - ManagerConnection() @@ -571,6 +587,13 @@ namespace AsterNET.Manager Helper.RegisterEventHandler(registeredEventHandlers, 86, typeof(FailedACLEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 87, typeof(AttendedTransferEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 88, typeof(BridgeCreateEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 89, typeof(BridgeDestroyEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 90, typeof(BridgeEnterEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 91, typeof(BridgeLeaveEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 92, typeof(BlindTransferEvent)); + #endregion @@ -1152,6 +1175,42 @@ namespace AsterNET.Manager { FailedACL(this, (FailedACLEvent)e); } + break; + case 87: + if (AttendedTransfer != null) + { + AttendedTransfer(this, (AttendedTransferEvent) e); + } + break; + case 88: + if (BridgeCreate != null) + { + BridgeCreate(this, (BridgeCreateEvent) e); + } + break; + case 89: + if (BridgeDestroy != null) + { + BridgeDestroy(this, (BridgeDestroyEvent)e); + } + break; + case 90: + if (BridgeEnter != null) + { + BridgeEnter(this, (BridgeEnterEvent)e); + } + break; + case 91: + if (BridgeLeave != null) + { + BridgeLeave(this, (BridgeLeaveEvent)e); + } + break; + case 92: + if (BlindTransfer != null) + { + BlindTransfer(this, (BlindTransferEvent)e); + } break; default: if (UnhandledEvent != null)