deal with MODENDP-138

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9667 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-09-26 19:17:03 +00:00
parent dd2074dcc3
commit 2e756baf78

View File

@ -1279,8 +1279,10 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
} }
} else if (!strcasecmp(argv[0], "profile")) { } else if (!strcasecmp(argv[0], "profile")) {
struct cb_helper cb; struct cb_helper cb;
char *sql = NULL;
if ((argv[1]) && (profile = sofia_glue_find_profile(argv[1]))) { if ((argv[1]) && (profile = sofia_glue_find_profile(argv[1]))) {
if (!argv[2] || strcasecmp(argv[2], "reg")) {
stream->write_function(stream, "%s\n", line); stream->write_function(stream, "%s\n", line);
stream->write_function(stream, "Name \t\t%s\n", switch_str_nil(argv[1])); stream->write_function(stream, "Name \t\t%s\n", switch_str_nil(argv[1]));
stream->write_function(stream, "Domain Name \t\t%s\n", profile->domain_name ? profile->domain_name : "N/A"); stream->write_function(stream, "Domain Name \t\t%s\n", profile->domain_name ? profile->domain_name : "N/A");
@ -1327,15 +1329,37 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
stream->write_function(stream, "AGGRESSIVENAT \t\t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false"); stream->write_function(stream, "AGGRESSIVENAT \t\t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
stream->write_function(stream, "STUN_ENABLED \t\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false"); stream->write_function(stream, "STUN_ENABLED \t\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
stream->write_function(stream, "STUN_AUTO_DISABLE \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false"); stream->write_function(stream, "STUN_AUTO_DISABLE \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
}
stream->write_function(stream, "\nRegistrations:\n%s\n", line); stream->write_function(stream, "\nRegistrations:\n%s\n", line);
cb.profile = profile; cb.profile = profile;
cb.stream = stream; cb.stream = stream;
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, if (argv[3]) {
"select call_id,sip_user,sip_host,contact,status," if (argv[4]) {
if (!strcasecmp(argv[3], "pres")) {
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
"rpid,expires,user_agent,server_user,server_host,profile_name,hostname" "rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
" from sip_registrations", show_reg_callback, &cb); " from sip_registrations where profile_name='%q' and presence_hosts like '%%%q%%'",
profile->name, argv[4]);
}
} else {
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
"rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
" from sip_registrations where profile_name='%q' and contact like '%%%q%%'",
profile->name, argv[3]);
}
}
if (!sql) {
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
"rpid,expires,user_agent,server_user,server_host,profile_name,hostname"
" from sip_registrations where profile_name='%q'",
profile->name);
}
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, show_reg_callback, &cb);
free(sql);
stream->write_function(stream, "%s\n", line); stream->write_function(stream, "%s\n", line);