more cid refactor
This commit is contained in:
parent
be273b673b
commit
d1b2ee0b4b
|
@ -76,6 +76,10 @@ typedef struct profile_node_s {
|
|||
const char *caller_id_name;
|
||||
/*! Caller ID Number */
|
||||
const char *caller_id_number;
|
||||
/*! Original Caller ID Name */
|
||||
const char *orig_caller_id_name;
|
||||
/*! Original Caller ID Number */
|
||||
const char *orig_caller_id_number;
|
||||
/*! Callee ID Name */
|
||||
const char *callee_id_name;
|
||||
/*! Callee ID Number */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -93,17 +93,28 @@ static void send_display(switch_core_session_t *session, switch_core_session_t *
|
|||
{
|
||||
|
||||
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);
|
||||
caller_profile = switch_channel_get_caller_profile(caller_channel);
|
||||
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)) {
|
||||
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";
|
||||
|
|
Loading…
Reference in New Issue