diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index c38528d834..c4e8203293 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -37,9 +37,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load); SWITCH_MODULE_DEFINITION(mod_dptools, mod_dptools_load, NULL, NULL); -static switch_application_interface_t detect_speech_application_interface; -static switch_application_interface_t exe_application_interface; - +#define DETECT_SPEECH_SYNTAX " [] OR grammar [] OR pause OR resume" static void detect_speech_function(switch_core_session_t *session, char *data) { char *argv[4]; @@ -62,11 +60,12 @@ static void detect_speech_function(switch_core_session_t *session, char *data) switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", detect_speech_application_interface.syntax); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", DETECT_SPEECH_SYNTAX); } } +#define EXE_SYNTAX " " static void exe_function(switch_core_session_t *session, char *data) { char *argv[4]; @@ -83,7 +82,7 @@ static void exe_function(switch_core_session_t *session, char *data) context = argv[2]; switch_core_session_execute_exten(session, extension, dialplan, context); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", exe_application_interface.syntax); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", EXE_SYNTAX); } } @@ -651,7 +650,7 @@ static void ivr_application_function(switch_core_session_t *session, char *data) } -static void dtm_session_function(switch_core_session_t *session, char *data) +static void dtmf_session_function(switch_core_session_t *session, char *data) { switch_ivr_inband_dtmf_session(session); } @@ -1046,470 +1045,73 @@ static void audio_bridge_function(switch_core_session_t *session, char *data) } } -static switch_api_interface_t strepoch_api_interface = { - /*.interface_name */ "strepoch", - /*.desc */ "Convert a date string into epoch time", - /*.function */ strepoch_api_function, - /*.syntax */ "", - /*.next */ NULL -}; - -static switch_api_interface_t chat_api_interface = { - /*.interface_name */ "chat", - /*.desc */ "chat", - /*.function */ chat_api_function, - /*.syntax */ "|||", - /*.next */ &strepoch_api_interface -}; - -static switch_api_interface_t dptools_api_interface = { - /*.interface_name */ "strftime", - /*.desc */ "strftime", - /*.function */ strftime_api_function, - /*.syntax */ "", - /*.next */ &chat_api_interface -}; - -static switch_api_interface_t presence_api_interface = { - /*.interface_name */ "presence", - /*.desc */ "presence", - /*.function */ presence_api_function, - /*.syntax */ " ", - /*.next */ &dptools_api_interface -}; - -static switch_application_interface_t system_application_interface = { - /*.interface_name */ "system", - /*.application_function */ system_session_function, - /* long_desc */ "Execute a system command", - /* short_desc */ "Execute a system command", - /* syntax */ "", - /* flags */ SAF_NONE, - /*.next */ NULL -}; - -static switch_application_interface_t bridge_application_interface = { - /*.interface_name */ "bridge", - /*.application_function */ audio_bridge_function, - /* long_desc */ "Bridge the audio between two sessions", - /* short_desc */ "Bridge Audio", - /* syntax */ "", - /* flags */ SAF_SUPPORT_NOMEDIA, - /* next */ &system_application_interface -}; - -static switch_application_interface_t speak_application_interface = { - /*.interface_name */ "speak", - /*.application_function */ speak_function, - /* long_desc */ "Speak text to a channel via the tts interface", - /* short_desc */ "Speak text", - /* syntax */ "||", - /* flags */ SAF_NONE, - &bridge_application_interface -}; - -static switch_application_interface_t displace_application_interface = { - /*.interface_name */ "displace_session", - /*.application_function */ displace_session_function, - /* long_desc */ "Displace audio from a file to the channels input", - /* short_desc */ "Displace File", - /* syntax */ " [+time_limit_ms] [mux]", - /* flags */ SAF_NONE, - &speak_application_interface -}; - -static switch_application_interface_t stop_displace_application_interface = { - /*.interface_name */ "stop_displace_session", - /*.application_function */ stop_displace_session_function, - /* long_desc */ "Stop Displacing to a file", - /* short_desc */ "Stop Displace File", - /* syntax */ "", - /* flags */ SAF_NONE, - &displace_application_interface -}; - -static switch_application_interface_t record_application_interface = { - /*.interface_name */ "record", - /*.application_function */ record_function, - /* long_desc */ "Record a file from the channels input", - /* short_desc */ "Record File", - /* syntax */ " [+time_limit_ms]", - /* flags */ SAF_NONE, - &stop_displace_application_interface -}; - - -static switch_application_interface_t record_session_application_interface = { - /*.interface_name */ "record_session", - /*.application_function */ record_session_function, - /* long_desc */ "Starts a background recording of the entire session", - /* short_desc */ "Record Session", - /* syntax */ "", - /* flags */ SAF_NONE, - &record_application_interface -}; - - -static switch_application_interface_t stop_record_session_application_interface = { - /*.interface_name */ "stop_record_session", - /*.application_function */ stop_record_session_function, - /* long_desc */ "Stops a background recording of the entire session", - /* short_desc */ "Stop Record Session", - /* syntax */ "", - /* flags */ SAF_NONE, - &record_session_application_interface -}; - -static switch_application_interface_t playback_application_interface = { - /*.interface_name */ "playback", - /*.application_function */ playback_function, - /* long_desc */ "Playback a file to the channel", - /* short_desc */ "Playback File", - /* syntax */ "", - /* flags */ SAF_NONE, - /*.next */ &stop_record_session_application_interface -}; - -static switch_application_interface_t gentones_application_interface = { - /*.interface_name */ "gentones", - /*.application_function */ gentones_function, - /* long_desc */ "Generate tones to the channel", - /* short_desc */ "Generate Tones", - /* syntax */ "[|]", - /* flags */ SAF_NONE, - /*.next */ &playback_application_interface -}; - -static switch_application_interface_t park_application_interface = { - /*.interface_name */ "park", - /*.application_function */ park_function, - /* long_desc */ NULL, - /* short_desc */ NULL, - /* syntax */ NULL, - /* flags */ SAF_NONE, - /*.next */ &gentones_application_interface -}; - -static switch_application_interface_t echo_application_interface = { - /*.interface_name */ "echo", - /*.application_function */ echo_function, - /* long_desc */ "Perform an echo test against the calling channel", - /* short_desc */ "Echo", - /* syntax */ "", - /* flags */ SAF_NONE, - /*.next */ &park_application_interface -}; - - -static switch_application_interface_t tone_detect_application_interface = { - /*.interface_name */ "tone_detect", - /*.application_function */ tone_detect_session_function, - /* long_desc */ "Detect tones", - /* short_desc */ "Detect tones", - /* syntax */ "", - /* flags */ SAF_NONE, - /*.next */ &echo_application_interface -}; - -static switch_application_interface_t fax_detect_application_interface = { - /*.interface_name */ "fax_detect", - /*.application_function */ fax_detect_session_function, - /* long_desc */ "Detect fax send tone", - /* short_desc */ "Detect faxes", - /* syntax */ "", - /* flags */ SAF_NONE, - /*.next */ &tone_detect_application_interface -}; - -static switch_application_interface_t stop_tone_detect_application_interface = { - /*.interface_name */ "stop_tone_detect", - /*.application_function */ stop_fax_detect_session_function, - /* long_desc */ "Stop detecting tones", - /* short_desc */ "stop detecting tones", - /* syntax */ "", - /* flags */ SAF_NONE, - /* next */ &fax_detect_application_interface -}; - -static switch_application_interface_t dtmf_application_interface = { - /*.interface_name */ "start_dtmf", - /*.application_function */ dtm_session_function, - /* long_desc */ "Detect inband dtmf on the session", - /* short_desc */ "Detect dtmf", - /* syntax */ "", - /* flags */ SAF_NONE, - /* next */ &stop_tone_detect_application_interface -}; - -static switch_application_interface_t stop_dtmf_application_interface = { - /*.interface_name */ "stop_dtmf", - /*.application_function */ stop_dtmf_session_function, - /* long_desc */ "Stop detecting inband dtmf.", - /* short_desc */ "stop inband dtmf.", - /* syntax */ "", - /* flags */ SAF_NONE, - &dtmf_application_interface -}; - -static switch_application_interface_t exe_application_interface = { - /*.interface_name */ "execute_extension", - /*.application_function */ exe_function, - /*.long_desc */ "Execute an extension", - /*.short_desc */ "Execute an extension", - /*.syntax */ " ", - /* flags */ SAF_SUPPORT_NOMEDIA, - /*.next */ &stop_dtmf_application_interface -}; - -static switch_application_interface_t sched_transfer_application_interface = { - /*.interface_name */ "sched_transfer", - /*.application_function */ sched_transfer_function, - /*.long_desc */ "Schedule a transfer in the future", - /*.short_desc */ "Schedule a transfer in the future", - /*.syntax */ "[+]