add from-domain param to sofia.conf for mmurdock

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5166 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-05-12 17:57:30 +00:00
parent a4ff7e88da
commit 493fdf5ba8
3 changed files with 17 additions and 2 deletions

View File

@ -9,6 +9,8 @@
<!--<param name="username" value="cluecon"/>--> <!--<param name="username" value="cluecon"/>-->
<!--/// auth realm: *optional* same as gateway name, if blank ///--> <!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>--> <!--<param name="realm" value="asterlink.com"/>-->
<!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--<param name="from-domain" value="asterlink.com"/>-->
<!--/// account password *required* ///--> <!--/// account password *required* ///-->
<!--<param name="password" value="2007"/>--> <!--<param name="password" value="2007"/>-->
<!--/// replace the INVITE from user with the channel's caller-id ///--> <!--/// replace the INVITE from user with the channel's caller-id ///-->
@ -21,6 +23,10 @@
<!--<param name="expire-seconds" value="60"/>--> <!--<param name="expire-seconds" value="60"/>-->
<!--/// do not register ///--> <!--/// do not register ///-->
<!--<param name="register" value="false"/>--> <!--<param name="register" value="false"/>-->
<!--How many seconds before a retry when a failure or timeout occurs -->
<!--<param name="retry_seconds" value="30"/>-->
<!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--</gateway>--> <!--</gateway>-->
</gateways> </gateways>
<params> <params>

View File

@ -12,6 +12,8 @@
<!--<param name="username" value="cluecon"/>--> <!--<param name="username" value="cluecon"/>-->
<!--/// auth realm: *optional* same as gateway name, if blank ///--> <!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>--> <!--<param name="realm" value="asterlink.com"/>-->
<!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--<param name="from-domain" value="asterlink.com"/>-->
<!--/// account password *required* ///--> <!--/// account password *required* ///-->
<!--<param name="password" value="2007"/>--> <!--<param name="password" value="2007"/>-->
<!--/// replace the INVITE from user with the channel's caller-id ///--> <!--/// replace the INVITE from user with the channel's caller-id ///-->

View File

@ -476,7 +476,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
*proxy = NULL, *proxy = NULL,
*context = "default", *context = "default",
*expire_seconds = "3600", *expire_seconds = "3600",
*retry_seconds = "30"; *retry_seconds = "30",
*from_domain = "";
gateway->pool = profile->pool; gateway->pool = profile->pool;
gateway->profile = profile; gateway->profile = profile;
@ -510,6 +511,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
expire_seconds = val; expire_seconds = val;
} else if (!strcmp(var, "retry-seconds")) { } else if (!strcmp(var, "retry-seconds")) {
retry_seconds = val; retry_seconds = val;
} else if (!strcmp(var, "from-domain")) {
from_domain = val;
} }
} }
@ -539,6 +542,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->state = REG_STATE_NOREG; gateway->state = REG_STATE_NOREG;
} }
if (switch_strlen_zero(from_domain)) {
from_domain = realm;
}
gateway->retry_seconds = atoi(retry_seconds); gateway->retry_seconds = atoi(retry_seconds);
if (gateway->retry_seconds < 10) { if (gateway->retry_seconds < 10) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "INVALID: retry_seconds correcting the value to 30\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "INVALID: retry_seconds correcting the value to 30\n");
@ -552,7 +559,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
if (switch_true(caller_id_in_from)) { if (switch_true(caller_id_in_from)) {
switch_set_flag(gateway, REG_FLAG_CALLERID); switch_set_flag(gateway, REG_FLAG_CALLERID);
} }
gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, realm); gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, from_domain);
gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, profile->sipip, profile->sip_port); gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, profile->sipip, profile->sip_port);
if (!strncasecmp(proxy, "sip:", 4)) { if (!strncasecmp(proxy, "sip:", 4)) {