[Core] Reuse caller profile

This commit is contained in:
surendrasignalwire 2020-09-29 20:40:33 +05:30 committed by Andrey Volk
parent 5aabb54f68
commit dbc894d959
3 changed files with 19 additions and 2 deletions

View 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,

View 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>",

View 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);