[Freeswitch-svn] [commit] r8568 - in freeswitch/trunk/src: . include
Freeswitch SVN
anthm at freeswitch.org
Fri May 23 21:43:12 EDT 2008
Author: anthm
Date: Fri May 23 21:43:12 2008
New Revision: 8568
Modified:
freeswitch/trunk/src/include/switch_channel.h
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_ivr.c
Log:
update
Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h (original)
+++ freeswitch/trunk/src/include/switch_channel.h Fri May 23 21:43:12 2008
@@ -44,6 +44,8 @@
switch_time_t profile_created;
switch_time_t created;
switch_time_t answered;
+ switch_time_t progress;
+ switch_time_t progress_media;
switch_time_t hungup;
switch_time_t transferred;
struct switch_channel_timetable *next;
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Fri May 23 21:43:12 2008
@@ -1141,6 +1141,8 @@
if (channel->caller_profile && channel->caller_profile->times) {
channel->caller_profile->times->transferred = caller_profile->times->profile_created;
caller_profile->times->answered = channel->caller_profile->times->answered;
+ caller_profile->times->progress = channel->caller_profile->times->progress;
+ caller_profile->times->progress_media = channel->caller_profile->times->progress_media;
caller_profile->times->created = channel->caller_profile->times->created;
caller_profile->times->hungup = channel->caller_profile->times->hungup;
} else {
@@ -1373,6 +1375,12 @@
return SWITCH_STATUS_SUCCESS;
}
+ if (channel->caller_profile && channel->caller_profile->times) {
+ switch_mutex_lock(channel->profile_mutex);
+ channel->caller_profile->times->progress = switch_timestamp_now();
+ switch_mutex_unlock(channel->profile_mutex);
+ }
+
return SWITCH_STATUS_FALSE;
}
@@ -1394,6 +1402,12 @@
switch_event_fire(&event);
}
+ if (channel->caller_profile && channel->caller_profile->times) {
+ switch_mutex_lock(channel->profile_mutex);
+ channel->caller_profile->times->progress_media = switch_timestamp_now();
+ switch_mutex_unlock(channel->profile_mutex);
+ }
+
/* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send
a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
*/
@@ -1922,10 +1936,10 @@
switch_caller_profile_t *caller_profile, *ocp;
switch_app_log_t *app_log, *ap;
char *last_app = NULL, *last_arg = NULL;
- char start[80] = "", answer[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
+ char start[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0;
switch_time_t uduration = 0, legbillusec = 0, billusec = 0;
- time_t tt_created = 0, tt_answered = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created;
+ time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0 , mtt_progress_media = 0;
if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
return SWITCH_STATUS_FALSE;
@@ -1968,6 +1982,18 @@
switch_channel_set_variable(channel, "answer_stamp", answer);
}
+ if (caller_profile->times->progress) {
+ switch_time_exp_lt(&tm, caller_profile->times->progress);
+ switch_strftime(progress, &retsize, sizeof(progress), fmt, &tm);
+ switch_channel_set_variable(channel, "progress_stamp", progress);
+ }
+
+ if (caller_profile->times->progress_media) {
+ switch_time_exp_lt(&tm, caller_profile->times->progress_media);
+ switch_strftime(progress_media, &retsize, sizeof(progress_media), fmt, &tm);
+ switch_channel_set_variable(channel, "progress_media_stamp", progress_media);
+ }
+
switch_time_exp_lt(&tm, caller_profile->times->hungup);
switch_strftime(end, &retsize, sizeof(end), fmt, &tm);
switch_channel_set_variable(channel, "end_stamp", end);
@@ -1993,6 +2019,20 @@
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
switch_channel_set_variable(channel, "answer_uepoch", tmp);
+ tt_progress = (time_t) (caller_profile->times->progress / 1000000);
+ mtt_progress = (time_t) (caller_profile->times->progress / 1000);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress);
+ switch_channel_set_variable(channel, "answer_epoch", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
+ switch_channel_set_variable(channel, "answer_uepoch", tmp);
+
+ tt_progress_media = (time_t) (caller_profile->times->progress_media / 1000000);
+ mtt_progress_media = (time_t) (caller_profile->times->progress_media / 1000);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress_media);
+ switch_channel_set_variable(channel, "answer_epoch", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
+ switch_channel_set_variable(channel, "answer_uepoch", tmp);
+
tt_hungup = (time_t) (caller_profile->times->hungup / 1000000);
mtt_hungup = (time_t) (caller_profile->times->hungup / 1000);
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Fri May 23 21:43:12 2008
@@ -1583,6 +1583,19 @@
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);
switch_xml_set_txt_d(time_tag, tmp);
+ if (!(time_tag = switch_xml_add_child_d(x_times, "progress_time", t_off++))) {
+ goto error;
+ }
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
+ switch_xml_set_txt_d(time_tag, tmp);
+
+
+ if (!(time_tag = switch_xml_add_child_d(x_times, "progress_media_time", t_off++))) {
+ goto error;
+ }
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
+ switch_xml_set_txt_d(time_tag, tmp);
+
if (!(time_tag = switch_xml_add_child_d(x_times, "answered_time", t_off++))) {
goto error;
}
More information about the Freeswitch-svn
mailing list