提交 9d22d76b authored 作者: Michael Jerris's avatar Michael Jerris

fix form MODLANG-13 from Matt brown, thanks Matt.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5041 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 c4eb29aa
...@@ -76,17 +76,19 @@ void SessionContainer::set_state(char *state) ...@@ -76,17 +76,19 @@ void SessionContainer::set_state(char *state)
int SessionContainer::play_file(char *file, char *timer_name) int SessionContainer::play_file(char *file, char *timer_name)
{ {
switch_status_t status; switch_status_t status;
switch_input_args_t args = { 0 };
if (switch_strlen_zero(timer_name)) { if (switch_strlen_zero(timer_name)) {
timer_name = NULL; timer_name = NULL;
} }
if (!dtmfCallbackFunction) { if (!dtmfCallbackFunction) {
status = switch_ivr_play_file(session, NULL, file, timer_name, NULL, NULL, 0); status = switch_ivr_play_file(session, NULL, file, &args);
} }
else { else {
globalDTMFCallbackFunction = dtmfCallbackFunction; globalDTMFCallbackFunction = dtmfCallbackFunction;
status = switch_ivr_play_file(session, NULL, file, timer_name, PythonDTMFCallback, NULL, 0); args.input_callback = PythonDTMFCallback;
status = switch_ivr_play_file(session, NULL, file, &args);
} }
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
...@@ -106,13 +108,19 @@ void SessionContainer::set_dtmf_callback(PyObject *pyfunc) ...@@ -106,13 +108,19 @@ void SessionContainer::set_dtmf_callback(PyObject *pyfunc)
int SessionContainer::speak_text(char *text) int SessionContainer::speak_text(char *text)
{ {
switch_status_t status; switch_status_t status;
switch_codec_t *codec;
switch_input_args_t args = { 0 };
codec = switch_core_session_get_read_codec(session);
if (!dtmfCallbackFunction) { if (!dtmfCallbackFunction) {
status = switch_ivr_speak_text(session, tts_name, voice_name, NULL, 0, NULL, text, NULL, 0); status = switch_ivr_speak_text(session, tts_name, voice_name,
codec->implementation->samples_per_second, text, &args);
} }
else { else {
globalDTMFCallbackFunction = dtmfCallbackFunction; globalDTMFCallbackFunction = dtmfCallbackFunction;
status = switch_ivr_speak_text(session, tts_name, voice_name, NULL, 0, PythonDTMFCallback, text, NULL, 0); args.input_callback = PythonDTMFCallback;
status = switch_ivr_speak_text(session, tts_name, voice_name,
codec->implementation->samples_per_second, text, &args);
} }
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
...@@ -151,3 +159,4 @@ int SessionContainer::play_and_get_digits(int min_digits, int max_digits, int ma ...@@ -151,3 +159,4 @@ int SessionContainer::play_and_get_digits(int min_digits, int max_digits, int ma
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论