diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index cea774ff99..8852047612 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4962,7 +4962,7 @@ static void general_event_handler(switch_event_t *event) } } -switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches) +switch_status_t list_profiles_full(const char *line, const char *cursor, switch_console_callback_match_t **matches, switch_bool_t show_aliases) { sofia_profile_t *profile = NULL; switch_hash_index_t *hi; @@ -4974,7 +4974,12 @@ switch_status_t list_profiles(const char *line, const char *cursor, switch_conso switch_mutex_lock(mod_sofia_globals.hash_mutex); for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &vvar, NULL, &val); + profile = (sofia_profile_t *) val; + if (!show_aliases && strcmp((char *)vvar, profile->name)) { + continue; + } + if (sofia_test_pflag(profile, PFLAG_RUNNING)) { switch_console_push_match(&my_matches, (const char *) vvar); } @@ -4990,6 +4995,11 @@ switch_status_t list_profiles(const char *line, const char *cursor, switch_conso return status; } +switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches) +{ + return list_profiles_full(line, cursor, matches, SWITCH_TRUE); +} + static switch_status_t list_gateways(const char *line, const char *cursor, switch_console_callback_match_t **matches) { sofia_profile_t *profile = NULL; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 00dcd71897..10fb99b3f9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1081,8 +1081,10 @@ switch_status_t sofia_set_loglevel(const char *name, int level); * \note Valid components are "default" (sofia's default logger), "tport", "iptsec", "nea", "nta", "nth_client", "nth_server", "nua", "soa", "sresolv", "stun" * \return the component's loglevel, or -1 if the component isn't valid */ -switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches); int sofia_get_loglevel(const char *name); +switch_status_t list_profiles_full(const char *line, const char *cursor, switch_console_callback_match_t **matches, switch_bool_t show_aliases); +switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches); + sofia_cid_type_t sofia_cid_name2type(const char *name); void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup); void sofia_glue_set_rtp_stats(private_object_t *tech_pvt); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2c35b60223..eeff2ed89b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5541,7 +5541,7 @@ int sofia_glue_recover(switch_bool_t flush) switch_console_callback_match_t *matches; - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) { if ((profile = sofia_glue_find_profile(m->val))) { diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index aa74e6040c..7e75fe75bf 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -282,7 +282,7 @@ void sofia_presence_cancel(void) return; } - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," @@ -409,7 +409,7 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) sql = switch_mprintf("select profile_name from sip_registrations where sip_host='%s' or mwi_host='%s'", host, host); - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) { @@ -592,7 +592,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) switch_assert(sql != NULL); - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) { @@ -788,7 +788,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) goto done; } - if (list_profiles(NULL, NULL, &matches) == SWITCH_STATUS_SUCCESS) { + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; for (m = matches->head; m; m = m->next) {