[commit] r11466 - in freeswitch/trunk/src: . include mod/applications/mod_fifo
Author: anthm Date: Fri Jan 23 12:44:25 2009 New Revision: 11466 Log: pause media bugs while not in a bridge while inside mod_fifo Modified: freeswitch/trunk/src/include/switch_core.h freeswitch/trunk/src/include/switch_types.h freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c freeswitch/trunk/src/switch_core_media_bug.c Modified: freeswitch/trunk/src/include/switch_core.h ============================================================================== --- freeswitch/trunk/src/include/switch_core.h (original) +++ freeswitch/trunk/src/include/switch_core.h Fri Jan 23 12:44:25 2009 @@ -143,6 +143,10 @@ _In_ switch_media_bug_callback_t callback, _In_opt_ void *user_data, _In_ time_t stop_time, _In_ switch_media_bug_flag_t flags, _Out_ switch_media_bug_t **new_bug); + +SWITCH_DECLARE(void) switch_core_media_bug_pause(switch_core_session_t *session); +SWITCH_DECLARE(void) switch_core_media_bug_resume(switch_core_session_t *session); + /*! \brief Obtain private data from a media bug \param bug the bug to get the data from Modified: freeswitch/trunk/src/include/switch_types.h ============================================================================== --- freeswitch/trunk/src/include/switch_types.h (original) +++ freeswitch/trunk/src/include/switch_types.h Fri Jan 23 12:44:25 2009 @@ -841,7 +841,7 @@ CF_INNER_BRIDGE, CF_REQ_MEDIA, CF_VERBOSE_EVENTS, - + CF_PAUSE_BUGS, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c (original) +++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c Fri Jan 23 12:44:25 2009 @@ -767,6 +767,8 @@ check_string(moh); switch_assert(node); + switch_core_media_bug_pause(session); + if (!consumer) { switch_core_session_t *other_session; switch_channel_t *other_channel; @@ -926,7 +928,7 @@ if (!aborted && switch_channel_ready(channel)) { switch_channel_set_state(channel, CS_HIBERNATE); - return; + goto done; } else { ts = switch_timestamp_now(); switch_time_exp_lt(&tm, ts); @@ -956,7 +958,8 @@ switch_ivr_session_transfer(session, cd.orbit_exten, NULL, NULL); } - return; + goto done; + } else { /* consumer */ void *pop = NULL; switch_frame_t *read_frame; @@ -987,7 +990,7 @@ strat = STRAT_WAITING_LONGER; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid strategy\n"); - return; + goto done; } } @@ -996,7 +999,7 @@ do_wait = 0; } else if (strcasecmp(argv[2], "wait")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE); - return; + goto done; } } @@ -1235,8 +1238,12 @@ switch_ivr_record_session(session, expanded, 0, NULL); } + switch_core_media_bug_resume(session); + switch_core_media_bug_resume(other_session); switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session); - + switch_core_media_bug_pause(session); + switch_core_media_bug_pause(other_session); + if (record_template) { switch_ivr_stop_record_session(session, expanded); if (expanded != record_template) { @@ -1299,7 +1306,7 @@ if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) { while(switch_channel_ready(channel)) { char terminator = 0; - + if (fifo_consumer_wrapup_time) { wrapup_time_elapsed = (switch_timestamp_now() - wrapup_time_started) / 1000; if (wrapup_time_elapsed > fifo_consumer_wrapup_time) { @@ -1362,6 +1369,11 @@ } } } + + done: + + switch_core_media_bug_resume(session); + } struct xml_helper { Modified: freeswitch/trunk/src/switch_core_media_bug.c ============================================================================== --- freeswitch/trunk/src/switch_core_media_bug.c (original) +++ freeswitch/trunk/src/switch_core_media_bug.c Fri Jan 23 12:44:25 2009 @@ -46,6 +46,16 @@ } } +SWITCH_DECLARE(void) switch_core_media_bug_pause(switch_core_session_t *session) +{ + switch_channel_set_flag(session->channel, CF_PAUSE_BUGS); +} + +SWITCH_DECLARE(void) switch_core_media_bug_resume(switch_core_session_t *session) +{ + switch_channel_clear_flag(session->channel, CF_PAUSE_BUGS); +} + SWITCH_DECLARE(uint32_t) switch_core_media_bug_test_flag(switch_media_bug_t *bug, uint32_t flag) { return switch_test_flag(bug, flag);
participants (1)
-
FreeSWITCH SVN