Author: greenlizard Date: Tue Jun 5 15:29:34 2007 New Revision: 5272 Modified: freeswitch/branches/greenlizard/scripts/mytest.py freeswitch/branches/greenlizard/src/mod/languages/mod_python/Makefile Log: update the mytest.py to match recent changes, checkin trunk version of Makefile Modified: freeswitch/branches/greenlizard/scripts/mytest.py ============================================================================== --- freeswitch/branches/greenlizard/scripts/mytest.py (original) +++ freeswitch/branches/greenlizard/scripts/mytest.py Tue Jun 5 15:29:34 2007 @@ -1,32 +1,44 @@ - -# WARNING: May be out of date, please see +# Please see latest version of this script at # http://wiki.freeswitch.org/wiki/Mod_python # before reporting errors 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 + +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","test from my python program\n") session.answer() -session.setDTMFCallback(onDTMF) +session.setDTMFCallback(onDTMF, "") session.set_tts_parms("cepstral", "david") -session.playFile("/root/test.gsm", "") +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 "+ input +"\n") +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 "+ phone_number +"\n") + +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/src/mod/languages/mod_python/Makefile ============================================================================== --- freeswitch/branches/greenlizard/src/mod/languages/mod_python/Makefile (original) +++ freeswitch/branches/greenlizard/src/mod/languages/mod_python/Makefile Tue Jun 5 15:29:34 2007 @@ -3,8 +3,8 @@ # and define these variables to impact your build -LOCAL_CFLAGS=-I$(PREFIX)/include/python2.5/ -LOCAL_LDFLAGS=-lpython2.5 -L$(PREFIX)/lib/python2.5/config/ -lutil -lstdc++ +LOCAL_CFLAGS=-I/usr/include/python2.4/ +LOCAL_LDFLAGS=-lpython2.4 -L/usr/lib/python2.4/config/ -lutil -lstdc++ LOCAL_OBJS=freeswitch_python.o mod_python_wrap.o include ../../../../build/modmake.rules @@ -13,17 +13,20 @@ SWIGCFILE=../../../switch_swig.c SWIGIFILE=../../../switch_swig.i -local_depend: -MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install Python-2.5.1.tgz --prefix=$(PREFIX) --enable-threads CFLAGSFORSHARED="-fPIC" +#local_depend: +# MAKE=$(MAKE) PY_CFLAGS=-fPIC $(BASE)/build/buildlib.sh $(BASE) install Python-2.4.3.tgz --prefix=$(PREFIX) --enable-threads reswig: -swig -python -shadow -c++ -o mod_python_wrap.cpp mod_python.i + swig -python -shadow -c++ -I../../../../src/include -o mod_python_wrap.cpp mod_python.i switch_swig_wrap.o: switch_swig_wrap.c Makefile -$(CC) -w $(CFLAGS) -c $< -o $@ + $(CC) -w $(CFLAGS) -c $< -o $@ switch_swig.o: $(SWIGCFILE) Makefile -$(CC) -w $(CFLAGS) -c $< -o $@ + $(CC) -w $(CFLAGS) -c $< -o $@ local_install: -cp -f freeswitch.py $(PREFIX)/lib/python2.5/site-packages/ + cp -f freeswitch.py /usr/lib/python2.4/site-packages/ + + +