diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2037889c01..79ef9caa26 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -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, diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f891c6a513..43329eb006 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -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, "", 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, "", 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, "", diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 8d21513388..be319e353e 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -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);