Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 99501) +++ channels/chan_sip.c (arbetskopia) @@ -3545,6 +3545,7 @@ 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) { @@ -3560,7 +3561,6 @@ INVITE, but do set an autodestruct just in case we never get it. */ needdestroy = 0; sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); - p->invitestate = INV_CANCELLED; } if ( p->initid != -1 ) { /* channel still up - reverse dec of inUse counter @@ -12024,14 +12024,14 @@ switch (resp) { case 100: /* Trying */ case 101: /* Dialog establishment */ - if (!ast_test_flag(req, SIP_PKT_IGNORE)) + if (!ast_test_flag(req, SIP_PKT_IGNORE) && (p->invitestate != INV_CANCELLED)) sip_cancel_destroy(p); check_pendings(p); break; case 180: /* 180 Ringing */ case 182: /* 182 Queued */ - if (!ast_test_flag(req, SIP_PKT_IGNORE)) + if (!ast_test_flag(req, SIP_PKT_IGNORE) && (p->invitestate != INV_CANCELLED)) sip_cancel_destroy(p); if (!ast_test_flag(req, SIP_PKT_IGNORE) && p->owner) { ast_queue_control(p->owner, AST_CONTROL_RINGING); @@ -12051,7 +12051,7 @@ break; case 183: /* Session progress */ - if (!ast_test_flag(req, SIP_PKT_IGNORE)) + if (!ast_test_flag(req, SIP_PKT_IGNORE) && (p->invitestate != INV_CANCELLED)) sip_cancel_destroy(p); /* Ignore 183 Session progress without SDP */ if (find_sdp(req)) { @@ -12066,7 +12066,7 @@ break; case 200: /* 200 OK on invite - someone's answering our call */ - if (!ast_test_flag(req, SIP_PKT_IGNORE)) + if (!ast_test_flag(req, SIP_PKT_IGNORE) && (p->invitestate != INV_CANCELLED)) sip_cancel_destroy(p); p->authtries = 0; if (find_sdp(req)) {