From: Ken Date: Wed, 3 Nov 2021 13:14:25 +0000 (-0500) Subject: [mod_dptools] Implement disable_system_app_commands global variable to make system... X-Git-Tag: v1.10.8^2~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2a7891f14d9ad7390c8c27a2a0cd6b515b5d4ff;p=thirdparty%2Ffreeswitch.git [mod_dptools] Implement disable_system_app_commands global variable to make system and bgsystem dialplan apps disabled at run time. adds a check on startup for global variable disable_system_app_commands. if the global variable is set to true, the system and bgsystem dialplan apps will not have their app_interface loaded via SWITCH_ADD_APP() leaving them effectively disabled at run time. --- diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index d755640c35..b9ef0708d8 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -6427,6 +6427,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) switch_dialplan_interface_t *dp_interface; switch_chat_interface_t *chat_interface; switch_file_interface_t *file_interface; + int use_system_commands = 1; + + if (switch_true(switch_core_get_variable("disable_system_app_commands"))) { + use_system_commands = 0; + } if (switch_event_reserve_subclass(FILE_STRING_CLOSE) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", FILE_STRING_CLOSE); @@ -6704,10 +6709,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SAF_NONE); SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "", SAF_SUPPORT_NOMEDIA|SAF_SUPPORT_TEXT_ONLY); - SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "", - SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); - SWITCH_ADD_APP(app_interface, "bgsystem", "Execute a system command in the background", "Execute a background system command", bgsystem_session_function, "", - SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); + if (use_system_commands) { + SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "", + SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); + SWITCH_ADD_APP(app_interface, "bgsystem", "Execute a system command in the background", "Execute a background system command", bgsystem_session_function, "", + SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); + } SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE); SWITCH_ADD_APP(app_interface, "detect_audio", "detect_audio", "detect_audio", detect_audio_function, DETECT_AUDIO_SYNTAX,