[commit] r13191 - freeswitch/trunk/src/mod/applications/mod_conference
Author: anthm Date: Wed Apr 29 12:07:51 2009 New Revision: 13191 Log: dist-dtmf flag in conference Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Wed Apr 29 12:07:51 2009 @@ -144,7 +144,8 @@ MFLAG_TALKING = (1 << 11), MFLAG_RESTART = (1 << 12), MFLAG_MINTWO = (1 << 13), - MFLAG_MUTE_DETECT = (1 << 14) + MFLAG_MUTE_DETECT = (1 << 14), + MFLAG_DIST_DTMF = (1 << 15) } member_flag_t; typedef enum { @@ -153,7 +154,7 @@ CFLAG_ENFORCE_MIN = (1 << 2), CFLAG_DESTRUCT = (1 << 3), CFLAG_LOCKED = (1 << 4), - CFLAG_ANSWERED = (1 << 5) + CFLAG_ANSWERED = (1 << 5), } conf_flag_t; typedef enum { @@ -358,6 +359,7 @@ static void conference_loop_output(conference_member_t *member); static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop); static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async); +static void conference_send_all_dtmf(conference_obj_t *conference, const char *dtmf); static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin); static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim); static conference_obj_t *conference_find(char *name); @@ -1999,11 +2001,14 @@ if (switch_channel_has_dtmf(channel)) { switch_channel_dequeue_dtmf_string(channel, dtmf, sizeof(dtmf)); - if (member->conference->dtmf_parser != NULL) { - - for (digit = dtmf; *digit && caller_action == NULL; digit++) { - caller_action = (caller_control_action_t *) - switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit); + if (switch_test_flag(member, MFLAG_DIST_DTMF)) { + conference_send_all_dtmf(member->conference, dtmf); + } else { + if (member->conference->dtmf_parser != NULL) { + for (digit = dtmf; *digit && caller_action == NULL; digit++) { + caller_action = (caller_control_action_t *) + switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit); + } } } /* otherwise, clock the parser so that it can handle digit timeout detection */ @@ -2414,6 +2419,27 @@ return count; } +static void conference_send_all_dtmf(conference_obj_t *conference, const char *dtmf) +{ + conference_member_t *imember; + + switch_mutex_lock(conference->mutex); + switch_mutex_lock(conference->member_mutex); + + for (imember = conference->members; imember; imember = imember->next) { + if (imember->session) { + const char *p; + for (p = dtmf; p && *p; p++) { + switch_dtmf_t dtmf = { *p, SWITCH_DEFAULT_DTMF_DURATION}; + switch_channel_queue_dtmf(switch_core_session_get_channel(imember->session), &dtmf); + } + } + } + + switch_mutex_unlock(conference->member_mutex); + switch_mutex_unlock(conference->mutex); +} + /* Play a file in the conference room */ static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async) { @@ -4431,6 +4457,8 @@ *f |= MFLAG_WASTE_BANDWIDTH; } else if (!strcasecmp(argv[i], "mute-detect")) { *f |= MFLAG_MUTE_DETECT; + } else if (!strcasecmp(argv[i], "dist-dtmf")) { + *f |= MFLAG_DIST_DTMF; } else if (!strcasecmp(argv[i], "endconf")) { *f |= MFLAG_ENDCONF; } else if (!strcasecmp(argv[i], "mintwo")) {
participants (1)
-
FreeSWITCH SVN