[Freeswitch-trunk] [commit] r6916 - in freeswitch/trunk/src: . include mod/event_handlers/mod_cdr_csv

Freeswitch SVN anthm at freeswitch.org
Thu Dec 20 12:27:12 EST 2007


Author: anthm
Date: Thu Dec 20 12:27:11 2007
New Revision: 6916

Modified:
   freeswitch/trunk/src/include/switch_channel.h
   freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_ivr.c

Log:
cdr update

Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h	(original)
+++ freeswitch/trunk/src/include/switch_channel.h	Thu Dec 20 12:27:11 2007
@@ -41,6 +41,7 @@
 #include <switch.h>
 
 SWITCH_BEGIN_EXTERN_C struct switch_channel_timetable {
+	switch_time_t profile_created;
 	switch_time_t created;
 	switch_time_t answered;
 	switch_time_t hungup;

Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	Thu Dec 20 12:27:11 2007
@@ -164,10 +164,10 @@
 	
 	switch_app_log_t *app_log, *ap;
 	char *last_app = NULL, *last_arg = NULL;
-	char start[80] = "", answer[80] = "", end[80] = "", tmp[80] = "";
+	char start[80] = "", answer[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
 	int32_t duration = 0, billsec = 0, mduration = 0, billmsec = 0;
 	switch_time_t uduration = 0, billusec = 0;
-	time_t tt_created = 0, tt_answered = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 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;
 
 	if (switch_channel_get_originator_caller_profile(channel)) {
 		return SWITCH_STATUS_SUCCESS;
@@ -207,6 +207,10 @@
 		switch_strftime(start, &retsize, sizeof(start), fmt, &tm);
 		switch_channel_set_variable(channel, "start_stamp", start);
 
+		switch_time_exp_lt(&tm, caller_profile->times->profile_created);
+		switch_strftime(profile_start, &retsize, sizeof(profile_start), fmt, &tm);
+		switch_channel_set_variable(channel, "profile_start_stamp", profile_start);
+
 		switch_time_exp_lt(&tm, caller_profile->times->answered);
 		switch_strftime(answer, &retsize, sizeof(answer), fmt, &tm);
 		switch_channel_set_variable(channel, "answer_stamp", answer);
@@ -217,10 +221,17 @@
 
 		tt_created = (time_t) (caller_profile->times->created / 1000000);
 		mtt_created = (time_t) (caller_profile->times->created / 1000);
+		tt_prof_created = (time_t) (caller_profile->times->profile_created / 1000000);
+		mtt_prof_created = (time_t) (caller_profile->times->profile_created / 1000);
 		switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_created);
 		switch_channel_set_variable(channel, "start_epoch", tmp);
 		switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
 		switch_channel_set_variable(channel, "start_uepoch", tmp);
+
+		switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_prof_created);
+		switch_channel_set_variable(channel, "profile_start_epoch", tmp);
+		switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);
+		switch_channel_set_variable(channel, "profile_start_uepoch", tmp);
 		
 		tt_answered = (time_t) (caller_profile->times->answered / 1000000);
 		mtt_answered = (time_t) (caller_profile->times->answered / 1000);

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Thu Dec 20 12:27:11 2007
@@ -957,11 +957,13 @@
 	}
 
 	caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times));
-	caller_profile->times->created = switch_time_now();
+	caller_profile->times->profile_created = switch_time_now();
 
 	if (channel->caller_profile && channel->caller_profile->times) {
-		channel->caller_profile->times->transferred = caller_profile->times->created;
+		channel->caller_profile->times->transferred = caller_profile->times->profile_created;
 		caller_profile->times->answered = channel->caller_profile->times->answered;
+		caller_profile->times->created = channel->caller_profile->times->created;
+		caller_profile->times->hungup = channel->caller_profile->times->hungup;
 	}
 
 	caller_profile->next = channel->caller_profile;

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Thu Dec 20 12:27:11 2007
@@ -1460,6 +1460,12 @@
 			switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
 			switch_xml_set_txt_d(time_tag, tmp);
 
+			if (!(time_tag = switch_xml_add_child_d(x_times, "profile_created_time", t_off++))) {
+				goto error;
+			}
+			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, "answered_time", t_off++))) {
 				goto error;
 			}



More information about the Freeswitch-trunk mailing list