Properly build Contact on INVITE when asking for authentication
authorMark Spencer <markster@digium.com>
Fri, 28 Nov 2003 04:01:25 +0000 (04:01 +0000)
committerMark Spencer <markster@digium.com>
Fri, 28 Nov 2003 04:01:25 +0000 (04:01 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1803 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index d9a37dc..cefe7ab 100755 (executable)
@@ -3979,6 +3979,17 @@ static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, cha
        memset(calleridname,0,sizeof(calleridname));
        get_calleridname(from,calleridname);
        of = ditch_braces(from);
+       if (!strlen(p->exten)) {
+               t = uri;
+               if (!strncmp(t, "sip:", 4))
+                       t+= 4;
+               strncpy(p->exten, t, sizeof(p->exten) - 1);
+               t = strchr(p->exten, '@');
+               if (t)
+                       *t = '\0';
+               if (!strlen(p->our_contact))
+                       build_contact(p);
+       }
        if (strncmp(of, "sip:", 4)) {
                ast_log(LOG_NOTICE, "From address missing 'sip:', using it anyway\n");
        } else