diff --git a/src/include/switch_types.h b/src/include/switch_types.h index a01efb1ace..710a402885 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -381,6 +381,7 @@ SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs; #define SWITCH_ACCEPTABLE_INTERVAL(_i) (_i && _i <= SWITCH_MAX_INTERVAL && (_i % 10) == 0) typedef enum { + SWITCH_CPF_NONE = 0, SWITCH_CPF_SCREEN = (1 << 0), SWITCH_CPF_HIDE_NAME = (1 << 1), SWITCH_CPF_HIDE_NUMBER = (1 << 2) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index aee6c5ed3b..dfe608d2c7 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -916,7 +916,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess const char *cid_tmp; originate_global_t oglobals = { 0 }; - oglobals.idx = IDX_NADA; oglobals.early_ok = 1; oglobals.session = session; @@ -1422,6 +1421,35 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp); switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_uuid", tmp); } + + + if (vdata && (var_begin = switch_stristr("origination_privacy=", vdata))) { + char tmp[512] = ""; + var_begin += strlen("origination_privacy="); + var_end = strchr(var_begin, '|'); + if (var_end) { + strncpy(tmp, var_begin, var_end-var_begin); + } else { + strncpy(tmp, var_begin, strlen(var_begin)); + } + + new_profile->flags = SWITCH_CPF_NONE; + + if (switch_stristr(tmp, "screen")) { + switch_set_flag(new_profile, SWITCH_CPF_SCREEN); + } + + if (switch_stristr(tmp, "hide_name")) { + switch_set_flag(new_profile, SWITCH_CPF_HIDE_NAME); + } + + if (switch_stristr(tmp, "hide_number")) { + switch_set_flag(new_profile, SWITCH_CPF_HIDE_NUMBER); + } + + new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_privacy", tmp); + } switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "originate_early_media", oglobals.early_ok ? "true" : "false");