From bfe75ffc1dc8bff9c6c8060e2c22bcd8d1d31221 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 15 Sep 2008 14:32:23 +0000 Subject: [PATCH] expose time table to variable interface via caller field lookup git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9567 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_caller.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/switch_caller.c b/src/switch_caller.c index bb9b1c2243..59014d1476 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -207,6 +207,29 @@ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profi if (!strcasecmp(name, "privacy_hide_number")) { return switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "true" : "false"; } + if (!strcasecmp(name, "profile_created_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created); + } + if (!strcasecmp(name, "created_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->created); + } + if (!strcasecmp(name, "answered_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->answered); + } + if (!strcasecmp(name, "progress_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress); + } + if (!strcasecmp(name, "progress_media_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media); + } + if (!strcasecmp(name, "hungup_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup); + } + if (!strcasecmp(name, "transferred_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred); + } + + return NULL; } @@ -271,10 +294,16 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->profile_index); } if (caller_profile->times) { + switch_snprintf(header_name, sizeof(header_name), "%s-Profile-Created-Time", prefix); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created); switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Created-Time", prefix); switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->created); switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Answered-Time", prefix); switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->answered); + switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Progress-Time", prefix); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress); + switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Progress-Media-Time", prefix); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media); switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Hangup-Time", prefix); switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup); switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Transfer-Time", prefix);