From 40c29a107c9dab1a1e51ac3be37b230350662ccd Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 19 Sep 2007 15:05:55 +0000 Subject: [PATCH] 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 --- src/mod/endpoints/mod_sofia/sofia.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 325b813c14..dd7f158167 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -500,7 +500,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) *context = "default", *expire_seconds = "3600", *retry_seconds = "30", - *from_domain = ""; + *from_domain = "", + *to_domain = ""; gateway->pool = profile->pool; gateway->profile = profile; @@ -536,9 +537,15 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) retry_seconds = val; } else if (!strcmp(var, "from-domain")) { 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)) { 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, 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_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 { 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);