add from-user param to gateways

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6293 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-11-15 22:45:15 +00:00
parent 565ab1d66d
commit 39cebb4fc9
3 changed files with 13 additions and 2 deletions

View File

@ -18,6 +18,8 @@
<!--<param name="username" value="cluecon"/>-->
<!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>-->
<!--/// username to use in from: *optional* same as username, if blank ///-->
<!--<param name="from-user" value="cluecon"/>-->
<!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--<param name="from-domain" value="asterlink.com"/>-->
<!--/// account password *required* ///-->

View File

@ -10,6 +10,8 @@
<!--<param name="username" value="cluecon"/>-->
<!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>-->
<!--/// username to use in from: *optional* same as username, if blank ///-->
<!--<param name="from-user" value="cluecon"/>-->
<!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--<param name="from-domain" value="asterlink.com"/>-->
<!--/// account password *required* ///-->

View File

@ -561,6 +561,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
*context = "default",
*expire_seconds = "3600",
*retry_seconds = "30",
*from_user = "",
*from_domain = "",
*register_proxy = NULL,
*contact_params = NULL,
@ -599,6 +600,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
expire_seconds = val;
} else if (!strcmp(var, "retry-seconds")) {
retry_seconds = val;
} else if (!strcmp(var, "from-user")) {
from_user = val;
} else if (!strcmp(var, "from-domain")) {
from_domain = val;
} else if (!strcmp(var, "register-proxy")) {
@ -629,6 +632,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
goto skip;
}
if (switch_strlen_zero(from_user)) {
from_user = username;
}
if (switch_strlen_zero(extension)) {
extension = username;
}
@ -672,9 +679,9 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
params = switch_core_sprintf(gateway->pool, ";transport=%s", register_transport);
}
gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", register_proxy,register_transport);
gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", username, from_domain, register_transport);
gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", from_user, from_domain, register_transport);
gateway->register_contact = switch_core_sprintf(gateway->pool, "<sip:%s@%s:%d%s>", extension,
profile->extsipip ? profile->extsipip : profile->sipip, profile->sip_port, params);