]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Set the invitestate to INV_CANCELLED only if we are actually sending a SIP CANCEL.
authorMark Michelson <mmichelson@digium.com>
Tue, 12 May 2009 18:18:44 +0000 (18:18 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 12 May 2009 18:18:44 +0000 (18:18 +0000)
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

channels/chan_sip.c

index ddcc81773ee1ed789d9efc22ad39dd16e5d5c288..f744e073b3e1fc7070bb95183612c16595c2a997 100644 (file)
@@ -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