From f0573f0607991239159847daef4fa0b3d2cc13cd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Jun 2007 15:56:06 +0000 Subject: [PATCH] update sample script from branchcut to match current api, thanks\! git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5240 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- scripts/mytest.py | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/scripts/mytest.py b/scripts/mytest.py index c5a45e5cf3..a836304c2d 100644 --- a/scripts/mytest.py +++ b/scripts/mytest.py @@ -1,18 +1,26 @@ -import sys -from _freeswitch import * - -print "Hello World" -print sys.path -print dir() -print sys.argv - -uuid = sys.argv[0] -fs_consol_log("1","test from my python program\n") -fs_consol_clean("This is fs_consol_clean\n") -fs_consol_clean("My uuid is " + uuid + "\n") - -session = fs_core_session_locate(uuid) - -fs_channel_answer(session) - -fs_switch_ivr_session_transfer(session, "1234", "XML", "default") +import sys, time +def onDTMF(input, itype, buf, buflen): + print "input=",input + print "itype=",itype + print "buf=",buf + print "buflen",buflen + if input == "#": + return 1 + else: + return 0 +console_log("1","test from my python program\n") +session.answer() +session.set_dtmf_callback(onDTMF) +session.set_tts_parms("cepstral", "david") +session.play_file("/root/test.gsm", "") +session.speak_text("Please enter telephone number with area code and press pound sign. ") +input = session.get_digits("", 11, "*#", 10000) +console_log("1","result from get digits is "+ input +"\n") +phone_number = session.play_and_get_digits(5, 11, 3, 10000, "*#", + "/sounds/test.gsm", + "/sounds/invalid.gsm", + "", + "^17771112222$"); +console_log("1","result from play_and_get_digits is "+ phone_number +"\n") +session.transfer("1000", "XML", "default") +session.hangup("1")