From: Mark Michelson Date: Tue, 12 May 2009 18:18:44 +0000 (+0000) Subject: Set the invitestate to INV_CANCELLED only if we are actually sending a SIP CANCEL. X-Git-Tag: 1.4.25-rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63c0dca7bd8a48d09a9ce92068eeb3ee9708fc73;p=thirdparty%2Fasterisk.git Set the invitestate to INV_CANCELLED only if we are actually sending a SIP CANCEL. The problem was that the hangup code was setting the invitestate too early. The result of this was that we would always send a CANCEL request, even if it was not an appropriate time to do so (e.g. we have not yet received a provisional response for our INVITE). Note that this same fix had been applied to trunk and the 1.6.X branches starting with revision 155467. This is why you will see this revision being blocked from those places. AST-216 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@193880 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index ddcc81773e..f744e073b3 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3658,7 +3658,6 @@ static int sip_hangup(struct ast_channel *ast) if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) { /* stop retransmitting an INVITE that has not received a response */ __sip_pretend_ack(p); - p->invitestate = INV_CANCELLED; /* if we can't send right now, mark it pending */ if (p->invitestate == INV_CALLING) { @@ -3668,6 +3667,7 @@ static int sip_hangup(struct ast_channel *ast) sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); append_history(p, "DELAY", "Not sending cancel, waiting for timeout"); } else { + p->invitestate = INV_CANCELLED; /* Send a new request: CANCEL */ transmit_request(p, SIP_CANCEL, p->lastinvite, XMIT_RELIABLE, FALSE); /* Actually don't destroy us yet, wait for the 487 on our original