diff --git a/src/switch_caller.c b/src/switch_caller.c index 37a3683039c..cf8bbfac3b0 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -285,26 +285,47 @@ 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 (caller_profile->times) { + 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); + } + if (!strcasecmp(name, "bridged_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->bridged); + } + if (!strcasecmp(name, "last_hold_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->last_hold); + } + if (!strcasecmp(name, "hold_accum_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->hold_accum); + } } - 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, "bridged_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->bridged); } - if (!strcasecmp(name, "hungup_time")) { - return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup); + if (!strcasecmp(name, "last_hold_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->last_hold); } - if (!strcasecmp(name, "transferred_time")) { - return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred); + if (!strcasecmp(name, "hold_accum_time")) { + return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->hold_accum); } if (caller_profile->soft && switch_test_flag(caller_profile, SWITCH_CPF_SOFT_LOOKUP)) { diff --git a/src/switch_channel.c b/src/switch_channel.c index d360c8a9517..44ac040e9e1 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -990,23 +990,32 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *c } if (!v && (!channel->variables || !(v = switch_event_get_header_idx(channel->variables, varname, idx)))) { - switch_caller_profile_t *cp = switch_channel_get_caller_profile(channel); - - if (cp) { - if (!strncmp(varname, "aleg_", 5)) { - cp = cp->originator_caller_profile; - varname += 5; - } else if (!strncmp(varname, "bleg_", 5)) { - cp = cp->originatee_caller_profile; - varname += 5; - } - } + if (!strncmp(varname, "other_", 6)) { + varname += 6; - if (!cp || !(v = switch_caller_get_field_by_name(cp, varname))) { - if ((vdup = switch_core_get_variable_pdup(varname, switch_core_session_get_pool(channel->session)))) { + if ((vdup = switch_channel_get_variable_partner(channel, varname))) { v = vdup; } + } else { + switch_caller_profile_t *cp = switch_channel_get_caller_profile(channel); + + if (cp) { + if (!strncmp(varname, "aleg_", 5)) { + cp = cp->originator_caller_profile; + varname += 5; + } else if (!strncmp(varname, "bleg_", 5)) { + cp = cp->originatee_caller_profile; + varname += 5; + } + } + + if (!cp || !(v = switch_caller_get_field_by_name(cp, varname))) { + if ((vdup = switch_core_get_variable_pdup(varname, switch_core_session_get_pool(channel->session)))) { + v = vdup; + } + } } + } }