This project is read-only.
Assuming you now have a connection to Asterisk established, you can now begin to listen in on events being sent over the AMI.
Please note, you will only receive events that your account has been subscribed too. For more information on this, please visit the voip-info.org wiki.

There are lots of different events to listen for from Asterisk, the events you'll want to handle depends simply on what information you want to monitor.
Lets assume we simply want to listen for new calls from the AMI, and when we see a new call notify the user via the console.

After we've created our ManagerConnection we'll want to add a handler for the NewState event.
astCon.NewState +=astCon_NewState; 

Now we'll want to add our code to the NewState event handler.
private void astCon_NewState(object sender, Asterisk.NET.Manager.Event.NewStateEvent e)
{
  Console.WriteLine("Call from {0} ({1}) is currently {2} on channel {3}",
    e.Attributes["connectedlinenum"],
    e.Attributes["connectedlinename"]),
    e.ChannelStateDesc,
    e.Channel)
}

Last edited Jun 21, 2013 at 5:19 PM by skrusty, version 2

Comments

No comments yet.