/
tropo_11270_transferTest.py
36 lines (26 loc) · 1.21 KB
/
tropo_11270_transferTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# tests fix of gh-14 for "from" parameter in the "transfer" function.
# Proposed convention is to use "_from" as the parameter
# so as not to conflict with "from" Python reserved word.
# _from arg works
# _from arg works with straight json
# Invoke by calling up app access number
# Sample application using the itty-bitty python web framework from:
# http://github.com/toastdriven/itty
import sys
sys.path = ['..'] + sys.path
from itty import *
from tropo import Tropo, Session, On
TO_NUMBER = 'sip:frank@172.16.22.128:5678'
FROM_NUMBER = 'sip:xiangjun_yu@192.168.26.1:5678'
@post('/index.json')
def index(request):
t = Tropo()
t.call("sip:xiangjun_yu@192.168.26.1:5678", say = "ha ha ha ha ha ah ah ah ah")
t.say("a b c d e f g h i j k")
on = On("connect", say = "emily", next = "http://freewavesamples.com/files/Kawai-K5000W-AddSquare-C4.wav", post = "http://192.168.26.88:8080/FileUpload/receiveJson").json
t.transfer(TO_NUMBER, _from= FROM_NUMBER, on=on, callbackUrl="http://192.168.26.88:8080/FileUpload/receiveJson", label="erthnbvc")
t.say("Hi. I am a robot q a z w s x e d c")
json = t.RenderJson()
print json
return json
run_itty(server='wsgiref', host='192.168.26.1', port=8084)