From 4cc12a804a2844695517e99d94326ac582eca752 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 5 Apr 2008 15:48:12 +0000 Subject: [PATCH] add fifo_record_template git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8039 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_cpp.h | 7 +++++++ src/mod/applications/mod_fifo/mod_fifo.c | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 9e0d2c5cdd..3510a9ea2f 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -91,6 +91,13 @@ typedef enum { } session_flag_t; +class switchEvent { + protected: + switch_event_t *event; + public: + switchEvent(switch_event_types_t event_id, const char *subclass_name); +}; + class CoreSession { protected: switch_input_args_t args; // holds ptr to cb function and input_callback_state struct diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 0f8531a56f..137b6afbc8 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -797,7 +797,9 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_t *other_channel = switch_core_session_get_channel(other_session); switch_caller_profile_t *cloned_profile; const char *o_announce = NULL; - + const char *record_template = switch_channel_get_variable(channel, "fifo_record_template"); + char *expanded = NULL; + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(other_channel, event); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]); @@ -864,8 +866,21 @@ SWITCH_STANDARD_APP(fifo_function) switch_mutex_lock(node->mutex); send_presence(node); switch_mutex_unlock(node->mutex); + + if (record_template) { + expanded = switch_channel_expand_variables(other_channel, record_template); + switch_ivr_record_session(session, expanded, 0, NULL); + } + switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session); + if (record_template) { + switch_ivr_stop_record_session(session, expanded); + if (expanded != record_template) { + switch_safe_free(expanded); + } + } + ts = switch_timestamp_now(); switch_time_exp_lt(&tm, ts); switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);