Register request line contains wrong address when user domain and register host differ
authorDavid Vossel <dvossel@digium.com>
Fri, 21 Aug 2009 22:22:11 +0000 (22:22 +0000)
committerDavid Vossel <dvossel@digium.com>
Fri, 21 Aug 2009 22:22:11 +0000 (22:22 +0000)
(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/trunk@213716 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 8a15339..d07da34 100644 (file)
@@ -11751,12 +11751,11 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char *
                snprintf(to, sizeof(to), "<sip:%s@%s>", r->username, r->regdomain);
        }
 
-       /* Domain is what we are registering to, regardless of actual
-          host name from SRV */
+       /* Host is what we are registered to, reguardless of domain in username field */
        if (ntohs(p->sa.sin_port) != STANDARD_SIP_PORT)
-               snprintf(addr, sizeof(addr), "sip:%s:%d", r->regdomain, ntohs(p->sa.sin_port));
+               snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, ntohs(p->sa.sin_port));
        else
-               snprintf(addr, sizeof(addr), "sip:%s", r->regdomain);
+               snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
 
        ast_string_field_set(p, uri, addr);