aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-22 16:58:19 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-22 16:58:19 +0000
commit8c26e2897d8dacf05598f2fbd68ffd278535c65e (patch)
treee034c300f4ef40500eecb2e422f3bb5fbbe8a564
parentd2e1bfe91e00c4e57e3b9374d2516cf3c461dfc4 (diff)
fixes issue with p->method incorrectly set to ACK
It is possible for a second ACK to come in for a retransmitted message. If an ack does not match an unacked message in our queue, restore the previous p->method as this ACK is completely ignored. (closes issue #16295) Reported by: omolenkamp Patches: issue16295_v2.diff uploaded by dvossel (license 671) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@236062 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 4f2dd6150..cb15b8cb9 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -16387,6 +16387,8 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
int debug = sip_debug_test_pvt(p);
char *e;
int error = 0;
+ int oldmethod = p->method;
+ int acked = 0;
/* Get Method and Cseq */
cseq = get_header(req, "Cseq");
@@ -16563,7 +16565,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
if (seqno == p->pendinginvite) {
p->invitestate = INV_TERMINATED;
p->pendinginvite = 0;
- __sip_ack(p, seqno, FLAG_RESPONSE, 0);
+ acked = __sip_ack(p, seqno, FLAG_RESPONSE, 0);
if (find_sdp(req)) {
if (process_sdp(p, req))
return -1;
@@ -16572,7 +16574,12 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
} else if (p->glareinvite == seqno) {
/* handle ack for the 491 pending send for glareinvite */
p->glareinvite = 0;
- __sip_ack(p, seqno, 1, 0);
+ acked = __sip_ack(p, seqno, 1, 0);
+ }
+ if (!acked) {
+ /* Got an ACK that did not match anything. Ignore
+ * silently and restore previous method */
+ p->method = oldmethod;
}
/* Got an ACK that we did not match. Ignore silently */
if (!p->lastinvite && ast_strlen_zero(p->randdata))