merge patch from MODENDP-24, add to-domain param to gateway that overrides the proxy domain for the to header

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5712 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-09-19 15:05:55 +00:00
parent 31c7176755
commit 40c29a107c
1 changed files with 11 additions and 4 deletions

View File

@ -500,7 +500,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
*context = "default", *context = "default",
*expire_seconds = "3600", *expire_seconds = "3600",
*retry_seconds = "30", *retry_seconds = "30",
*from_domain = ""; *from_domain = "",
*to_domain = "";
gateway->pool = profile->pool; gateway->pool = profile->pool;
gateway->profile = profile; gateway->profile = profile;
@ -536,9 +537,15 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
retry_seconds = val; retry_seconds = val;
} else if (!strcmp(var, "from-domain")) { } else if (!strcmp(var, "from-domain")) {
from_domain = val; from_domain = val;
} else if (!strcmp(var, "to-domain")) {
to_domain = val;
} }
} }
if (switch_strlen_zero(to_domain)) {
to_domain = proxy;
}
if (switch_strlen_zero(realm)) { if (switch_strlen_zero(realm)) {
realm = name; realm = name;
} }
@ -586,12 +593,12 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension,
profile->extsipip ? profile->extsipip : profile->sipip, profile->sip_port); profile->extsipip ? profile->extsipip : profile->sipip, profile->sip_port);
if (!strncasecmp(proxy, "sip:", 4)) { if (!strncasecmp(to_domain, "sip:", 4)) {
gateway->register_proxy = switch_core_strdup(gateway->pool, proxy); gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4); gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, to_domain + 4);
} else { } else {
gateway->register_proxy = switch_core_sprintf(gateway->pool, "sip:%s", proxy); gateway->register_proxy = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy); gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, to_domain);
} }
gateway->expires_str = switch_core_strdup(gateway->pool, expire_seconds); gateway->expires_str = switch_core_strdup(gateway->pool, expire_seconds);