1
votes

I'm developing a telephony solution based on Asterisk (the most popular open-source PBX solution), and I inject my logic into its dial-plans using AMI protocol and I listen to Asterisk's events using AGI.

Right now I need to manage the attended-transfer in my application (not blind-transfer) and for that, I do really need to log the traffic of AMI and AGI in a textual format somewhere, so that I can see what's going on behind the scenes.

I thought of WireShark, as it's the most powerful traffic capture tool out there, but I can't make it work. I don't know which port to capture (AMI works on port 5038 on asterisk side, but I need to use WireShark in my C# application server, and I don't know which port is busy on this side). I can't create a filter for capturing events which are only related to Asterisk.

I also don't know how to make WireShark log traffic in a textual format rather than showing those binary data (maybe hexadecimal data) which are not human-readable at all.

I know that AMI protocol is so easy and like HTTP it's a text-based messaging protocol. Therefore I guess I should be able to see a textual log of it.

Anyone has any idea for it?

1

1 Answers

3
votes

You can't listen asterisk events using AGI. AGI is CONTROL interface, no events send to it. All events go via AMI.

You can use tcpdump on asterisk server(linux side) to see AMI messages:

tcpdump -i eth0 -nqtttt -s 0 -A  '((src port 5038) or (dst port 5038))' 

You can't capture AGI traffic unless it is FastAGI. For got agi info do:

asterisk -r
agi set debug on