]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Issue #6409 - Use "s" extension when there's no username in the URI
authorOlle Johansson <oej@edvina.net>
Mon, 27 Mar 2006 22:50:41 +0000 (22:50 +0000)
committerOlle Johansson <oej@edvina.net>
Mon, 27 Mar 2006 22:50:41 +0000 (22:50 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@15366 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 3bc66f8b7c8c88bad7a3c2ec13cd576bf3008b9c..2a62f6af2aaa2d22e5b162011d87a453c317be13 100644 (file)
@@ -6519,6 +6519,7 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
        char tmp[256] = "", *uri, *a;
        char tmpf[256], *from;
        struct sip_request *req;
+       char *colon;
        
        req = oreq;
        if (!req)
@@ -6550,20 +6551,24 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
                ast_uri_decode(from);
        }
 
+       /* Skip any options */
+       if ((a = strchr(uri, ';'))) {
+               *a = '\0';
+       }
+
        /* Get the target domain */
        if ((a = strchr(uri, '@'))) {
-               char *colon;
                *a = '\0';
                a++;
-               colon = strchr(a, ':'); /* Remove :port */
-               if (colon)
-                       *colon = '\0';
-               ast_copy_string(p->domain, a, sizeof(p->domain));
-       }
-       /* Skip any options */
-       if ((a = strchr(uri, ';'))) {
-               *a = '\0';
+       } else {        /* No username part */
+               a = uri;
+               uri = "s";      /* Set extension to "s" */
        }
+       colon = strchr(a, ':'); /* Remove :port */
+       if (colon)
+               *colon = '\0';
+
+       ast_copy_string(p->domain, a, sizeof(p->domain));
 
        if (!AST_LIST_EMPTY(&domain_list)) {
                char domain_context[AST_MAX_EXTENSION];