forked from Mirrors/freeswitch
recursion protection
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5040 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
5a8bb14259
commit
c4eb29aa8f
@ -127,6 +127,7 @@ struct switch_core_session {
|
|||||||
switch_thread_rwlock_t *bug_rwlock;
|
switch_thread_rwlock_t *bug_rwlock;
|
||||||
switch_media_bug_t *bugs;
|
switch_media_bug_t *bugs;
|
||||||
switch_app_log_t *app_log;
|
switch_app_log_t *app_log;
|
||||||
|
uint32_t stack_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct switch_media_bug {
|
struct switch_media_bug {
|
||||||
|
@ -229,6 +229,7 @@ struct switch_directories {
|
|||||||
typedef struct switch_directories switch_directories;
|
typedef struct switch_directories switch_directories;
|
||||||
SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
||||||
|
|
||||||
|
#define SWITCH_MAX_STACKS 32
|
||||||
#define SWITCH_THREAD_STACKSIZE 240 * 1024
|
#define SWITCH_THREAD_STACKSIZE 240 * 1024
|
||||||
#define SWITCH_RECOMMENDED_BUFFER_SIZE 3968
|
#define SWITCH_RECOMMENDED_BUFFER_SIZE 3968
|
||||||
#define SWITCH_MAX_CODECS 30
|
#define SWITCH_MAX_CODECS 30
|
||||||
|
@ -921,13 +921,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se
|
|||||||
switch_caller_extension_t *extension = NULL;
|
switch_caller_extension_t *extension = NULL;
|
||||||
const switch_application_interface_t *application_interface;
|
const switch_application_interface_t *application_interface;
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
if (!(profile = switch_channel_get_caller_profile(channel))) {
|
if (!(profile = switch_channel_get_caller_profile(channel))) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (session->stack_count > SWITCH_MAX_STACKS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s too many stacked extensions\n", switch_channel_get_name(session->channel));
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
session->stack_count++;
|
||||||
|
|
||||||
new_profile = switch_caller_profile_clone(session, profile);
|
new_profile = switch_caller_profile_clone(session, profile);
|
||||||
new_profile->destination_number = switch_core_session_strdup(session, exten);
|
new_profile->destination_number = switch_core_session_strdup(session, exten);
|
||||||
|
|
||||||
@ -965,7 +973,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!extension) {
|
if (!extension) {
|
||||||
return SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_profile->caller_extension = extension;
|
new_profile->caller_extension = extension;
|
||||||
@ -983,18 +992,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se
|
|||||||
extension->current_application->application_name, switch_str_nil(extension->current_application->application_data));
|
extension->current_application->application_name, switch_str_nil(extension->current_application->application_data));
|
||||||
if ((application_interface = switch_loadable_module_get_application_interface(extension->current_application->application_name)) == 0) {
|
if ((application_interface = switch_loadable_module_get_application_interface(extension->current_application->application_name)) == 0) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", extension->current_application->application_name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", extension->current_application->application_name);
|
||||||
return SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_channel_test_flag(session->channel, CF_NOMEDIA) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
|
if (switch_channel_test_flag(session->channel, CF_NOMEDIA) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Cannot be used with NO_MEDIA mode!\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Cannot be used with NO_MEDIA mode!\n",
|
||||||
extension->current_application->application_name);
|
extension->current_application->application_name);
|
||||||
return SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!application_interface->application_function) {
|
if (!application_interface->application_function) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", extension->current_application->application_name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", extension->current_application->application_name);
|
||||||
return SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((expanded =
|
if ((expanded =
|
||||||
@ -1030,7 +1042,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se
|
|||||||
extension->current_application = extension->current_application->next;
|
extension->current_application = extension->current_application->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
done:
|
||||||
|
|
||||||
|
session->stack_count--;
|
||||||
|
|
||||||
|
return status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user