if (HELD) {
switch_channel_set_callstate(channel, CCS_HELD);
+ switch_mutex_lock(channel->profile_mutex);
+ channel->caller_profile->times->last_hold = switch_time_now();
+ switch_mutex_unlock(channel->profile_mutex);
}
if (flag == CF_OUTBOUND) {
if (ACTIVE) {
switch_channel_set_callstate(channel, CCS_ACTIVE);
+ switch_mutex_lock(channel->profile_mutex);
+ if (channel->caller_profile->times->last_hold) {
+ channel->caller_profile->times->hold_accum += (switch_time_now() - channel->caller_profile->times->last_hold);
+ }
+ switch_mutex_unlock(channel->profile_mutex);
}
if (flag == CF_OUTBOUND) {
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] = "", bridge[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "",
+ char start[80] = "", resurrect[80] = "", answer[80] = "", hold[80],
+ bridge[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, waitsec = 0, waitmsec = 0;
switch_time_t answerusec = 0;
switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0, waitusec = 0;
- time_t tt_created = 0, tt_answered = 0, tt_resurrected = 0, tt_bridged,
+ time_t tt_created = 0, tt_answered = 0, tt_resurrected = 0, tt_bridged, tt_last_hold, tt_hold_accum,
tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_bridged = 0,
mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0;
void *pop;
switch_channel_set_variable(channel, "bridge_stamp", bridge);
}
+ if (caller_profile->times->last_hold) {
+ switch_time_exp_lt(&tm, caller_profile->times->last_hold);
+ switch_strftime_nocheck(hold, &retsize, sizeof(hold), fmt, &tm);
+ switch_channel_set_variable(channel, "hold_stamp", hold);
+ }
+
if (caller_profile->times->resurrected) {
switch_time_exp_lt(&tm, caller_profile->times->resurrected);
switch_strftime_nocheck(resurrect, &retsize, sizeof(resurrect), fmt, &tm);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->bridged);
switch_channel_set_variable(channel, "bridge_uepoch", tmp);
+ tt_last_hold = (time_t) (caller_profile->times->last_hold / 1000000);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_last_hold);
+ switch_channel_set_variable(channel, "last_hold_epoch", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->last_hold);
+ switch_channel_set_variable(channel, "last_hold_uepoch", tmp);
+
+ tt_hold_accum = (time_t) (caller_profile->times->hold_accum / 1000000);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hold_accum);
+ switch_channel_set_variable(channel, "hold_accum_seconds", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hold_accum);
+ switch_channel_set_variable(channel, "hold_accum_usec", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hold_accum / 1000);
+ switch_channel_set_variable(channel, "hold_accum_ms", tmp);
+
tt_resurrected = (time_t) (caller_profile->times->resurrected / 1000000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_resurrected);
switch_channel_set_variable(channel, "resurrect_epoch", tmp);