git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13440 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-05-26 22:48:43 +00:00
parent 99f6627380
commit 55f9c53454
1 changed files with 48 additions and 3 deletions

View File

@ -148,7 +148,8 @@ typedef enum {
MFLAG_RESTART = (1 << 12), MFLAG_RESTART = (1 << 12),
MFLAG_MINTWO = (1 << 13), MFLAG_MINTWO = (1 << 13),
MFLAG_MUTE_DETECT = (1 << 14), MFLAG_MUTE_DETECT = (1 << 14),
MFLAG_DIST_DTMF = (1 << 15) MFLAG_DIST_DTMF = (1 << 15),
MFLAG_MOD = (1 << 16)
} member_flag_t; } member_flag_t;
typedef enum { typedef enum {
@ -159,6 +160,7 @@ typedef enum {
CFLAG_LOCKED = (1 << 4), CFLAG_LOCKED = (1 << 4),
CFLAG_ANSWERED = (1 << 5), CFLAG_ANSWERED = (1 << 5),
CFLAG_BRIDGE_TO = (1 << 6), CFLAG_BRIDGE_TO = (1 << 6),
CFLAG_WAIT_MOD = (1 << 7)
} conf_flag_t; } conf_flag_t;
typedef enum { typedef enum {
@ -621,7 +623,11 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
switch_event_fire(&event); switch_event_fire(&event);
} }
if (conference->count > 1) { if (switch_test_flag(conference, CFLAG_WAIT_MOD) && switch_test_flag(member, MFLAG_MOD)) {
switch_clear_flag(conference, CFLAG_WAIT_MOD);
}
if (conference->count > 1 && (!switch_test_flag(conference, CFLAG_WAIT_MOD))) {
if (conference->moh_sound) { if (conference->moh_sound) {
/* stop MoH if any */ /* stop MoH if any */
conference_stop_file(conference, FILE_STOP_ASYNC); conference_stop_file(conference, FILE_STOP_ASYNC);
@ -1853,7 +1859,8 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
} }
/* skip frames that are not actual media or when we are muted or silent */ /* skip frames that are not actual media or when we are muted or silent */
if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK)) { if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK) &&
!switch_test_flag(member->conference, CFLAG_WAIT_MOD)) {
switch_audio_resampler_t *read_resampler = member->read_resampler; switch_audio_resampler_t *read_resampler = member->read_resampler;
void *data; void *data;
uint32_t datalen; uint32_t datalen;
@ -4578,6 +4585,8 @@ static void set_mflags(char *flags, member_flag_t *f)
*f |= MFLAG_MUTE_DETECT; *f |= MFLAG_MUTE_DETECT;
} else if (!strcasecmp(argv[i], "dist-dtmf")) { } else if (!strcasecmp(argv[i], "dist-dtmf")) {
*f |= MFLAG_DIST_DTMF; *f |= MFLAG_DIST_DTMF;
} else if (!strcasecmp(argv[i], "moderator")) {
*f |= MFLAG_MOD;
} else if (!strcasecmp(argv[i], "endconf")) { } else if (!strcasecmp(argv[i], "endconf")) {
*f |= MFLAG_ENDCONF; *f |= MFLAG_ENDCONF;
} else if (!strcasecmp(argv[i], "mintwo")) { } else if (!strcasecmp(argv[i], "mintwo")) {
@ -4589,6 +4598,35 @@ static void set_mflags(char *flags, member_flag_t *f)
} }
} }
static void set_cflags(char *flags, member_flag_t *f)
{
if (flags) {
char *dup = strdup(flags);
char *p;
char *argv[10] = { 0 };
int i, argc = 0;
for(p = dup; p && *p; p++) {
if (*p == ',') {
*p = '|';
}
}
argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
for(i = 0; i < argc && argv[i]; i++) {
if (!strcasecmp(argv[i], "wait-mod")) {
*f |= CFLAG_WAIT_MOD;
}
}
free(dup);
}
}
static void clear_eflags(char *events, uint32_t *f) static void clear_eflags(char *events, uint32_t *f)
{ {
char buf[512] = ""; char buf[512] = "";
@ -5483,6 +5521,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
char *caller_id_number = NULL; char *caller_id_number = NULL;
char *caller_controls = NULL; char *caller_controls = NULL;
char *member_flags = NULL; char *member_flags = NULL;
char *conference_flags = NULL;
char *perpetual_sound = NULL; char *perpetual_sound = NULL;
char *moh_sound = NULL; char *moh_sound = NULL;
uint32_t max_members = 0; uint32_t max_members = 0;
@ -5570,6 +5609,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
is_unlocked_sound = val; is_unlocked_sound = val;
} else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) { } else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) {
member_flags = val; member_flags = val;
} else if (!strcasecmp(var, "conference-flags") && !switch_strlen_zero(val)) {
conference_flags = val;
} else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) { } else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) {
kicked_sound = val; kicked_sound = val;
} else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) { } else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) {
@ -5691,6 +5732,10 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
set_mflags(member_flags, &conference->mflags); set_mflags(member_flags, &conference->mflags);
} }
if (conference_flags) {
set_cflags(conference_flags, &conference->flags);
}
if (sound_prefix) { if (sound_prefix) {
conference->sound_prefix = switch_core_strdup(conference->pool, sound_prefix); conference->sound_prefix = switch_core_strdup(conference->pool, sound_prefix);
} }