]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3699 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 17 Nov 2011 22:25:50 +0000 (16:25 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 17 Nov 2011 22:25:50 +0000 (16:25 -0600)
src/mod/endpoints/mod_sofia/mod_sofia.c

index a9d05ce8db6fa043e0b946ae55cdfae5212c0c9a..4cd0868be0d96d9d71bfe9b5b427adfc336f6793 100644 (file)
@@ -2875,7 +2875,6 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
                                        stream->write_function(stream, "CALLS-OUT        \t%u\n", profile->ob_calls);
                                        stream->write_function(stream, "FAILED-CALLS-OUT \t%u\n", profile->ob_failed_calls);
                                }
-                               stream->write_function(stream, "\nRegistrations:\n%s\n", line);
 
                                cb.profile = profile;
                                cb.stream = stream;
@@ -2892,6 +2891,12 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
                                                                                 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
                                                                                 " from sip_registrations where profile_name='%q' and contact like '%%%q%%'", profile->name, argv[3]);
                                }
+                               if (!sql && argv[2] && !strcasecmp(argv[2], "reg")) {
+                                       sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
+                                                                                "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+                                                                                "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
+                                                                                " from sip_registrations where profile_name='%q'", profile->name);
+                               }
                                if (!sql && argv[2] && !strcasecmp(argv[2], "user") && argv[3]) {
                                        char *dup = strdup(argv[3]);
                                        char *host = NULL, *user = NULL;
@@ -2922,20 +2927,18 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
                                        switch_safe_free(sqlextra);
                                }
 
-                               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,"
-                                                                                "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-                                                                                " from sip_registrations where profile_name='%q'", profile->name);
-                               }
+                               if (sql) {
+                                       stream->write_function(stream, "\nRegistrations:\n%s\n", line);
 
-                               sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, show_reg_callback, &cb);
-                               switch_safe_free(sql);
+                                       sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, show_reg_callback, &cb);
+                                       switch_safe_free(sql);
 
-                               stream->write_function(stream, "Total items returned: %d\n", cb.row_process);
-                               stream->write_function(stream, "%s\n", line);
+                                       stream->write_function(stream, "Total items returned: %d\n", cb.row_process);
+                                       stream->write_function(stream, "%s\n", line);
+                               }
 
                                sofia_glue_release_profile(profile);
+
                        } else {
                                stream->write_function(stream, "Invalid Profile!\n");
                        }
@@ -3981,7 +3984,7 @@ SWITCH_STANDARD_API(sofia_function)
                "                     siptrace <on|off>\n"
                "                     capture  <on|off>\n"
                "                     watchdog <on|off>\n\n"
-               "sofia <status|xmlstatus> profile <name> [reg <contact str>] | [pres <pres str>] | [user <user@domain>]\n"
+               "sofia <status|xmlstatus> profile <name> [reg [<contact str>]] | [pres <pres str>] | [user <user@domain>]\n"
                "sofia <status|xmlstatus> gateway <name>\n\n"
                "sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]\n"
                "sofia tracelevel <console|alert|crit|err|warning|notice|info|debug>\n\n"