allows the "eavesdrop_group" variable to contain several groups, comma separated. (MODAPP-101)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8876 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-07-01 17:49:01 +00:00
parent e786772a72
commit 7b7af8f948
1 changed files with 23 additions and 1 deletions

View 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;
}