]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add hold_events variable with start and stop times for each hold
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 12 Sep 2012 21:36:17 +0000 (16:36 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 12 Sep 2012 21:36:17 +0000 (16:36 -0500)
src/switch_channel.c

index 3f767ae21df983649646ae51b4001e81e16f8290..f823b22e498f7a6e7d53a7183c5737ebe0eb3149 100644 (file)
@@ -4032,6 +4032,23 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
                        switch_channel_set_variable(channel, "progress_media_stamp", progress_media);
                }
 
+               if (channel->hold_record) {
+                       switch_hold_record_t *hr;
+                       switch_stream_handle_t stream = { 0 };
+
+                       SWITCH_STANDARD_STREAM(stream);
+
+                       stream.write_function(&stream, "{", SWITCH_VA_NONE);
+
+                       for (hr = channel->hold_record; hr; hr = hr->next) {
+                               stream.write_function(&stream, "{%"SWITCH_TIME_T_FMT",%"SWITCH_TIME_T_FMT"},", hr->on, hr->off);
+                       }
+                       end_of((char *)stream.data) = '}';
+
+                       switch_channel_set_variable(channel, "hold_events", (char *)stream.data);
+                       free(stream.data);
+               }
+
                switch_time_exp_lt(&tm, caller_profile->times->hungup);
                switch_strftime_nocheck(end, &retsize, sizeof(end), fmt, &tm);
                switch_channel_set_variable(channel, "end_stamp", end);