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 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}",

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


No comments yet.