SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool, const char *username, const char *dialplan, const char *caller_id_name, const char *caller_id_number, const char *network_addr, const char *ani, const char *aniii, const char *rdnis, const char *source, const char *context, const char *destination_number) { switch_caller_profile_t *profile = NULL; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; profile = switch_core_alloc(pool, sizeof(*profile)); switch_assert(profile != NULL); memset(profile, 0, sizeof(*profile)); switch_uuid_str(uuid_str, sizeof(uuid_str)); profile->uuid_str = switch_core_strdup(pool, uuid_str); if (!context) { context = "default"; } if (zstr(caller_id_name)) { caller_id_name = SWITCH_DEFAULT_CLID_NAME; } if (zstr(caller_id_number)) { caller_id_number = SWITCH_DEFAULT_CLID_NUMBER; } /* ANI defaults to Caller ID Number when not specified */ if (zstr(ani)) { ani = caller_id_number; } profile_dup_clean(username, profile->username, pool); profile_dup_clean(dialplan, profile->dialplan, pool); profile_dup_clean(caller_id_name, profile->caller_id_name, pool); profile_dup_clean(caller_id_number, profile->caller_id_number, pool); profile_dup_clean(caller_id_name, profile->orig_caller_id_name, pool); profile_dup_clean(caller_id_number, profile->orig_caller_id_number, pool); profile->caller_ton = SWITCH_TON_UNDEF; profile->caller_numplan = SWITCH_NUMPLAN_UNDEF; profile_dup_clean(network_addr, profile->network_addr, pool); profile_dup_clean(ani, profile->ani, pool); profile->ani_ton = SWITCH_TON_UNDEF; profile->ani_numplan = SWITCH_NUMPLAN_UNDEF; profile_dup_clean(aniii, profile->aniii, pool); profile_dup_clean(rdnis, profile->rdnis, pool); profile->rdnis_ton = SWITCH_TON_UNDEF; profile->rdnis_numplan = SWITCH_NUMPLAN_UNDEF; profile_dup_clean(source, profile->source, pool); profile_dup_clean(context, profile->context, pool); profile_dup_clean(destination_number, profile->destination_number, pool); profile->destination_number_ton = SWITCH_TON_UNDEF; profile->destination_number_numplan = SWITCH_NUMPLAN_UNDEF; profile->uuid = SWITCH_BLANK_STRING; profile->chan_name = SWITCH_BLANK_STRING; profile->callee_id_name = SWITCH_BLANK_STRING; profile->callee_id_number = SWITCH_BLANK_STRING; switch_set_flag(profile, SWITCH_CPF_SCREEN); profile->pool = pool; return profile; }
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool, const char *username, const char *dialplan, const char *caller_id_name, const char *caller_id_number, const char *network_addr, const char *ani, const char *aniii, const char *rdnis, const char *source, const char *context, const char *destination_number) { switch_caller_profile_t *profile = NULL; profile = switch_core_alloc(pool, sizeof(*profile)); switch_assert(profile != NULL); memset(profile, 0, sizeof(*profile)); if (!context) { context = "default"; } if (zstr(caller_id_name)) { caller_id_name = SWITCH_DEFAULT_CLID_NAME; } if (zstr(caller_id_number)) { caller_id_number = "0000000000"; } profile_dup_clean(username, profile->username, pool); profile_dup_clean(dialplan, profile->dialplan, pool); profile_dup_clean(caller_id_name, profile->caller_id_name, pool); profile_dup_clean(caller_id_number, profile->caller_id_number, pool); profile->caller_ton = SWITCH_TON_UNDEF; profile->caller_numplan = SWITCH_NUMPLAN_UNDEF; profile_dup_clean(network_addr, profile->network_addr, pool); profile_dup_clean(ani, profile->ani, pool); profile->ani_ton = SWITCH_TON_UNDEF; profile->ani_numplan = SWITCH_NUMPLAN_UNDEF; profile_dup_clean(aniii, profile->aniii, pool); profile_dup_clean(rdnis, profile->rdnis, pool); profile->rdnis_ton = SWITCH_TON_UNDEF; profile->rdnis_numplan = SWITCH_NUMPLAN_UNDEF; profile_dup_clean(source, profile->source, pool); profile_dup_clean(context, profile->context, pool); profile_dup_clean(destination_number, profile->destination_number, pool); profile->destination_number_ton = SWITCH_TON_UNDEF; profile->destination_number_numplan = SWITCH_NUMPLAN_UNDEF; profile->uuid = SWITCH_BLANK_STRING; profile->chan_name = SWITCH_BLANK_STRING; profile->callee_id_name = SWITCH_BLANK_STRING; profile->callee_id_number = SWITCH_BLANK_STRING; switch_set_flag(profile, SWITCH_CPF_SCREEN); profile->pool = pool; return profile; }