pause media bugs while not in a bridge while inside mod_fifo

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11466 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-01-23 18:44:25 +00:00
parent 07b5dc11e7
commit f60f17d391
4 changed files with 33 additions and 7 deletions

View File

@ -143,6 +143,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(_In_ switch_core_sessi
_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

View File

@ -841,7 +841,7 @@ typedef enum {
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;

View File

@ -767,6 +767,8 @@ SWITCH_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
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_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
strat = STRAT_WAITING_LONGER;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid strategy\n");
return;
goto done;
}
}
@ -996,7 +999,7 @@ SWITCH_STANDARD_APP(fifo_function)
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_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
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 @@ SWITCH_STANDARD_APP(fifo_function)
}
}
}
done:
switch_core_media_bug_resume(session);
}
struct xml_helper {

View File

@ -46,6 +46,16 @@ static void switch_core_media_bug_destroy(switch_media_bug_t *bug)
}
}
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);