Revision
15390
Author
anthm
Date
2009-11-06 15:17:23 -0600 (Fri, 06 Nov 2009)

Log Message

send callee id info as caller id info when an outbound call becomes the a leg of another outbound call

Modified Paths

Diff

Modified: freeswitch/trunk/src/switch_ivr_originate.c (15389 => 15390)


--- freeswitch/trunk/src/switch_ivr_originate.c	2009-11-06 20:17:31 UTC (rev 15389)
+++ freeswitch/trunk/src/switch_ivr_originate.c	2009-11-06 21:17:23 UTC (rev 15390)
@@ -1710,7 +1710,25 @@
 					new_profile->uuid = SWITCH_BLANK_STRING;
 					new_profile->chan_name = SWITCH_BLANK_STRING;
 					new_profile->destination_number = switch_core_strdup(new_profile->pool, chan_data);
+					
+					if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+						const char *callee_id_name = new_profile->callee_id_name;
+						const char *callee_id_number = new_profile->callee_id_number;
+						
+						if (zstr(callee_id_number)) {
+							callee_id_number = new_profile->destination_number;
+						}
 
+						if (zstr(callee_id_name)) {
+							callee_id_name = callee_id_number;
+						}
+						
+						new_profile->caller_id_name = callee_id_name;
+						new_profile->caller_id_number = callee_id_number;
+						new_profile->callee_id_name = SWITCH_BLANK_STRING;
+						new_profile->callee_id_number = SWITCH_BLANK_STRING;
+					}
+
 					if (cid_name_override) {
 						new_profile->caller_id_name = switch_core_strdup(new_profile->pool, cid_name_override);
 					}