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(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);
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;
}
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);
{
switch_core_session_message_t *msg;
- switch_caller_profile_t *caller_profile;
- switch_channel_t *caller_channel;
+ switch_caller_profile_t *caller_profile, *peer_caller_profile;
+ switch_channel_t *caller_channel, *peer_channel;
const char *name, *number, *p;
caller_channel = switch_core_session_get_channel(session);
+ peer_channel = switch_core_session_get_channel(peer_session);
+
caller_profile = switch_channel_get_caller_profile(caller_channel);
-
+ peer_caller_profile = switch_channel_get_caller_profile(peer_channel);
if (switch_channel_test_flag(caller_channel, CF_BRIDGE_ORIGINATOR)) {
- name = caller_profile->caller_id_name;
- number = caller_profile->caller_id_number;
+ if (!zstr(peer_caller_profile->caller_id_name)) {
+ name = peer_caller_profile->caller_id_name;
+ } else {
+ name = caller_profile->caller_id_name;
+ }
+
+ if (!zstr(peer_caller_profile->caller_id_number)) {
+ number = peer_caller_profile->caller_id_number;
+ } else {
+ number = caller_profile->caller_id_number;
+ }
if (zstr(number)) {
number = "UNKNOWN";