summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-05-16 16:01:09 +0000
committerMark Spencer <markster@digium.com>2004-05-16 16:01:09 +0000
commit1081dc05c2abb68345183656f57863a3206b5e00 (patch)
tree07d035670ccbd90ac2d19788326f174cc6f97850
parent72ca19339d6b6b7e47ab0978d03cc99dade2b866 (diff)
Improve handling of multiple CANCEL requests
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rwxr-xr-xchannels/chan_sip.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 95161de17..622711679 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -6327,10 +6327,16 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
if (gotdest) {
if (gotdest < 0) {
- transmit_response(p, "404 Not Found", req);
+ if (ignore)
+ transmit_response(p, "404 Not Found", req);
+ else
+ transmit_response_reliable(p, "404 Not Found", req, 1);
update_user_counter(p,DEC_IN_USE);
} else {
- transmit_response(p, "484 Address Incomplete", req);
+ if (ignore)
+ transmit_response(p, "484 Address Incomplete", req);
+ else
+ transmit_response_reliable(p, "484 Address Incomplete", req, 1);
update_user_counter(p,DEC_IN_USE);
}
p->needdestroy = 1;
@@ -6368,14 +6374,20 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
ast_mutex_unlock(&p->lock);
ast_hangup(c);
ast_mutex_lock(&p->lock);
- transmit_response_reliable(p, "503 Unavailable", req, 1);
+ if (ignore)
+ transmit_response(p, "503 Unavailable", req);
+ else
+ transmit_response_reliable(p, "503 Unavailable", req, 1);
c = NULL;
}
} else {
ast_mutex_unlock(&c->lock);
if (ast_pickup_call(c)) {
ast_log(LOG_NOTICE, "Nothing to pick up\n");
- transmit_response_reliable(p, "503 Unavailable", req, 1);
+ if (ignore)
+ transmit_response(p, "503 Unavailable", req);
+ else
+ transmit_response_reliable(p, "503 Unavailable", req, 1);
p->alreadygone = 1;
/* Unlock locks so ast_hangup can do its magic */
ast_mutex_unlock(&p->lock);
@@ -6407,7 +6419,10 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
} else {
if (p && !p->needdestroy) {
ast_log(LOG_NOTICE, "Unable to create/find channel\n");
- transmit_response_reliable(p, "503 Unavailable", req, 1);
+ if (ignore)
+ transmit_response(p, "503 Unavailable", req);
+ else
+ transmit_response_reliable(p, "503 Unavailable", req, 1);
p->needdestroy = 1;
}
}
@@ -6464,10 +6479,11 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
else
p->needdestroy = 1;
if (p->initreq.len > 0) {
- transmit_response_reliable(p, "487 Request Terminated", &p->initreq, 1);
+ if (!ignore)
+ transmit_response_reliable(p, "487 Request Terminated", &p->initreq, 1);
transmit_response(p, "200 OK", req);
} else {
- transmit_response_reliable(p, "481 Call Leg Does Not Exist", req, 1);
+ transmit_response(p, "481 Call Leg Does Not Exist", req);
}
} else if (!strcasecmp(cmd, "BYE")) {
copy_request(&p->initreq, req);