提交 01f9b3f1 authored 作者: Anthony Minessale's avatar Anthony Minessale

more changes to sofia to make better use of the directories

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5043 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 d038cdbf
......@@ -2,61 +2,35 @@
<domain name="$${domain}">
<!--the user id (the left hand side of the @ in the addr-->
<user id="stpeter">
<!-- Outbound Registrations Related to this user -->
<gateways>
<!--<gateway name="asterlink.com">-->
<!--/// account username *required* ///-->
<!--<param name="username" value="cluecon"/>-->
<!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>-->
<!--/// account password *required* ///-->
<!--<param name="password" value="2007"/>-->
<!--/// replace the INVITE from user with the channel's caller-id ///-->
<!--<param name="caller-id-in-from" value="false"/>-->
<!--/// extension for inbound calls: *optional* same as username, if blank ///-->
<!--<param name="extension" value="cluecon"/>-->
<!--/// proxy host: *optional* same as realm, if blank ///-->
<!--<param name="proxy" value="asterlink.com"/>-->
<!--/// expire in seconds: *optional* 3600, if blank ///-->
<!--<param name="expire-seconds" value="60"/>-->
<!--/// do not register ///-->
<!--<param name="register" value="false"/>-->
<!--</gateway>-->
</gateways>
<params>
<!-- omit password for authless registration -->
<param name="password" value="mypass"/>
<!-- optionally use this instead if you want to store the hash of user:domain:pass-->
<!--<param name="a1-hash" value="c6440e5de50b403206989679159de89a"/>-->
</params>
<!-- This is only for mod_dingaling so it can deliver vcards in component mode-->
<vcard xmlns='vcard-temp'>
<FN>Peter Saint-Andre</FN>
<N>
<FAMILY>Saint-Andre</FAMILY>
<GIVEN>Peter</GIVEN>
<MIDDLE/>
</N>
<NICKNAME>stpeter</NICKNAME>
<URL>http://www.jabber.org/people/stpeter.php</URL>
<BDAY>1966-08-06</BDAY>
<ORG>
<ORGNAME>Jabber Software Foundation</ORGNAME>
<ORGUNIT>Jabber Software Foundation</ORGUNIT>
</ORG>
<TITLE>Executive Director</TITLE>
<ROLE>Patron Saint</ROLE>
<TEL><WORK/><VOICE/><NUMBER>303-308-3282</NUMBER></TEL>
<TEL><WORK/><FAX/><NUMBER/></TEL>
<TEL><WORK/><MSG/><NUMBER/></TEL>
<ADR>
<WORK/>
<EXTADD>Suite 600</EXTADD>
<STREET>1899 Wynkoop Street</STREET>
<LOCALITY>Denver</LOCALITY>
<REGION>CO</REGION>
<PCODE>80202</PCODE>
<CTRY>USA</CTRY>
</ADR>
<TEL><HOME/><VOICE/><NUMBER>303-555-1212</NUMBER></TEL>
<TEL><HOME/><FAX/><NUMBER/></TEL>
<TEL><HOME/><MSG/><NUMBER/></TEL>
<ADR>
<HOME/>
<EXTADD/>
<STREET/>
<LOCALITY>Denver</LOCALITY>
<REGION>CO</REGION>
<PCODE>80209</PCODE>
<CTRY>USA</CTRY>
</ADR>
<EMAIL><INTERNET/><PREF/><USERID>stpeter@jabber.org</USERID></EMAIL>
<JABBERID>stpeter@jabber.org</JABBERID>
<DESC>
More information about me is located on my
personal website: http://www.saint-andre.com/
</DESC>
<vcard>
<!-- insert optional compliant vcard xml here-->
</vcard>
</user>
</domain>
<configuration name="sofia.conf" description="sofia Endpoint">
<profiles>
<profile name="$${sip_profile}">
<!--aliases are other names that will work as a valid profile name for this profile-->
<aliases>
<alias name="default"/>
</aliases>
<!-- Outbound Registrations -->
<gateways>
<!--<gateway name="asterlink.com">-->
......@@ -22,6 +26,12 @@
<!--<param name="register" value="false"/>-->
<!--</gateway>-->
</gateways>
<domains>
<!-- indicator to parse the directory for domains with parse="true" to get gateways-->
<!--<domain name="$${domain}" parse="true"/>-->
</domains>
<settings>
<param name="debug" value="1"/>
<param name="rfc2833-pt" value="101"/>
......
......@@ -893,19 +893,35 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
sofia_profile_t *profile = NULL;
switch_hash_index_t *hi;
void *val;
const void *vvar;
int c = 0;
int ac = 0;
const char *line = "================================================================================";
stream->write_function(stream, "%25s\t%s\t %32s\n", "Name", " Type", "Data");
stream->write_function(stream, "%s\n", line);
switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
switch_hash_this(hi, &vvar, NULL, &val);
profile = (sofia_profile_t *) val;
if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
stream->write_function(stream, "Profile %s\n", profile->name);
c++;
if (strcmp(vvar, profile->name)) {
ac++;
stream->write_function(stream, "%25s\t%s\t %32s\n", vvar, " alias", profile->name);
} else {
stream->write_function(stream, "%25s\t%s\t %32s\n", profile->name, "profile", profile->url);
c++;
}
}
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
stream->write_function(stream, "%d profiles\n", c);
stream->write_function(stream, "%s\n", line);
stream->write_function(stream, "%d profiles %d aliases\n", c, ac);
return SWITCH_STATUS_SUCCESS;
}
......
......@@ -437,14 +437,14 @@ void sofia_presence_handle_sip_i_subscribe(int status,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
sofia_profile_t *sofia_glue_find_profile(char *key);
void sofia_glue_add_profile(char *key, sofia_profile_t *profile);
switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile);
void sofia_glue_execute_sql(sofia_profile_t *profile, switch_bool_t master, char *sql, switch_mutex_t *mutex);
void sofia_reg_check_expire(sofia_profile_t *profile, time_t now);
void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
void sofia_reg_unregister(sofia_profile_t *profile);
switch_status_t sofia_glue_ext_address_lookup(char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool);
sofia_gateway_t *sofia_reg_find_gateway(char *key);
void sofia_reg_add_gateway(char *key, sofia_gateway_t *gateway);
switch_status_t sofia_reg_add_gateway(char *key, sofia_gateway_t *gateway);
void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp);
int sofia_glue_get_user_host(char *in, char **user, char **host);
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status);
......@@ -467,3 +467,4 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len);
void sofia_glue_check_video_codecs(private_object_t *tech_pvt);
void sofia_reg_release_gateway(sofia_gateway_t *gateway);
void sofia_glue_del_profile(sofia_profile_t *profile);
......@@ -1437,11 +1437,48 @@ sofia_profile_t *sofia_glue_find_profile(char *key)
return profile;
}
void sofia_glue_add_profile(char *key, sofia_profile_t *profile)
switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_mutex_lock(mod_sofia_globals.hash_mutex);
switch_core_hash_insert(mod_sofia_globals.profile_hash, key, profile);
if (!switch_core_hash_find(mod_sofia_globals.profile_hash, key)) {
status = switch_core_hash_insert(mod_sofia_globals.profile_hash, key, profile);
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
return status;
}
void sofia_glue_del_profile(sofia_profile_t *profile)
{
switch_hash_index_t *hi;
void *vval;
const void *vvar;
sofia_profile_t *this_profile;
sofia_gateway_t *gp, *this_gateway;
switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
this_profile = (sofia_profile_t *) vval;
if (this_profile == profile) {
switch_core_hash_delete(mod_sofia_globals.profile_hash, vvar);
}
}
for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.gateway_hash), mod_sofia_globals.gateway_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
this_gateway = (sofia_gateway_t *) vval;
for (gp = profile->gateways; gp; gp = gp->next) {
if (gp == this_gateway) {
switch_core_hash_delete(mod_sofia_globals.gateway_hash, vvar);
}
}
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
int sofia_glue_init_sql(sofia_profile_t *profile)
......
......@@ -838,13 +838,18 @@ void sofia_reg_release_gateway(sofia_gateway_t *gateway)
switch_thread_rwlock_unlock(gateway->profile->rwlock);
}
void sofia_reg_add_gateway(char *key, sofia_gateway_t * gateway)
switch_status_t sofia_reg_add_gateway(char *key, sofia_gateway_t *gateway)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_mutex_lock(mod_sofia_globals.hash_mutex);
switch_core_hash_insert(mod_sofia_globals.gateway_hash, key, gateway);
if (!switch_core_hash_find(mod_sofia_globals.gateway_hash, key)) {
status = switch_core_hash_insert(mod_sofia_globals.gateway_hash, key, gateway);
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
return status;
}
......@@ -1176,6 +1176,13 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section,
SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(char *domain_name, char *params, switch_xml_t *root, switch_xml_t *domain)
{
*domain = NULL;
char my_params[512];
if (!params) {
snprintf(my_params, sizeof(my_params), "domain=%s", domain_name);
params = my_params;
}
return switch_xml_locate("directory", "domain", "name", domain_name, root, domain, params);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论