]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 213716 via svnmerge from
authorDavid Vossel <dvossel@digium.com>
Fri, 21 Aug 2009 22:24:48 +0000 (22:24 +0000)
committerDavid Vossel <dvossel@digium.com>
Fri, 21 Aug 2009 22:24:48 +0000 (22:24 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
  r213716 | dvossel | 2009-08-21 17:22:11 -0500 (Fri, 21 Aug 2009) | 10 lines

  Register request line contains wrong address when user domain and register host differ

  (closes issue #15539)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-registraraddr.patch uploaded by Nick (license 657)
        register_domain_fix_1.6.2 uploaded by dvossel (license 671)
  Tested by: Nick_Lewis, dvossel
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@213724 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 847ccde7f81e5ab1929c7c8b4318d9ec9bdd83ec..1b7fd02cbfea48d746678d779168925862ce08d7 100644 (file)
@@ -10378,20 +10378,13 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char *
                else
                        snprintf(to, sizeof(to), "<sip:%s@%s>", r->username, p->tohost);
        }
-       
-       /* Fromdomain is what we are registering to, regardless of actual
-          host name from SRV */
-       if (!ast_strlen_zero(p->fromdomain)) {
-               if (r->portno && r->portno != STANDARD_SIP_PORT)
-                       snprintf(addr, sizeof(addr), "sip:%s:%d", p->fromdomain, r->portno);
-               else
-                       snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain);
-       } else {
-               if (r->portno && r->portno != STANDARD_SIP_PORT)
-                       snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, r->portno);
-               else
-                       snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
-       }
+
+       /* Host is what we are registered to, regardless if a domain exists in the username */
+       if (r->portno && r->portno != STANDARD_SIP_PORT)
+               snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, r->portno);
+       else
+               snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
+
        ast_string_field_set(p, uri, addr);
 
        p->branch ^= ast_random();