Order of actions AMI

Hi all,

I’m having some trouble when calling a device right after hanging it up. Not always but often, I get “busy here” message.

I’ve created a process which sends AMI actions. This hanging up and calling is happening very quickly and I captured wireshark packets to see what was going on. I saw INVITE packets coming before BYE which made the devices send a “busy here” error.

I dug a little more and captured tcp socket (AMI socket) packets. In this case, I saw that the same packet is containing both actions. I checked if this is only happening when the error occurs or not and I saw that when the Hangup-Call works fine (right action order, no busy here) the actions are included at the same AMI message too.

So, how could I make asterisk to respect the order of actions even inside the same packet? Or is there any solution for this?

Thanks a lot!


IP packet boundaries are irrelevant to AMI message boundaries (which are delimited by double newlines).

Unless you use HTTP, AMI actions are performed in strict order of arrival, as there is a loop in manager.c that reads the requests, then calls a subroutine, synchronously, to perform them.

I think your problem is that you haven’t waited for the SIP handshake to complete before sending the next request, rather than the requests are being run out of order.