提交 61f23283 authored 作者: Anthony Minessale's avatar Anthony Minessale

add some goodies to mod_fifo

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8026 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 9b1ef84d
......@@ -216,7 +216,8 @@
-->
<extension name="park">
<condition field="destination_number" expression="^5900$">
<action application="fifo" data="5900@$${domain} in undef $${moh_uri}"/>
<action application="set" data="fifo_music=$${moh_uri}"/>
<action application="fifo" data="5900@$${domain} in"/>
</condition>
</extension>
......
......@@ -937,7 +937,8 @@ typedef enum {
SWITCH_FILE_PAUSE = (1 << 8),
SWITCH_FILE_NATIVE = (1 << 9),
SWITCH_FILE_SEEK = (1 << 10),
SWITCH_FILE_OPEN = (1 << 11)
SWITCH_FILE_OPEN = (1 << 11),
SWITCH_FILE_CALLBACK = (1 << 12)
} switch_file_flag_t;
typedef enum {
......
......@@ -54,6 +54,7 @@ struct local_stream_context {
const char *file;
const char *func;
int line;
switch_file_handle_t *handle;
struct local_stream_context *next;
};
......@@ -203,6 +204,9 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
switch_mutex_lock(source->mutex);
for (cp = source->context_list; cp; cp = cp->next) {
if (switch_test_flag(cp->handle, SWITCH_FILE_CALLBACK)) {
continue;
}
switch_mutex_lock(cp->audio_mutex);
if (switch_buffer_inuse(cp->audio_buffer) > source->samples * 768) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d]\n", cp->func, cp->file, cp->line);
......@@ -291,7 +295,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
context->file = handle->file;
context->func = handle->func;
context->line = handle->line;
context->handle = handle;
switch_mutex_lock(source->mutex);
context->next = source->context_list;
source->context_list = context;
......
......@@ -616,6 +616,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
if (args && (args->read_frame_callback)) {
if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) {
break;
}
}
}
return status;
......
......@@ -1111,7 +1111,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
}
if (args && (args->read_frame_callback)) {
int ok = 1;
switch_set_flag(fh, SWITCH_FILE_CALLBACK);
if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) {
ok = 0;
}
switch_clear_flag(fh, SWITCH_FILE_CALLBACK);
if (!ok) {
break;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论