diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-03-13 11:45:52 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-03-13 11:45:52 +0000 |
commit | 4feece2ecc77beceaa5b6e48cee7d20814a7be2c (patch) | |
tree | e5b05888c896ec38585899508850e0882352c7b9 | |
parent | afb6bf76636a5911aa25e572c78c33f6eca0cb60 (diff) |
Issue #9229 - No port in request URI on register to non default SIP ports (neelakantan)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@58847 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_sip.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d2ae10472..8946bab58 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -5643,10 +5643,17 @@ static int transmit_register(struct sip_registry *r, int sipmethod, char *auth, /* Fromdomain is what we are registering to, regardless of actual host name from SRV */ - if (!ast_strlen_zero(p->fromdomain)) - snprintf(addr, sizeof(addr), "sip:%s", p->fromdomain); - else - snprintf(addr, sizeof(addr), "sip:%s", r->hostname); + if (!ast_strlen_zero(p->fromdomain)) { + if (r->portno && r->portno != DEFAULT_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 != DEFAULT_SIP_PORT) + snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, r->portno); + else + snprintf(addr, sizeof(addr), "sip:%s", r->hostname); + } ast_copy_string(p->uri, addr, sizeof(p->uri)); p->branch ^= thread_safe_rand(); |