提交 628e1b4c authored 作者: Anthony Minessale's avatar Anthony Minessale

doh should probably expose say

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8343 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 7050c330
...@@ -756,7 +756,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se ...@@ -756,7 +756,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se
switch_bool_t dial_b, switch_bool_t exec_b, const char *app); switch_bool_t dial_b, switch_bool_t exec_b, const char *app);
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b); SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args);
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
/** @} */ /** @} */
......
...@@ -128,6 +128,23 @@ SWITCH_STANDARD_APP(exe_function) ...@@ -128,6 +128,23 @@ SWITCH_STANDARD_APP(exe_function)
} }
} }
#define SAY_SYNTAX "<module_name> <say_type> <say_method> <text>"
SWITCH_STANDARD_APP(say_function)
{
char *argv[4] = { 0 };
int argc;
char *lbuf = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
switch_ivr_say(session, argv[3], argv[0], argv[1], argv[2], NULL);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", SAY_SYNTAX);
}
}
#define SOFT_HOLD_SYNTAX "<unhold key> [<moh_a>] [<moh_b>]" #define SOFT_HOLD_SYNTAX "<unhold key> [<moh_a>] [<moh_b>]"
SWITCH_STANDARD_APP(soft_hold_function) SWITCH_STANDARD_APP(soft_hold_function)
{ {
...@@ -2012,6 +2029,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) ...@@ -2012,6 +2029,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE);
SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt); SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt);
......
...@@ -1668,6 +1668,21 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 ...@@ -1668,6 +1668,21 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3
stfu_n_destroy(&jb); stfu_n_destroy(&jb);
} }
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args)
{
switch_say_interface_t *si;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if ((si = switch_loadable_module_get_say_interface(module_name))) {
// should go back and proto all the say mods to const....
status = si->say_function(session, (char *)tosay, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
status = SWITCH_STATUS_FALSE;
}
return status;
}
/* For Emacs: /* For Emacs:
* Local Variables: * Local Variables:
......
...@@ -65,7 +65,7 @@ static char *SAY_TYPE_NAMES[] = { ...@@ -65,7 +65,7 @@ static char *SAY_TYPE_NAMES[] = {
NULL NULL
}; };
static switch_say_method_t get_say_method_by_name(char *name) SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name)
{ {
int x = 0; int x = 0;
for (x = 0; SAY_METHOD_NAMES[x]; x++) { for (x = 0; SAY_METHOD_NAMES[x]; x++) {
...@@ -77,7 +77,7 @@ static switch_say_method_t get_say_method_by_name(char *name) ...@@ -77,7 +77,7 @@ static switch_say_method_t get_say_method_by_name(char *name)
return (switch_say_method_t) x; return (switch_say_method_t) x;
} }
static switch_say_type_t get_say_type_by_name(char *name) SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name)
{ {
int x = 0; int x = 0;
for (x = 0; SAY_TYPE_NAMES[x]; x++) { for (x = 0; SAY_TYPE_NAMES[x]; x++) {
...@@ -286,7 +286,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s ...@@ -286,7 +286,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
char *say_type = (char *) switch_xml_attr_soft(action, "type"); char *say_type = (char *) switch_xml_attr_soft(action, "type");
char *say_method = (char *) switch_xml_attr_soft(action, "method"); char *say_method = (char *) switch_xml_attr_soft(action, "method");
status = si->say_function(session, odata, get_say_type_by_name(say_type), get_say_method_by_name(say_method), args); status = si->say_function(session, odata, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论