Author: jih
Date: 2009-12-04 19:29:51 +0100 (Fri, 04 Dec 2009)
New Revision: 1622

Modified:
   trunk/apps/examples/ivr_examples/tmpfile.py
Log:
* Fixed the example by replacing variable wav with self.wav.
* Added onEmptyQueue method that end the call after file has been played.


Modified: trunk/apps/examples/ivr_examples/tmpfile.py
===================================================================
--- trunk/apps/examples/ivr_examples/tmpfile.py 2009-12-02 16:09:15 UTC (rev 
1621)
+++ trunk/apps/examples/ivr_examples/tmpfile.py 2009-12-04 18:29:51 UTC (rev 
1622)
@@ -4,15 +4,26 @@
 from log import *
 from ivr import *
 import os
+
 class IvrDialog(IvrDialogBase):
 
        def onSessionStart(self, hdrs):
-               f = open("wav/default_en.wav")
+
+               info("starting tmpfile.py")
+               f = open("/tmp/default_en.wav")
                audio = f.read()
-               debug("Found audio file of length " + str(len(audio)))
                fp = os.tmpfile()
                fp.write(audio)
                fp.seek(0)
-               wav = IvrAudioFile()
-               wav.fpopen("tmp.wav", AUDIO_READ, fp)
-               self.enqueue(wav, None)
+               self.wav = IvrAudioFile()
+               self.wav.fpopen("tmp.wav", AUDIO_READ, fp)
+               self.enqueue(self.wav, None)
+               return
+
+       def onEmptyQueue(self):
+
+               if not self.queueIsEmpty():
+                       return
+               self.bye()
+               self.stopSession()
+               return

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to