Search code examples
asteriskasteriskami

asterisk user events not detected


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.

:)


Solution

  • 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