diff --git a/src/switch_caller.c b/src/switch_caller.c index 37a3683039..21a754d3d0 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -285,26 +285,28 @@ 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); + 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 (caller_profile->soft && switch_test_flag(caller_profile, SWITCH_CPF_SOFT_LOOKUP)) {