aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-21 22:23:43 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-21 22:23:43 +0000
commit52613ca8d44f6119622ace6f6fba347a6dfc218f (patch)
tree6901d5617331e52ae6002386405dd2796af44123 /channels
parent518cb785325fc308bf32aaaa0d6034823412960c (diff)
Merged revisions 213716 via svnmerge from
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: http://svn.digium.com/svn/asterisk/branches/1.6.2@213721 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index add6d6135..2ead3da7f 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10997,7 +10997,6 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char *
struct sip_peer *peer;
int res;
char *fromdomain;
- char *domainport = NULL;
/* exit if we are already in process with this registrar ?*/
if (r == NULL || ((auth == NULL) && (r->regstate == REG_STATE_REGSENT || r->regstate == REG_STATE_AUTHSENT))) {
@@ -11156,33 +11155,14 @@ 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)) {
- domainport = strrchr(p->fromdomain, ':');
- if (domainport) {
- *domainport++ = '\0'; /* trim off domainport from p->fromdomain */
- if (ast_strlen_zero(domainport))
- domainport = NULL;
- }
- if (domainport) {
- if (atoi(domainport) != STANDARD_SIP_PORT)
- snprintf(addr, sizeof(addr), "sip:%s:%s", p->fromdomain, domainport);
- 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", p->fromdomain, r->portno);
- else
- snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain);
- }
+
+ /* 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 {
- 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);
+ snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
}
+
ast_string_field_set(p, uri, addr);
p->branch ^= ast_random();