]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10596: [core] include opposite caller profiles in cdr when doing enterprise originate
authorMike Jerris <mike@jerris.com>
Thu, 17 Aug 2017 20:47:17 +0000 (16:47 -0400)
committerMike Jerris <mike@jerris.com>
Thu, 17 Aug 2017 20:47:58 +0000 (16:47 -0400)
src/switch_ivr_originate.c

index a8b9ddfb44ed55e49bb522c710eba191fcf8ce2d..e3944e7cb984d55c8ce08bbce5a229810695a947 100644 (file)
@@ -1670,6 +1670,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess
                getcause = 0;
                status = hp->status;
                *bleg = hp->bleg;
+               if (*bleg) {
+                       switch_channel_t *bchan = switch_core_session_get_channel(*bleg);
+                       switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg));
+                       if (peer_profile && (cloned_profile = switch_caller_profile_clone(session, peer_profile))) {
+                               switch_channel_set_originatee_caller_profile(channel, cloned_profile);
+                       }
+                       if (bchan && cp && (cloned_profile = switch_caller_profile_clone(*bleg, cp))) {
+                               switch_channel_set_originator_caller_profile(bchan, cloned_profile);
+                       }
+               }
                switch_mutex_unlock(hp->mutex);
                switch_thread_join(&tstatus, hp->thread);
                switch_event_destroy(&hp->ovars);