Author: greenlizard Date: Thu Jun 14 13:05:19 2007 New Revision: 5362 Modified: freeswitch/branches/greenlizard/scripts/mytest.py freeswitch/branches/greenlizard/scripts/socket/sock.pl Log: update example after changes for MODLANG-33 and MODLANG-34 Modified: freeswitch/branches/greenlizard/scripts/mytest.py ============================================================================== --- freeswitch/branches/greenlizard/scripts/mytest.py (original) +++ freeswitch/branches/greenlizard/scripts/mytest.py Thu Jun 14 13:05:19 2007 @@ -3,42 +3,37 @@ # before reporting errors import sys, time +from freeswitch import * def onDTMF(input, itype, funcargs): - console_log("1","\n\nonDTMF input: %s\n" % input) - if input == "5": - return "pause" - if input == "3": - return "seek:+60000" - if input == "1": - return "seek:-60000" - if input == "4": - return "seek:-120000" - if input == "6": - return "seek:+120000" - if input == "7": - return "seek:-360000" - if input == "9": - return "seek:+360000" - if input == "0": - return "stop" - return None # will make the streamfile audio stop + console_log("1","\n\nonDTMF input: %s\n" % input) + if input == "5": + return "pause" + if input == "3": + return "seek:+60000" + if input == "1": + return "seek:-60000" + if input == "0": + return "stop" + return None # will make the streamfile audio stop -console_log("1","test from my python program\n") -session.answer() -session.setDTMFCallback(onDTMF, "") -session.set_tts_parms("cepstral", "david") -session.playFile("/pub/music/Bob Marley - exodus.mp3", "") -session.speakText("Please enter telephone number with area code and press pound sign. ") -input = session.getDigits("", 11, "*#", "#", 10000) -console_log("1","result from get digits is %s\n" % input) -phone_number = session.playAndGetDigits(5, 11, 3, 10000, "*#", - "/sounds/test.gsm", - "/sounds/invalid.gsm", - "", - "^17771112222$"); +def handler(uuid): -console_log("1","result from play_and_get_digits is %s\n" % phone_number) -session.transfer("1000", "XML", "default") -session.hangup("1") + console_log("1","... test from my python program\n") + session = PySession(uuid) + session.answer() + session.setDTMFCallback(onDTMF, "") + session.set_tts_parms("cepstral", "david") + session.playFile("/path/to/your.mp3", "") + session.speak("Please enter telephone number with area code and press pound sign. ") + input = session.getDigits("", 11, "*#", "#", 10000) + console_log("1","result from get digits is %s\n" % input) + phone_number = session.playAndGetDigits(5, 11, 3, 10000, "*#", + "/sounds/test.gsm", + "/sounds/invalid.gsm", + "", + "^17771112222$"); + console_log("1","result from play_and_get_digits is %s\n" % phone_number) + session.transfer("1000", "XML", "default") + session.hangup("1") Modified: freeswitch/branches/greenlizard/scripts/socket/sock.pl ============================================================================== --- freeswitch/branches/greenlizard/scripts/socket/sock.pl (original) +++ freeswitch/branches/greenlizard/scripts/socket/sock.pl Thu Jun 14 13:05:19 2007 @@ -22,7 +22,7 @@ $o = $fs->call_command("answer"); #to turn on events when in async mode #$o = $fs->raw_command("myevents"); -$o = $fs->call_command("playback", "/ram/swimp.raw"); +$o = $fs->call_command("playback", "/pub/music/wakeup/greed.wav"); $o = $fs->call_command("hangup"); #comment exit in async mode