diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-20 23:03:44 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-20 23:03:44 +0000 |
commit | 0d76f2c124e54cafbf01d5d40d77a9359cd8867c (patch) | |
tree | 8a719fba55399576d0e4c097caf01aa5a5642bf3 | |
parent | 1ff3a9b966fedf3089296cb969d1a7ebd4a74baf (diff) |
Only half-ack provisional responses
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1386 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | channels/chan_sip.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d61ebbe3a..9ca2cf35b 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -534,6 +534,27 @@ static int __sip_ack(struct sip_pvt *p, int seqno, int resp) return res; } +static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp) +{ + struct sip_pkt *cur, *prev = NULL; + int res = -1; + cur = p->packets; + while(cur) { + if ((cur->seqno == seqno) && (cur->resp == resp)) { + /* this is our baby */ + if (cur->retransid > -1) + ast_sched_del(sched, cur->retransid); + cur->retransid = -1; + res = 0; + break; + } + prev = cur; + cur = cur->next; + } + ast_log(LOG_DEBUG, "Stopping retransmission (but retaining packet) on provisional '%s' of %s %d: %s\n", p->callid, resp ? "Response" : "Request", seqno, res ? "Not Found" : "Found"); + return res; +} + static int send_response(struct sip_pvt *p, struct sip_request *req, int reliable, int seqno) { int res; @@ -4224,7 +4245,10 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ if (!msg) msg = ""; else msg++; owner = p->owner; /* Acknowledge whatever it is destined for */ - __sip_ack(p, seqno, 0); + if ((resp >= 100) && (resp <= 199)) + __sip_semi_ack(p, seqno, 0); + else + __sip_ack(p, seqno, 0); /* Get their tag if we haven't already */ to = get_header(req, "To"); to = strstr(to, "tag="); @@ -4235,7 +4259,6 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ if (to) *to = '\0'; } - if (p->peerpoke) { /* We don't really care what the response is, just that it replied back. Well, as long as it's not a 100 response... since we might @@ -4329,7 +4352,7 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ transmit_request(p, "ACK", seqno, 0); /* Go ahead and send bye at this point */ if (p->pendingbye) { - transmit_request(p, "BYE", 0, 1); + transmit_request_with_auth(p, "BYE", 0, 1); p->needdestroy = 1; } } else if (!strcasecmp(msg, "REGISTER")) { |