mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-07 10:28:32 +00:00
Only half-ack provisional responses
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -534,6 +534,27 @@ static int __sip_ack(struct sip_pvt *p, int seqno, int resp)
|
|||||||
return res;
|
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)
|
static int send_response(struct sip_pvt *p, struct sip_request *req, int reliable, int seqno)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
@@ -4224,6 +4245,9 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
|
|||||||
if (!msg) msg = ""; else msg++;
|
if (!msg) msg = ""; else msg++;
|
||||||
owner = p->owner;
|
owner = p->owner;
|
||||||
/* Acknowledge whatever it is destined for */
|
/* Acknowledge whatever it is destined for */
|
||||||
|
if ((resp >= 100) && (resp <= 199))
|
||||||
|
__sip_semi_ack(p, seqno, 0);
|
||||||
|
else
|
||||||
__sip_ack(p, seqno, 0);
|
__sip_ack(p, seqno, 0);
|
||||||
/* Get their tag if we haven't already */
|
/* Get their tag if we haven't already */
|
||||||
to = get_header(req, "To");
|
to = get_header(req, "To");
|
||||||
@@ -4235,7 +4259,6 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
|
|||||||
if (to)
|
if (to)
|
||||||
*to = '\0';
|
*to = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->peerpoke) {
|
if (p->peerpoke) {
|
||||||
/* We don't really care what the response is, just that it replied back.
|
/* 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
|
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);
|
transmit_request(p, "ACK", seqno, 0);
|
||||||
/* Go ahead and send bye at this point */
|
/* Go ahead and send bye at this point */
|
||||||
if (p->pendingbye) {
|
if (p->pendingbye) {
|
||||||
transmit_request(p, "BYE", 0, 1);
|
transmit_request_with_auth(p, "BYE", 0, 1);
|
||||||
p->needdestroy = 1;
|
p->needdestroy = 1;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(msg, "REGISTER")) {
|
} else if (!strcasecmp(msg, "REGISTER")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user