diff --git a/Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/Program.cs b/Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/Program.cs index 136c51b..0d72dc9 100644 --- a/Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/Program.cs +++ b/Asterisk.2013/Asterisk.NET.Test/Asterisk.NET.Test/Program.cs @@ -202,7 +202,7 @@ Ctrl-C to exit"); OriginateAction oc = new OriginateAction(); oc.Context = ORIGINATE_CONTEXT; - oc.Priority = 1; + oc.Priority = "1"; oc.Channel = ORIGINATE_CHANNEL; oc.CallerId = ORIGINATE_CALLERID; oc.Exten = ORIGINATE_EXTEN; diff --git a/Asterisk.2013/Asterisk.NET/Asterisk.NET.csproj b/Asterisk.2013/Asterisk.NET/Asterisk.NET.csproj index 3603bcd..dde37d6 100644 --- a/Asterisk.2013/Asterisk.NET/Asterisk.NET.csproj +++ b/Asterisk.2013/Asterisk.NET/Asterisk.NET.csproj @@ -127,9 +127,20 @@ + + + + + + + + + + + @@ -174,6 +185,16 @@ + + + + + + + + + + diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/AGIRequest.cs b/Asterisk.2013/Asterisk.NET/FastAGI/AGIRequest.cs index 70ddf3c..12ed1cf 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/AGIRequest.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/AGIRequest.cs @@ -252,15 +252,15 @@ namespace Asterisk.NET.FastAGI /// /// Returns the priority in the dial plan from which the AGI script was called. /// - public int Priority + public string Priority { get { if (request["priority"] != null) { - return Int32.Parse((string) request["priority"]); + return (string) request["priority"]; } - return -1; + return ""; } } diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs b/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs index 64f4c93..25baf83 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs @@ -47,6 +47,8 @@ namespace Asterisk.NET.FastAGI.MappingStrategies /// public string ScriptAssmebly { get; set; } + public Assembly PreLoadedAssembly { get; set; } + public static List LoadMappings(string pathToXml) { // Load ScriptMappings XML File @@ -92,8 +94,6 @@ namespace Asterisk.NET.FastAGI.MappingStrategies private List mappings; private Dictionary mapAssemblies; - public string AGIPath = string.Empty; - /// /// /// @@ -142,37 +142,44 @@ namespace Asterisk.NET.FastAGI.MappingStrategies lock (mapAssemblies) { mapAssemblies.Clear(); - try - { - foreach (var de in this.mappings) - { - MappingAssembly ma; - if (mapAssemblies.ContainsKey(de.ScriptName)) - throw new AGIException(String.Format("Duplicate mapping name '{0}'", de.ScriptName)); - if (!string.IsNullOrEmpty(de.ScriptAssmebly)) + if (this.mappings == null || this.mappings.Count == 0) + throw new AGIException("No mappings were added, before Load method called."); + + foreach (var de in this.mappings) + { + MappingAssembly ma; + + if (mapAssemblies.ContainsKey(de.ScriptName)) + throw new AGIException(String.Format("Duplicate mapping name '{0}'", de.ScriptName)); + if (!string.IsNullOrEmpty(de.ScriptAssmebly)) + { + try { ma = new MappingAssembly() { ClassName = (string)de.ScriptClass, - LoadedAssembly = Assembly.LoadFile(Path.Combine(this.AGIPath, de.ScriptAssmebly)) + LoadedAssembly = Assembly.LoadFile(de.ScriptAssmebly) }; } - else + catch (FileNotFoundException fnfex) { - ma = new MappingAssembly() - { - ClassName = (string)de.ScriptClass - }; + throw new AGIException(string.Format("Unable to load AGI Script {0}, file not found.", Path.Combine(Environment.CurrentDirectory, de.ScriptAssmebly)), fnfex); } - - mapAssemblies.Add(de.ScriptName, ma); } + else + { + ma = new MappingAssembly() + { + ClassName = (string)de.ScriptClass + }; + if (de.PreLoadedAssembly != null) + ma.LoadedAssembly = de.PreLoadedAssembly; + } + + mapAssemblies.Add(de.ScriptName, ma); } - catch (Exception ex) - { - throw new Exception("No mappings were added before 'Load' method called."); - } + } } diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/AGIAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/AGIAction.cs new file mode 100644 index 0000000..e83ca35 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/AGIAction.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + /// + /// This action lets you execute any AGI command through the Manager interface + /// For example, check the Asterisk.Net.Test project + /// + public class AgiAction : ManagerAction + { + public string Channel { get; set; } + public string Command { get; set; } + + /// + /// Get the name of this action, i.e. "AGI". + /// + override public string Action + { + get { return "AGI"; } + } + + /// + /// Creates a new empty AgiAction. + /// + public AgiAction(string channel, string command) + { + Channel = channel; + Command = command; + } + + + } +} \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeKickAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeKickAction.cs new file mode 100644 index 0000000..6de438e --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeKickAction.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeKickAction : ManagerAction + { + public string Conference { get; set; } + public string Channel { get; set; } + + public override string Action + { + get { return "ConfbridgeKick"; } + } + + /// + /// Removes a specified user from a specified conference. + /// + public ConfbridgeKickAction() + { } + + /// + /// Removes a specified user from a specified conference. + /// + /// + /// + public ConfbridgeKickAction(string conference, string channel) + { + this.Conference = conference; + this.Channel = channel; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeListAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeListAction.cs new file mode 100644 index 0000000..73d08ce --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeListAction.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + + /* + https://wiki.asterisk.org/wiki/display/AST/ConfBridge+10#ConfBridge10-ConfBridgeAsteriskManagerInterface%28AMI%29Events + Action: ConfbridgeList + Conference: 1111 + */ + + /// + /// Lists all users in a particular ConfBridge conference. ConfbridgeList will follow as separate events, + /// followed by a final event called ConfbridgeListComplete + /// + public class ConfbridgeListAction : ManagerActionEvent + { + public string Conference { get; set; } + + public override string Action + { + get { return "ConfbridgeList"; } + } + public override Type ActionCompleteEventClass() + { + return typeof(Event.ConfbridgeListCompleteEvent); + } + + /// + /// Lists all users in a particular ConfBridge conference. ConfbridgeList will follow as separate events, + /// followed by a final event called ConfbridgeListComplete + /// + /// + public ConfbridgeListAction(string conference) + { + this.Conference = conference; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeListRoomsAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeListRoomsAction.cs new file mode 100644 index 0000000..7bb4e58 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeListRoomsAction.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + + /// + /// Lists data about all active conferences. ConfbridgeListRooms will follow as separate events, + /// followed by a final event called ConfbridgeListRoomsComplete. + /// + public class ConfbridgeListRoomsAction : ManagerActionEvent + { + + public override string Action + { + get { return "ConfbridgeListRooms"; } + } + public override Type ActionCompleteEventClass() + { + return typeof(Event.ConfbridgeListRoomsCompleteEvent); + } + + /// + /// Lists data about all active conferences. ConfbridgeListRooms will follow as separate events, + /// followed by a final event called ConfbridgeListRoomsComplete. + /// + public ConfbridgeListRoomsAction() + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeLockAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeLockAction.cs new file mode 100644 index 0000000..7a59e27 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeLockAction.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeLockAction : ManagerAction + { + public string Conference { get; set; } + + public override string Action + { + get { return "ConfbridgeLock"; } + } + + /// + /// Locks a specified conference. + /// + public ConfbridgeLockAction() + { } + + /// + /// Locks a specified conference. + /// + /// + public ConfbridgeLockAction(string conference) + { + this.Conference = conference; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeMuteAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeMuteAction.cs new file mode 100644 index 0000000..25b3096 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeMuteAction.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeMuteAction : ManagerAction + { + public string Conference { get; set; } + public string Channel { get; set; } + + public override string Action + { + get { return "ConfbridgeMute"; } + } + + /// + /// Mutes a specified user in a specified conference. + /// + public ConfbridgeMuteAction() + { } + + /// + /// Mutes a specified user in a specified conference. + /// + /// + /// + public ConfbridgeMuteAction(string conference, string channel) + { + this.Conference = conference; + this.Channel = channel; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeSetSingleVideoSrcAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeSetSingleVideoSrcAction.cs new file mode 100644 index 0000000..4e755d1 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeSetSingleVideoSrcAction.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeSetSingleVideoSrcAction : ManagerAction + { + public string Conference { get; set; } + public string Channel { get; set; } + + public override string Action + { + get { return "ConfbridgeSetSingleVideoSrc"; } + } + + /// + /// Stops recording a specified conference. + /// + public ConfbridgeSetSingleVideoSrcAction() + { } + + /// + /// Stops recording a specified conference. + /// + /// + public ConfbridgeSetSingleVideoSrcAction(string conference, string channel) + { + this.Conference = conference; + this.Channel = channel; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeStartRecordAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeStartRecordAction.cs new file mode 100644 index 0000000..0e4f616 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeStartRecordAction.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeStartRecordAction : ManagerAction + { + public string Conference { get; set; } + + public override string Action + { + get { return "ConfbridgeStartRecord"; } + } + + /// + /// Starts recording a specified conference, with an optional filename. + /// If recording is already in progress, an error will be returned. + /// If RecordFile is not provided, the default record_file as specified in the conferences Bridge Profile will be used. + /// If record_file is not specified, a file will automatically be generated in Asterisk's monitor directory. + /// + public ConfbridgeStartRecordAction() + { } + + /// + /// Starts recording a specified conference, with an optional filename. + /// If recording is already in progress, an error will be returned. + /// If RecordFile is not provided, the default record_file as specified in the conferences Bridge Profile will be used. + /// If record_file is not specified, a file will automatically be generated in Asterisk's monitor directory. + /// + /// + public ConfbridgeStartRecordAction(string conference) + { + this.Conference = conference; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeStopRecordAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeStopRecordAction.cs new file mode 100644 index 0000000..c30f351 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeStopRecordAction.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeStopRecordAction : ManagerAction + { + public string Conference { get; set; } + + public override string Action + { + get { return "ConfbridgeStopRecord"; } + } + + /// + /// Stops recording a specified conference. + /// + public ConfbridgeStopRecordAction() + { } + + /// + /// Stops recording a specified conference. + /// + /// + public ConfbridgeStopRecordAction(string conference) + { + this.Conference = conference; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeUnlockAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeUnlockAction.cs new file mode 100644 index 0000000..2da081e --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeUnlockAction.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeUnlockAction : ManagerAction + { + public string Conference { get; set; } + + public override string Action + { + get { return "ConfbridgeUnlock"; } + } + + /// + /// Unlocks a specified conference. + /// + public ConfbridgeUnlockAction() + { } + + /// + /// Unlocks a specified conference. + /// + /// + public ConfbridgeUnlockAction(string conference) + { + this.Conference = conference; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeUnmuteAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeUnmuteAction.cs new file mode 100644 index 0000000..0d552f5 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/ConfbridgeUnmuteAction.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Action +{ + public class ConfbridgeUnmuteAction : ManagerAction + { + public string Conference { get; set; } + public string Channel { get; set; } + + public override string Action + { + get { return "ConfbridgeUnmute"; } + } + + /// + /// Unmutes a specified user in a specified conference. + /// + public ConfbridgeUnmuteAction() + { } + + /// + /// Unmutes a specified user in a specified conference. + /// + /// + /// + public ConfbridgeUnmuteAction(string conference, string channel) + { + this.Conference = conference; + this.Channel = channel; + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs index de2e883..e7e0e36 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs @@ -27,7 +27,7 @@ namespace Asterisk.NET.Manager.Action private string channel; private string exten; private string context; - private int priority; + private string priority; private int timeout; private string callerId; private Dictionary variables; @@ -110,7 +110,7 @@ namespace Asterisk.NET.Manager.Action /// Get /Set the priority of the extension to connect to. /// If you set the priority you also have to set the context and exten properties. /// - public int Priority + public string Priority { get { return priority; } set { this.priority = value; } diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractConfbridgeEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractConfbridgeEvent.cs new file mode 100644 index 0000000..3ce493a --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractConfbridgeEvent.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class AbstractConfbridgeEvent : ManagerEvent + { + /// + /// + /// + public string Conference { get; set; } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeEndEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeEndEvent.cs new file mode 100644 index 0000000..f3c9467 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeEndEvent.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeEndEvent : AbstractConfbridgeEvent + { + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeJoinEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeJoinEvent.cs new file mode 100644 index 0000000..d74e83d --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeJoinEvent.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeJoinEvent : AbstractConfbridgeEvent + { + /// + /// + /// + public string CallerIDnum { get; set; } + + /// + /// + /// + public string CallerIDname { get; set; } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeLeaveEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeLeaveEvent.cs new file mode 100644 index 0000000..799eb8e --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeLeaveEvent.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeLeaveEvent : AbstractConfbridgeEvent + { + /// + /// + /// + public string CallerIDnum { get; set; } + + /// + /// + /// + public string CallerIDname { get; set; } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListCompleteEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListCompleteEvent.cs new file mode 100644 index 0000000..3ac53eb --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListCompleteEvent.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + class ConfbridgeListCompleteEvent + { + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListEvent.cs new file mode 100644 index 0000000..2a00b21 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListEvent.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeListEvent : ResponseEvent + { + /// + /// + /// + public string Conference { get; set; } + + /// + /// + /// + public string CallerIDNum { get; set; } + + /// + /// + /// + public string CallerIDName { get; set; } + + /// + /// + /// + public string Admin { get; set; } + + /// + /// + /// + public string MarkedUser { get; set; } + + public ConfbridgeListEvent(ManagerConnection source) + : base(source) + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListRoomsCompleteEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListRoomsCompleteEvent.cs new file mode 100644 index 0000000..cbac81c --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListRoomsCompleteEvent.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeListRoomsCompleteEvent : ResponseEvent + { + + public ConfbridgeListRoomsCompleteEvent(ManagerConnection source) + : base(source) + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListRoomsEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListRoomsEvent.cs new file mode 100644 index 0000000..97c8f90 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeListRoomsEvent.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeListRoomsEvent : ResponseEvent + { + /// + /// + /// + public string Conference { get; set; } + + /// + /// + /// + public int Parties { get; set; } + + /// + /// + /// + public int Marked { get; set; } + + /// + /// + /// + public string Locked { get; set; } + + public ConfbridgeListRoomsEvent(ManagerConnection source) + : base(source) + { + } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeStartEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeStartEvent.cs new file mode 100644 index 0000000..d503343 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeStartEvent.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeStartEvent : AbstractConfbridgeEvent + { + + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeTalkingEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeTalkingEvent.cs new file mode 100644 index 0000000..f5deff7 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConfbridgeTalkingEvent.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Asterisk.NET.Manager.Event +{ + public class ConfbridgeTalkingEvent : AbstractConfbridgeEvent + { + /// + /// + /// + public string TalkingStatus { get; set; } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index 11a1338..ceb8940 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -82,6 +82,12 @@ namespace Asterisk.NET.Manager public delegate void ZapShowChannelsEventHandler(object sender, Event.ZapShowChannelsEvent e); public delegate void ConnectionStateEventHandler(object sender, Event.ConnectionStateEvent e); public delegate void VarSetEventHandler(object sender, Event.VarSetEvent e); + public delegate void AGIExecHandler(object sender, Event.AGIExecEvent e); + public delegate void ConfbridgeStartEventHandler(object sender, Event.ConfbridgeStartEvent e); + public delegate void ConfbridgeJoinEventHandler(object sender, Event.ConfbridgeJoinEvent e); + public delegate void ConfbridgeLeaveEventHandler(object sender, Event.ConfbridgeLeaveEvent e); + public delegate void ConfbridgeEndEventHandler(object sender, Event.ConfbridgeEndEvent e); + public delegate void ConfbridgeTalkingEventHandler(object sender, Event.ConfbridgeTalkingEvent e); #endregion @@ -420,6 +426,36 @@ namespace Asterisk.NET.Manager /// public event VarSetEventHandler VarSet; + /// + /// AgiExec is execute + /// + public event AGIExecHandler AGIExec; + + /// + /// This event is sent when the first user requests a conference and it is instantiated + /// + public event ConfbridgeStartEventHandler ConfbridgeStart; + + /// + /// This event is sent when a user joins a conference - either one already in progress or as the first user to join a newly instantiated bridge. + /// + public event ConfbridgeJoinEventHandler ConfbridgeJoin; + + /// + /// This event is sent when a user leaves a conference. + /// + public event ConfbridgeLeaveEventHandler ConfbridgeLeave; + + /// + /// This event is sent when the last user leaves a conference and it is torn down. + /// + public event ConfbridgeEndEventHandler ConfbridgeEnd; + + /// + /// This event is sent when the conference detects that a user has either begin or stopped talking. + /// + public event ConfbridgeTalkingEventHandler ConfbridgeTalking; + #endregion #region Constructor - ManagerConnection() @@ -513,6 +549,13 @@ namespace Asterisk.NET.Manager Helper.RegisterEventHandler(registeredEventHandlers, 65, typeof(DTMFEvent)); Helper.RegisterEventHandler(registeredEventHandlers, 70, typeof(VarSetEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 80, typeof(AGIExecEvent)); + + Helper.RegisterEventHandler(registeredEventHandlers, 81, typeof(ConfbridgeStartEventHandler)); + Helper.RegisterEventHandler(registeredEventHandlers, 82, typeof(ConfbridgeJoinEventHandler)); + Helper.RegisterEventHandler(registeredEventHandlers, 83, typeof(ConfbridgeLeaveEventHandler)); + Helper.RegisterEventHandler(registeredEventHandlers, 84, typeof(ConfbridgeEndEventHandler)); + Helper.RegisterEventHandler(registeredEventHandlers, 85, typeof(ConfbridgeTalkingEventHandler)); #endregion @@ -1065,7 +1108,42 @@ namespace Asterisk.NET.Manager VarSet(this, (VarSetEvent)e); } break; - + case 80: + if (AGIExec != null) + { + AGIExec(this, (AGIExecEvent)e); + } + break; + case 81: + if (ConfbridgeStart != null) + { + ConfbridgeStart(this, (ConfbridgeStartEvent)e); + } + break; + case 82: + if (ConfbridgeJoin != null) + { + ConfbridgeJoin(this, (ConfbridgeJoinEvent)e); + } + break; + case 83: + if (ConfbridgeLeave != null) + { + ConfbridgeLeave(this, (ConfbridgeLeaveEvent)e); + } + break; + case 84: + if (ConfbridgeEnd != null) + { + ConfbridgeEnd(this, (ConfbridgeEndEvent)e); + } + break; + case 85: + if (ConfbridgeTalking != null) + { + ConfbridgeTalking(this, (ConfbridgeTalkingEvent)e); + } + break; default: if (UnhandledEvent != null) UnhandledEvent(this, e); diff --git a/Asterisk.2013/ChangeLog.txt b/Asterisk.2013/ChangeLog.txt index ce871f0..4a6d42d 100644 --- a/Asterisk.2013/ChangeLog.txt +++ b/Asterisk.2013/ChangeLog.txt @@ -1,3 +1,13 @@ +03.01.2014 (skrusty) + Added patch submitted by Saritha Bhandarkar + Adds AGIAction to Asterisk Manager + Adds AGIAction Event + Changes PRIORTY (int to string) - BREAKING CHANGE!! If you use Priority for Originate, then this will have broken between last release and now. + Added Support for v10+ ConfBridge events (not yet fully tested) + Added Support for v10+ COnfBridge actions (not yet fully tested) + Changed GeneralMappingStrategy requires a full path to an assembly that requires loading + Added GeneralMappingStrategy can now take an assembly in the mapping strategy, forcing AsterNET not to reload the assembly during load + 21.08.2013 (skrusty) Added VarSetEventHandler (added as contribution by bacobart) Added IMappingStrategy to allow different mapping strategies to be created (added as contribution by bacobart) (*note to get documentation added for this)