aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-29 17:20:28 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-29 17:20:28 +0000
commit6967e4a660fba930b5aa528f03f4dc229f928cf6 (patch)
tree096366b59c530698699cb50f1ba2063211e30408 /channels
parenta67266b31503b6894870069176e96a2e2d0513da (diff)
Fix issue where if both sides of the dialog cancelled the dialog at the same time chan_sip could kepe retransmitting a response for no reason.
(closes issue #9566) Reported by: atca_pres Patches: bug9566.patch uploaded by oej git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@87342 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b55e27886..070677769 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3511,6 +3511,7 @@ static int sip_hangup(struct ast_channel *ast)
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
@@ -3523,6 +3524,7 @@ static int sip_hangup(struct ast_channel *ast)
transmit_response_reliable(p, res, &p->initreq);
else
transmit_response_reliable(p, "603 Declined", &p->initreq);
+ p->invitestate = INV_TERMINATED;
}
} else { /* Call is in UP state, send BYE */
if (!p->pendinginvite) {
@@ -14361,7 +14363,16 @@ static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req)
check_via(p, req);
sip_alreadygone(p);
- p->invitestate = INV_CANCELLED;
+
+ /* At this point, we could have cancelled the invite at the same time
+ as the other side sends a CANCEL. Our final reply with error code
+ might not have been received by the other side before the CANCEL
+ was sent, so let's just give up retransmissions and waiting for
+ ACK on our error code. The call is hanging up any way. */
+ if (p->invitestate == INV_TERMINATED)
+ __sip_pretend_ack(p);
+ else
+ p->invitestate = INV_CANCELLED;
if (p->owner && p->owner->_state == AST_STATE_UP) {
/* This call is up, cancel is ignored, we need a bye */