]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
only list real profiles not aliases in presence code
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 14 Jul 2011 21:01:44 +0000 (16:01 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 14 Jul 2011 21:01:44 +0000 (16:01 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index cea774ff99cf2936005912acb0534fd540f1d29c..885204761213ec60b2b13dc7ee7ec01149e69c18 100644 (file)
@@ -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;
index 00dcd7189786e27d0e17f4001b0e6a37843c48f3..10fb99b3f9f0013936a5acaa0a4f91815e686af5 100644 (file)
@@ -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);
index 2c35b60223dd874dce08e2dab3080e03b9d362a0..eeff2ed89be9b13e82b9808b0f3e14d2a8ca51fd 100644 (file)
@@ -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))) {
index aa74e6040c0d6263ea32dee67862bbab176d5e08..7e75fe75bf4829f4ba9e76dd97d52233d8ea4883 100644 (file)
@@ -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) {