]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Reuse caller profile
authorsurendrasignalwire <56929670+surendrasignalwire@users.noreply.github.com>
Tue, 29 Sep 2020 15:10:33 +0000 (20:40 +0530)
committerAndrey Volk <andywolk@gmail.com>
Tue, 16 Mar 2021 21:52:36 +0000 (00:52 +0300)
src/include/switch_types.h
src/mod/applications/mod_dptools/mod_dptools.c
src/switch_ivr.c

index 2037889c01b74b9f28fb81fb762bbbc0efab2dd6..79ef9caa26625e8ce506b53cb830fd76fb032e2d 100644 (file)
@@ -1416,6 +1416,7 @@ CF_HOLD_BLEG        - B leg is on hold
 CF_SERVICE                     - Channel has a service thread
 CF_TAGGED                      - Channel is tagged
 CF_WINNER                      - Channel is the winner
+CF_REUSE_CALLER_PROFILE - Channel reuse caller profile 
 CF_CONTROLLED          - Channel is under control
 CF_PROXY_MODE          - Channel has no media
 CF_SUSPEND                     - Suspend i/o
@@ -1468,6 +1469,7 @@ typedef enum {
        CF_SERVICE,
        CF_TAGGED,
        CF_WINNER,
+       CF_REUSE_CALLER_PROFILE,
        CF_CONTROLLED,
        CF_PROXY_MODE,
        CF_PROXY_OFF,
index f891c6a513039fe4c07eb4cd42ab0f2ad2fd4856..43329eb00636c4d332b9a8f50d0f798ddd45d34a 100644 (file)
@@ -1150,6 +1150,13 @@ SWITCH_STANDARD_APP(break_function)
        }
 }
 
+SWITCH_STANDARD_APP(reuse_caller_profile_function)
+{
+       switch_channel_t *channel;
+       channel = switch_core_session_get_channel(session);
+       switch_channel_set_flag(channel, CF_REUSE_CALLER_PROFILE);
+}
+
 SWITCH_STANDARD_APP(queue_dtmf_function)
 {
        switch_channel_queue_dtmf_string(switch_core_session_get_channel(session), (const char *) data);
@@ -6551,6 +6558,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
                                   SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "recovery_refresh", "Send call recovery_refresh", "Send a call recovery_refresh.", recovery_refresh_function, "", SAF_SUPPORT_NOMEDIA);
+       SWITCH_ADD_APP(app_interface, "reuse_caller_profile", "Reuse the caller profile", "Reuse the caller profile", reuse_caller_profile_function, "", SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
                                   SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
index 8d215133887c822f410a6772e01ca9d83e7943ff..be319e353e481fdd1b799e929b44feaab76c7bde 100644 (file)
@@ -2192,7 +2192,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
                        extension = "service";
                }
 
-               new_profile = switch_caller_profile_clone(session, profile);
+
+               if (switch_channel_test_flag(channel, CF_REUSE_CALLER_PROFILE)){
+                       new_profile = switch_channel_get_caller_profile(channel);
+               } else {
+                       new_profile = switch_caller_profile_clone(session, profile);
+               }
 
                new_profile->dialplan = switch_core_strdup(new_profile->pool, use_dialplan);
                new_profile->context = switch_core_strdup(new_profile->pool, use_context);
@@ -2238,7 +2243,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
                        switch_core_session_rwunlock(other_session);
                }
 
-               switch_channel_set_caller_profile(channel, new_profile);
+               if (!switch_channel_test_flag(channel, CF_REUSE_CALLER_PROFILE)){
+                       switch_channel_set_caller_profile(channel, new_profile);        
+               }
 
                switch_channel_set_state(channel, CS_ROUTING);
                switch_channel_audio_sync(channel);