diff options
author | Mark Spencer <markster@digium.com> | 2003-04-09 04:19:59 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2003-04-09 04:19:59 +0000 |
commit | 863104131dc85a5be954a537d8d98f725356d7f1 (patch) | |
tree | 631179b708cb160195881d2d416c822e6f1cfce2 /channels | |
parent | 43604eb770c63bee9f3de9687cbe4dbca7db4671 (diff) |
Check authentication before destination
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_sip.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index dbcb41128..a1bd9d7ab 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3745,16 +3745,14 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ p->initid = -1; } /* Get their tag if we haven't already */ - if (!strlen(p->theirtag)) { - 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'; - } + 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) { @@ -4112,9 +4110,6 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc } else if (sipdebug) ast_verbose("Ignoring this request\n"); if (!p->lastinvite) { - /* Get destination right away */ - gotdest = get_destination(p, NULL); - build_contact(p); /* Handle authentication if this is our first invite */ res = check_user(p, req, cmd, e, 1); if (res) { @@ -4127,6 +4122,10 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc /* Initialize the context if it hasn't been already */ if (!strlen(p->context)) strncpy(p->context, context, sizeof(p->context) - 1); + /* Get destination right away */ + gotdest = get_destination(p, NULL); + build_contact(p); + if (gotdest) { if (gotdest < 0) transmit_response(p, "404 Not Found", req); @@ -4263,9 +4262,6 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc ast_verbose("Ignoring this request\n"); if (!p->lastinvite) { - /* Get destination right away */ - gotdest = get_destination(p, NULL); - build_contact(p); /* Handle authentication if this is our first subscribe */ res = check_user(p, req, cmd, e, 0); if (res) { @@ -4278,6 +4274,9 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc /* Initialize the context if it hasn't been already */ if (!strlen(p->context)) strncpy(p->context, context, sizeof(p->context) - 1); + /* Get destination right away */ + gotdest = get_destination(p, NULL); + build_contact(p); if (gotdest) { if (gotdest < 0) transmit_response(p, "404 Not Found", req); |