Files
asterisk/channels
Mark Michelson 12b5e7706c Properly ACK 487 responses to canceled INVITEs.
From the review board request:
The fix from review 298 has exposed a new bug in chan_sip.

When we hang up an outgoing call, we first will dump all the outstanding 
packets on the sip_pvt using __sip_pretend_ack. Then, if we can, we send 
a CANCEL. The problem with this is that since destroyed all the outstanding 
packets on the dialog, we cannot match the incoming 487 response to our 
INVITE. Because we cannot match the response, we do not send an ACK.

To correct this, instead of using __sip_pretend_ack, I have changed the code 
to loop through the list of packets and call __sip_semi_ack on each one 
instead. This causes us to stop retransmitting the requests, but we still have 
them around in case we get responses for them.

When discussing this earlier today with Josh Colp, we both agreed that in the 
majority of cases, this would be enough of a fix. However, we also agreed that 
we should have a safety net in place in case we never receive a response to 
our initial INVITE. To handle this, I have modified __sip_autodestruct to 
behave similar to the way it does in Asterisk 1.4. If there are outstanding 
packets on the sip_pvt, the needdestroy flag is not set, and the last request 
on the dialog was either a CANCEL or BYE, then we set the needdestroy flag and 
reschedule destruction for 10 seconds in the future. If, though, the 
needdestroy flag is set, then we use __sip_pretend_ack to kill the remaining 
outstanding packets so that the monitor thread can destroy the sip_pvt.

I ran two separate tests. First, I placed a call from my Aastra phone to my 
Polycom phone. I hung up the Aastra before the Polycom answered. I verified 
through sip debug output that Asterisk properly ACKed the 487 received from the 
Polycom.

For my second test, I set up a SIPp UAS scenario so that it would send a 200 OK 
in response to a CANCEL but would not send a 487 for the original INVITE. I 
verified that after about 40 seconds, Asterisk properly cleans up the outgoing 
sip_pvt for the call.

Review: https://reviewboard.asterisk.org/r/308



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@205877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-10 17:39:13 +00:00
..
2009-04-17 21:27:55 +00:00
2009-07-08 23:15:54 +00:00
2009-01-25 23:44:01 +00:00
2009-05-14 22:59:43 +00:00
2009-04-10 22:16:13 +00:00