SWITCH_DECLARE(void) switch_core_port_allocator_destroy(_Inout_ switch_core_port_allocator_t **alloc);
///\}
+
+SWITCH_DECLARE(int) switch_core_test_flag(int flag);
+
///\defgroup ss Startup/Shutdown
///\ingroup core1
///\{
SCF_THREADED_SYSTEM_EXEC = (1 << 18),
SCF_SYNC_CLOCK_REQUESTED = (1 << 19),
SCF_CORE_ODBC_REQ = (1 << 20),
- SCF_DEBUG_SQL = (1 << 21)
+ SCF_DEBUG_SQL = (1 << 21),
+ SCF_API_EXPANSION = (1 << 22)
} switch_core_flag_enum_t;
typedef uint32_t switch_core_flag_t;
SCSC_SYNC_CLOCK_WHEN_IDLE,
SCSC_DEBUG_SQL,
SCSC_SQL,
+ SCSC_API_EXPANSION
} switch_session_ctl_t;
typedef enum {
switch_core_session_ctl(SCSC_VERBOSE_EVENTS, &arg);
stream->write_function(stream, "+OK verbose_events is %s \n", arg ? "on" : "off");
+ } else if (!strcasecmp(argv[0], "api_expansion")) {
+ arg = -1;
+ if (argv[1]) {
+ arg = switch_true(argv[1]);
+ }
+
+ switch_core_session_ctl(SCSC_API_EXPANSION, &arg);
+
+ stream->write_function(stream, "+OK api_expansion is %s \n", arg ? "on" : "off");
} else if (!strcasecmp(argv[0], "threaded_system_exec")) {
arg = -1;
if (argv[1]) {
#include <switch.h>
#include <switch_channel.h>
+
struct switch_cause_table {
const char *name;
switch_call_cause_t cause;
if ((sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) {
if (var_list && !switch_event_check_permission_list(var_list, vname)) {
- sub_val = "INVALID";
+ sub_val = "<Variable Expansion Permission Denied>";
}
if ((expanded_sub_val = switch_channel_expand_variables_check(channel, sub_val, var_list, api_list, recur+1)) == sub_val) {
vval = expanded;
}
- if (api_list && !switch_event_check_permission_list(api_list, vname)) {
- func_val = "INVALID";
- sub_val = "INVALID";
+ if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) {
+ func_val = NULL;
+ sub_val = "<API Execute Permission Denied>";
} else {
if (switch_api_execute(vname, vval, channel->session, &stream) == SWITCH_STATUS_SUCCESS) {
func_val = stream.data;
}
+SWITCH_DECLARE(int) switch_core_test_flag(int flag)
+{
+ return switch_test_flag((&runtime), flag);
+}
+
+
SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
{
switch_uuid_t uuid;
switch_set_flag((&runtime.dummy_cng_frame), SFF_CNG);
switch_set_flag((&runtime), SCF_AUTO_SCHEMAS);
switch_set_flag((&runtime), SCF_CLEAR_SQL);
+ switch_set_flag((&runtime), SCF_API_EXPANSION);
#ifdef WIN32
switch_set_flag((&runtime), SCF_THREADED_SYSTEM_EXEC);
#endif
} else {
switch_clear_flag((&runtime), SCF_CLEAR_SQL);
}
+ } else if (!strcasecmp(var, "api-expansion")) {
+ if (switch_true(val)) {
+ switch_set_flag((&runtime), SCF_API_EXPANSION);
+ } else {
+ switch_clear_flag((&runtime), SCF_API_EXPANSION);
+ }
} else if (!strcasecmp(var, "enable-early-hangup") && switch_true(val)) {
switch_set_flag((&runtime), SCF_EARLY_HANGUP);
} else if (!strcasecmp(var, "colorize-console") && switch_true(val)) {
newintval = switch_test_flag((&runtime), SCF_VERBOSE_EVENTS);
}
break;
+ case SCSC_API_EXPANSION:
+ if (intval) {
+ if (oldintval > -1) {
+ if (oldintval) {
+ switch_set_flag((&runtime), SCF_API_EXPANSION);
+ } else {
+ switch_clear_flag((&runtime), SCF_API_EXPANSION);
+ }
+ }
+ newintval = switch_test_flag((&runtime), SCF_API_EXPANSION);
+ }
+ break;
case SCSC_THREADED_SYSTEM_EXEC:
if (intval) {
if (oldintval > -1) {
#include <switch.h>
#include <switch_event.h>
+
//#define SWITCH_EVENT_RECYCLE
#define DISPATCH_QUEUE_LEN 100
//#define DEBUG_DISPATCH_QUEUES
}
if (var_list && !switch_event_check_permission_list(var_list, vname)) {
- sub_val = "INVALID";
+ sub_val = "<Variable Expansion Permission Denied>";
}
vval = expanded;
}
- if (api_list && !switch_event_check_permission_list(api_list, vname)) {
- func_val = "INVALID";
- sub_val = "INVALID";
+ if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) {
+ func_val = NULL;
+ sub_val = "<API execute Permission Denied>";
} else {
if (switch_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
func_val = stream.data;