]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allows the "eavesdrop_group" variable to contain several groups, comma separated...
authorMichael Jerris <mike@jerris.com>
Tue, 1 Jul 2008 17:49:01 +0000 (17:49 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 1 Jul 2008 17:49:01 +0000 (17:49 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8876 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_async.c

index 2557cda0d8360fedab041806c75c2e748dc63230..6d284e1f89a5d275b7c7f31a25d6f7f5c7e8d728 100644 (file)
@@ -528,8 +528,30 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
 
 
                if (!switch_strlen_zero(require_group)) {
+                       int argc, i;
+                       int ok = 0;
+                       char *argv[10] = { 0 };
+                       char *data;
+
                        const char *group_name = switch_channel_get_variable(tchannel, "eavesdrop_group");
-                       if (!group_name || strcmp(group_name, require_group)) {
+                       /* If we don't have a group, then return */
+                       if (!group_name) {
+                               status = SWITCH_STATUS_BREAK;
+                               goto end;
+                       }
+                       /* Separate the group */
+                       data = strdup(group_name);
+                       if ( (argc = switch_separate_string(data, ',', argv, (sizeof(argv) / sizeof(argv[0])))) ) {
+                               for ( i = 0; i < argc; i++ ) {
+                                       /* If one of the group matches, then ok */
+                                       if ( !strcmp(argv[i], require_group)) {
+                                               ok = 1;
+                                       }
+                               }
+                       }
+                       switch_safe_free(data);
+                       /* If we didn't find any match, then end */
+                       if ( !ok ) {
                                status = SWITCH_STATUS_BREAK;
                                goto end;
                        }