asterisk user events not detected

1.3k views Asked by At

We have our application that we are trying to connect to our asterisk using below code and look for AMI events such as Caller ID, Unique Id, Hangup, Answered, etc. We get successful login but there is no event that is transferred.

        callsList = new Dictionary<string, string>();
        activeAgents = new Dictionary<string, string>();
        manager = new ManagerConnection(credentials.Address, credentials.Port, credentials.UserName, credentials.Password);
        manager.NewCallerId += new NewCallerIdEventHandler(manager_NewCallerId);
        manager.Link += new LinkEventHandler(manager_Link);
        manager.Unlink += new UnlinkEventHandler(manager_Unlink);
        manager.NewState += new NewStateEventHandler(manager_NewState);
        manager.Hangup += new HangupEventHandler(manager_Hangup);
        manager.Login();

Our dial plan has following line

       exten => s,n,UserEvent(NewCallerId, ${CALLERID(num)})
       exten => s,n,UserEvent(NewState, ${CALLERID(num)})
       exten => s,n,UserEvent(Hangup, ${UNIQUEID})

The manager user we are using has all rights for read and write. Would appreciate any help.

:)

1

There are 1 answers

0
arheops On BEST ANSWER

Use tcpdump or other similar utility to check what exactly send to your AMI interface.

for tcpdump line have be like this

tcpdump -i eth0 -v -s0 -nn port 5038

Note, you have enabled events in case if you need it.

http://www.voip-info.org/wiki/view/Asterisk+manager+API

http://www.voip-info.org/wiki/view/asterisk+manager+events