summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2003-08-20 14:28:51 +0000
committerMark Spencer <markster@digium.com>2003-08-20 14:28:51 +0000
commitb938de4ea733e33cfb2ce0740fc6df8c1b071cba (patch)
tree2839284932897fe39166e2e9c794bab86142dae7
parent312760c3818da615e884c1791d737c2054f0f0aa (diff)
Check for 407 on both outbound and non-outbound calls
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1383 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rwxr-xr-xchannels/chan_sip.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a7dc36b0c..d61ebbe3a 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4225,6 +4225,17 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
owner = p->owner;
/* Acknowledge whatever it is destined for */
__sip_ack(p, seqno, 0);
+ /* Get their tag if we haven't already */
+ to = get_header(req, "To");
+ to = strstr(to, "tag=");
+ if (to) {
+ to += 4;
+ strncpy(p->theirtag, to, sizeof(p->theirtag) - 1);
+ to = strchr(p->theirtag, ';');
+ 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
@@ -4273,17 +4284,6 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
ast_sched_del(sched, p->initid);
p->initid = -1;
}
- /* Get their tag if we haven't already */
- to = get_header(req, "To");
- to = strstr(to, "tag=");
- if (to) {
- to += 4;
- strncpy(p->theirtag, to, sizeof(p->theirtag) - 1);
- to = strchr(p->theirtag, ';');
- if (to)
- *to = '\0';
- }
-
switch(resp) {
case 100:
break;
@@ -4448,6 +4448,14 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
if (!strcasecmp(msg, "INVITE") || !strcasecmp(msg, "REGISTER") )
transmit_request(p, "ACK", seqno, 0);
break;
+ case 407:
+ if (!strcasecmp(msg, "BYE")) {
+ if ((p->authtries > 1) || do_proxy_auth(p, req, "BYE")) {
+ ast_log(LOG_NOTICE, "Failed to authenticate on BYE to '%s'\n", get_header(&p->initreq, "From"));
+ p->needdestroy = 1;
+ }
+ }
+ break;
}
}
}