[Core] fix crash when get channel var like bleg_created_time

This commit is contained in:
Mariah Yang 2024-10-09 10:19:36 +08:00
parent c402ce1dee
commit b09857c766
No known key found for this signature in database
GPG Key ID: FDD319BEF5A53A84
1 changed files with 22 additions and 20 deletions

View File

@ -285,26 +285,28 @@ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profi
if (!strcasecmp(name, "privacy_hide_number")) { if (!strcasecmp(name, "privacy_hide_number")) {
return switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "true" : "false"; return switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "true" : "false";
} }
if (!strcasecmp(name, "profile_created_time")) { if (caller_profile->times) {
return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created); 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, "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, "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_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, "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, "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, "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)) { if (caller_profile->soft && switch_test_flag(caller_profile, SWITCH_CPF_SOFT_LOOKUP)) {