Merge pull request #331 in FS/freeswitch from ~CRIENZO/freeswitch:fs-7780-add-max-session-transfers to master
* commit '05cc8bb37d4ec19446943c98cfb6e21cd6aaf9e9': FS-7780 add new channel variable max_session_transfers. If set, this variable is used to count the number of session transfers allowed instead of the max_forwards variable. If not set, the existing behavior is preserved.
This commit is contained in:
commit
8cd05e6b24
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@ -219,6 +219,7 @@ SWITCH_BEGIN_EXTERN_C
|
|||
#define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app"
|
||||
#define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg"
|
||||
#define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
|
||||
#define SWITCH_MAX_SESSION_TRANSFERS_VARIABLE "max_session_transfers"
|
||||
#define SWITCH_DISABLE_APP_LOG_VARIABLE "disable_app_log"
|
||||
#define SWITCH_SPEECH_KEY "speech"
|
||||
#define SWITCH_UUID_BRIDGE "uuid_bridge"
|
||||
|
|
|
@ -1756,10 +1756,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
|
|||
switch_channel_t *other_channel = NULL;
|
||||
const char *uuid = NULL;
|
||||
const char *max_forwards;
|
||||
const char *forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
|
||||
const char *forwardvar_name = SWITCH_MAX_SESSION_TRANSFERS_VARIABLE; /* max_session_transfers has first priority for setting maximum */
|
||||
const char *forwardvar = switch_channel_get_variable(channel, forwardvar_name);
|
||||
int forwardval = 70;
|
||||
const char *use_dialplan = dialplan, *use_context = context;
|
||||
|
||||
if (zstr(forwardvar)) {
|
||||
forwardvar_name = SWITCH_MAX_FORWARDS_VARIABLE; /* fall back to max_forwards variable for setting maximum */
|
||||
forwardvar = switch_channel_get_variable(channel, forwardvar_name);
|
||||
}
|
||||
if (!zstr(forwardvar)) {
|
||||
forwardval = atoi(forwardvar) - 1;
|
||||
}
|
||||
|
@ -1769,7 +1774,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
|
|||
}
|
||||
|
||||
max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
|
||||
switch_channel_set_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
|
||||
switch_channel_set_variable(channel, forwardvar_name, max_forwards);
|
||||
|
||||
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
|
||||
switch_channel_clear_flag(channel, CF_ORIGINATING);
|
||||
|
|
Loading…
Reference in New Issue