All,
There seems to be a bug in Asterisk 1.4.21 which gives the infamous 'Maximum retries exceeded on transmission' error relating to a 'Critical Packet'. A lot of people are seeing this error - and normally it reflects a bad NAT configuration somewhere - but in my case it was something else.
I am receiving a call from a DID number and bridging the call to another provider (a landline). With all the debugging options switched on, I can see that the ACK response from the provider IS arriving through the NAT without any problems - and is being processed by Asterisk (the right channel being found, and the ACK being acknowledged) - However, asterisk continues to retransmit its Seq 102 messages as if it has not seen the ACK at all.
Now this took me ages to fix, and I read a lot on the subject. Here are links to the Asterisk bugs that describe the problem:
https://issues.asterisk.org/view.php?id=12746,
https://issues.asterisk.org/view.php?id=10332 and
https://issues.asterisk.org/view.php?id=13115.
The solution (workaround)The line is being answered too quickly. I assume there is a race condition somewhere such that asterisk begins sending out it's critical packets before having fully established the connection - and so when the ACKs arrive they are checked against any pending acknowledgment requests - and find the wrong request at the top of the stack. If you call an actual local SIP handset then it works fine and there is a delay while the handset starts ringing. If, however, you forward the call on to an external extension or to an application (Like the MusicOnHold app I used during testing) then asterisk answers too quickly.
I made a custom application to test this looking like this:
1,Wait(2)
2,Answer()
3,MusicOnHold()
4,Hangup()
... And it works a treat. So there's the solution for all to see - we need to put in a delay before answering. 2 Seconds is probably too much, but I'm being overcautious at this point! If we change the Askozia code slightly to include a Wait() command in the dialplan whenever you are forwarding a provider to either an application or an external phone - then all will work fine.
I hope this is stumbled upon by the next person to smack their head against this issue for a few days, and I hope that the workaround might appear in the next release of Askozia.
Many thanks, and keep up the good work on an excellent project.
Regards,
Ben Hathaway