]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add fifo_record_template
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 5 Apr 2008 15:48:12 +0000 (15:48 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 5 Apr 2008 15:48:12 +0000 (15:48 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8039 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_cpp.h
src/mod/applications/mod_fifo/mod_fifo.c

index 9e0d2c5cdd2ce440fbd2e50e9d57e8810dea3cc6..3510a9ea2f2ebcd00d1605de6115761c23f6d66f 100644 (file)
@@ -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
index 0f8531a56f8b644fbecf00c44e784344d456010a..137b6afbc8287dfea7f83c769925311519c68140 100644 (file)
@@ -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);