more cid refactor

This commit is contained in:
Anthony Minessale
2013-04-03 17:17:01 -05:00
parent be273b673b
commit d1b2ee0b4b
3 changed files with 38 additions and 5 deletions

View File

@@ -73,6 +73,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
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);
@@ -115,6 +117,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memor
profile_dup(tocopy->caller_id_number, profile->caller_id_number, pool);
profile_dup(tocopy->callee_id_name, profile->callee_id_name, pool);
profile_dup(tocopy->callee_id_number, profile->callee_id_number, pool);
profile_dup(tocopy->orig_caller_id_name, profile->orig_caller_id_name, pool);
profile_dup(tocopy->orig_caller_id_number, profile->orig_caller_id_number, pool);
profile_dup(tocopy->network_addr, profile->network_addr, pool);
profile_dup(tocopy->ani, profile->ani, pool);
profile_dup(tocopy->aniii, profile->aniii, pool);
@@ -190,6 +194,12 @@ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profi
if (!strcasecmp(name, "caller_id_number")) {
return caller_profile->caller_id_number;
}
if (!strcasecmp(name, "orig_caller_id_name")) {
return caller_profile->orig_caller_id_name;
}
if (!strcasecmp(name, "orig_caller_id_number")) {
return caller_profile->orig_caller_id_number;
}
if (!strcasecmp(name, "callee_id_name")) {
return caller_profile->callee_id_name;
}
@@ -316,6 +326,14 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->caller_id_number);
}
if (!zstr(caller_profile->caller_id_name)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Orig-Caller-ID-Name", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->orig_caller_id_name);
}
if (!zstr(caller_profile->caller_id_number)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Orig-Caller-ID-Number", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->orig_caller_id_number);
}
if (!zstr(caller_profile->callee_id_name)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Callee-ID-Name", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->callee_id_name);