]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak api
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 24 Oct 2013 18:55:07 +0000 (23:55 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 24 Oct 2013 18:55:07 +0000 (23:55 +0500)
src/switch_core_session.c

index a08b548feef435d76be6ddfc1e0af61a69807233..63aab9d58355a125ba2210f3b56c3c4188383211 100644 (file)
@@ -264,11 +264,13 @@ SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall_ma
        switch_memory_pool_t *pool;
        struct str_node *head = NULL, *np;
        switch_console_callback_match_t *my_matches = NULL;
+       const char *like = NULL;
 
-       switch_core_new_memory_pool(&pool);
+       if (var_val && *var_val == '~') {
+               like = var_val + 1;
+       }
 
-       if (!var_val)
-               return NULL;
+       switch_core_new_memory_pool(&pool);
 
        switch_mutex_lock(runtime.session_hash_mutex);
        for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
@@ -290,7 +292,8 @@ SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall_ma
                if ((session = switch_core_session_locate(np->str))) {
                        const char *this_val;
                        if (switch_channel_up_nosig(session->channel) &&
-                               (this_val = switch_channel_get_variable_dup(session->channel, var_name, SWITCH_FALSE, -1)) && (!strcmp(this_val, var_val))) {                   
+                               (this_val = switch_channel_get_variable_dup(session->channel, var_name, SWITCH_FALSE, -1)) && 
+                               (!var_val || (like && switch_stristr(like, var_val)) || !strcmp(this_val, var_val))) {
                                switch_console_push_match(&my_matches, (const char *) np->str);
                        }
                        switch_core_session_rwunlock(session);