]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
send callee id info as caller id info when an outbound call becomes the a leg of...
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 6 Nov 2009 21:17:23 +0000 (21:17 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 6 Nov 2009 21:17:23 +0000 (21:17 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15390 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_originate.c

index 12593db2332d41aad63c38970d1bf493945a134a..6a4845e70debf784cc904348830508abd29d8a8f 100644 (file)
@@ -1710,6 +1710,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        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);