diff --git a/src/switch_channel.c b/src/switch_channel.c index e82af1e792..e4c0c154f8 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3033,8 +3033,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_caller_profile_t *caller_profile, *ocp; switch_app_log_t *app_log, *ap; char *last_app = NULL, *last_arg = NULL; - char start[80] = "", resurrect[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = - ""; + char start[80] = "", resurrect[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, progressmsec = 0, progress_mediamsec = 0; int32_t answersec = 0, answermsec = 0; switch_time_t answerusec = 0; @@ -3114,7 +3114,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * if (caller_profile->times->resurrected) { switch_time_exp_lt(&tm, caller_profile->times->resurrected); - switch_strftime_nocheck(answer, &retsize, sizeof(resurrect), fmt, &tm); + switch_strftime_nocheck(resurrect, &retsize, sizeof(resurrect), fmt, &tm); switch_channel_set_variable(channel, "resurrect_stamp", resurrect); } @@ -3136,13 +3136,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * 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); + 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_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); @@ -3176,7 +3176,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media); switch_channel_set_variable(channel, "progress_media_uepoch", tmp); - tt_hungup = (time_t) (caller_profile->times->hungup / 1000000); mtt_hungup = (time_t) (caller_profile->times->hungup / 1000); switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hungup); @@ -3184,9 +3183,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup); switch_channel_set_variable(channel, "end_uepoch", tmp); - uduration = caller_profile->times->hungup - caller_profile->times->created; duration = (int32_t) (tt_hungup - tt_created); mduration = (int32_t) (mtt_hungup - mtt_created); + uduration = caller_profile->times->hungup - caller_profile->times->created; if (caller_profile->times->answered) { billsec = (int32_t) (tt_hungup - tt_answered); @@ -3214,7 +3213,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * progress_mediausec = caller_profile->times->progress_media - caller_profile->times->created; } - } switch_channel_set_variable(channel, "last_app", last_app); @@ -3227,13 +3225,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%d", billsec); switch_channel_set_variable(channel, "billsec", tmp); - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, progresssec); + switch_snprintf(tmp, sizeof(tmp), "%d", progresssec); switch_channel_set_variable(channel, "progresssec", tmp); - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, answersec); + switch_snprintf(tmp, sizeof(tmp), "%d", answersec); switch_channel_set_variable(channel, "answersec", tmp); - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, progress_mediasec); + switch_snprintf(tmp, sizeof(tmp), "%d", progress_mediasec); switch_channel_set_variable(channel, "progress_mediasec", tmp); switch_snprintf(tmp, sizeof(tmp), "%d", legbillsec); @@ -3251,7 +3249,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%d", answermsec); switch_channel_set_variable(channel, "answermsec", tmp); - switch_snprintf(tmp, sizeof(tmp), "%d", progressmsec); + switch_snprintf(tmp, sizeof(tmp), "%d", progress_mediamsec); switch_channel_set_variable(channel, "progress_mediamsec", tmp); switch_snprintf(tmp, sizeof(tmp), "%d", legbillmsec);