From: David Vossel Date: Tue, 15 Dec 2009 18:49:52 +0000 (+0000) Subject: reverses minor sip registration regression X-Git-Tag: 1.6.1.13-rc1~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a39e698157eb6be210e9d9b8be2318d161d2b2b;p=thirdparty%2Fasterisk.git reverses minor sip registration regression reverses the changes caused by issue #15539. The issue reported was expected behavior. (issue #15539) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@235135 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 06417a83ee..fce524ec15 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10906,13 +10906,20 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char * else snprintf(to, sizeof(to), "", r->username, p->tohost); } - - /* 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); - + + /* 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); + } ast_string_field_set(p, uri, addr); p->branch ^= ast_random();