summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-05-14 19:27:58 +0000
committerMark Michelson <mmichelson@digium.com>2012-05-14 19:27:58 +0000
commitfef9a32fb410b47da4cb195f0af2f63f8cac0f03 (patch)
tree18b8f7d0fe242909d12e58c58acc862820d45a99
parentc79bafa9e0922f8b56f2d3626a3b5e27b8781b33 (diff)
Fix broken reinvite glare scenario.
To make a long story short, reinvite glares were broken because Asterisk would invert the To and From headers when ACKing a 491 response. The reason was because the initreq of the dialog was being changed to the incoming glared reinvite instead of being set to the outgoing glared reinvite. This change has three parts * In handle_incoming, we never will reject an ACK because it has a to-tag present, even if we think the request may be out of dialog. * In handle_request_invite, we do not change the initreq when receiving a reinvite to which we will respond with a 491. * In handle_request_invite, several superflous settings up pendinginvite have been removed since this is dones automatically by transmit_response_reliable Review: https://reviewboard.asterisk.org/r/1911 ........ Merged revisions 366389 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 366390 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 29b92a51c..f6fb2af7c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -23208,9 +23208,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
}
}
transmit_response_reliable(p, "491 Request Pending", req);
- p->pendinginvite = seqno;
check_via(p, req);
- copy_request(&p->initreq, req);
ast_debug(1, "Got INVITE on call where we already have pending INVITE, deferring that - %s\n", p->callid);
/* Don't destroy dialog here */
res = INV_REQ_FAILED;
@@ -23230,7 +23228,6 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
if (p->owner) {
ast_debug(3, "INVITE w Replaces on existing call? Refusing action. [%s]\n", p->callid);
transmit_response_reliable(p, "400 Bad request", req); /* The best way to not not accept the transfer */
- p->pendinginvite = seqno;
check_via(p, req);
copy_request(&p->initreq, req);
/* Do not destroy existing call */
@@ -23250,7 +23247,6 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
p->invitestate = INV_COMPLETED;
res = INV_REQ_ERROR;
- p->pendinginvite = seqno;
check_via(p, req);
copy_request(&p->initreq, req);
goto request_invite_cleanup;
@@ -23355,7 +23351,6 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
refer_locked = 0;
p->invitestate = INV_COMPLETED;
res = INV_REQ_ERROR;
- p->pendinginvite = seqno;
check_via(p, req);
copy_request(&p->initreq, req);
goto request_invite_cleanup;
@@ -26208,13 +26203,13 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct as
if (!req->ignore && req->method == SIP_INVITE) {
transmit_response_reliable(p, "481 Call/Transaction Does Not Exist", req);
/* Will cease to exist after ACK */
+ return res;
} else if (req->method != SIP_ACK) {
transmit_response(p, "481 Call/Transaction Does Not Exist", req);
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
- } else {
- ast_debug(1, "Got ACK for unknown dialog... strange.\n");
+ return res;
}
- return res;
+ /* Otherwise, this is an ACK. It will always have a to-tag */
}
}