[Freeswitch-svn] [commit] r5041 - freeswitch/trunk/src/mod/languages/mod_python

Freeswitch SVN mikej at freeswitch.org
Sun Apr 29 12:34:01 EDT 2007


Author: mikej
Date: Sun Apr 29 12:34:00 2007
New Revision: 5041

Modified:
   freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp

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

Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp	Sun Apr 29 12:34:00 2007
@@ -76,17 +76,19 @@
 int SessionContainer::play_file(char *file, char *timer_name)
 {
     switch_status_t status;
+    switch_input_args_t args = { 0 };
 
     if (switch_strlen_zero(timer_name)) {
         timer_name = NULL;
     }
 
     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 {
         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;
@@ -106,13 +108,19 @@
 int SessionContainer::speak_text(char *text)
 {
     switch_status_t status;
+    switch_codec_t *codec;
+    switch_input_args_t args = { 0 };
 
+    codec = switch_core_session_get_read_codec(session);
     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 {
         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;
@@ -151,3 +159,4 @@
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
+



More information about the Freeswitch-svn mailing list