Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
Created July 14, 2010 22:25
Show Gist options
  • Save chrismatthieu/476196 to your computer and use it in GitHub Desktop.
Save chrismatthieu/476196 to your computer and use it in GitHub Desktop.
Tropo Script:
mode = currentCall.getHeader("x-sbc-transfermode")
numbers = currentCall.getHeader("x-sbc-numbertodial").split(",")
if(mode == "one") {
for(number in numbers) {
result = transfer(number)
if(result.name = "success") {
break;
}
}
}
else {
transfer(numbers)
}
Log:
00328 00-1 10:23:29 PM Application[http://hosting.tropo.com/13539/www/findme.js:cuis] ver(1.0.43486) has been created.
00329 00-1 10:23:29 PM Found hosted Application[http://hosting.tropo.com/13539/www/findme.js:cuis] ver(1.0.43486) [uri=sip:9991443419@10.6.61.101:5060]
00330 00-1 10:23:29 PM Tropo(Hosting Edition) cached app=Application[http://hosting.tropo.com/13539/www/findme.js:cuis] ver(1.0.43486) for url=sip:9991443419@10.6.61.101:5060,_cache.size=1
00331 65c1 10:23:29 PM Thread udp/0.0.0.0/5060-t-4 acquired engine of type js, activeEngines = 3
00332 65c1 10:23:29 PM Thread udp/0.0.0.0/5060-t-4 got engine to compile script
00333 65c1 10:23:29 PM mode = currentCall.getHeader("x-sbc-transfermode") // line 922
00334 65c1 10:23:29 PM numbers = currentCall.getHeader("x-sbc-numbertodial").split(",") // line 923
00335 65c1 10:23:29 PM // line 924
00336 65c1 10:23:29 PM if(mode == "one") { // line 925
00337 65c1 10:23:29 PM for(number in numbers) { // line 926
00338 65c1 10:23:29 PM result = transfer(number) // line 927
00339 65c1 10:23:29 PM if(result.name = "success") { // line 928
00340 65c1 10:23:29 PM break; // line 929
00341 65c1 10:23:29 PM } // line 930
00342 65c1 10:23:29 PM } // line 931
00343 65c1 10:23:29 PM } // line 932
00344 65c1 10:23:29 PM else { // line 933
00345 65c1 10:23:29 PM transfer(numbers) // line 934
00346 65c1 10:23:29 PM } // line 935
00347 65c1 10:23:29 PM Thread udp/0.0.0.0/5060-t-4 returning engine after compiling script
00348 65c1 10:23:29 PM Thread udp/0.0.0.0/5060-t-4 returned engine of type js, activeEngines = 2
00349 65c1 10:23:29 PM ApplicationInstance[http://hosting.tropo.com/13539/www/findme.js, sas_2-15-sm1qfivuztkeuuwtropo] has been created.
00350 65c1 10:23:29 PM com.voxeo.tropo.core.SimpleCallFactory@752ed2 is added into the context of app instance : ApplicationInstance[http://hosting.tropo.com/13539/www/findme.js, sas_2-15-sm1qfivuztkeuuwtropo]
00351 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419] state is changed: null->RINGING
00352 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419]->got INVITE: [INVITE sip:9991443419@10.6.69.203:5060 SIP/2.0 Content-Type: application/sdp To: <sip:9991443419@10.6.61.101:5060> x-sbc-from: <sip:8723cafe-a323-4d5e-bbc7-01a910bf46f9@gw112.phono.com>;tag=8q17thdrbwym Via: SIP/2.0/UDP 216.22.104.161:5060;received=10.6.63.108 x-voxeo-sbc-name: 10.6.63.108 x-sbc-contact: <sip:199.230.57.112:5060;transport=udp> x-voxeo-sbc: true Call-ID: 0-13c4-4c3e38e0-385f2700-5b4e-1d001030 From: <sip:8723cafe-a323-4d5e-bbc7-01a910bf46f9@10.6.63.108:5060>;tag=0-13c4-4c3e38e0-385f2700-6765 x-voxeo-to: <sip:9991443419@sbcexternal.orl.voxeo.net> Contact: <sip:8723cafe-a323-4d5e-bbc7-01a910bf46f9@10.6.63.108:5060> x-sbc-numbertodial: sip:d1d125a4-45fb-4efd-bc0b-050bf6837259@gw112.phono.com,14803194368,14802191300,14808931904,sip:chrismatthieu@sip2sip.info x-sbc-request-uri: sip:9991443419@sbcexternal.orl.voxeo.net x-sbc-call-id: 2y0kn7sqn0b5 x-sid: 37560a3bab5d4caf441d2e354f0c65c1 CSeq: 2 INVITE x-sbc-cseq: 1 INVITE Content-Length: 247 x-sbc-max-forwards: 70 x-voxeo-sbc-session-id: 37560a3bab5d4caf441d2e354f0c65c1 x-sbc-transfermode: all x-sbc-to: <sip:9991443419@sbcexternal.orl.voxeo.net> v=0 o=voxeo.8.0.307.0 0 0 IN IP4 10.6.63.108 s=voxeo c=IN IP4 10.6.63.108 t=0 0
00353 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419] is received.
00354 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419] is added into the context
00355 65c1 10:23:29 PM ApplicationInstance[http://hosting.tropo.com/13539/www/findme.js, sas_2-15-sm1qfivuztkeuuwtropo] starts execution on Thread Script
00356 65c1 10:23:29 PM Thread Script acquired engine of type js, activeEngines = 3
00357 65c1 10:23:29 PM ApplicationInstance[http://hosting.tropo.com/13539/www/findme.js, sas_2-15-sm1qfivuztkeuuwtropo] replaced script engine [com.sun.phobos.script.javascript.RhinoScriptEngine@1956d7d] --> [com.sun.phobos.script.javascript.RhinoScriptEngine@1956d7d] in field <engine>
00358 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419] : currentCall is assigned to incoming Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419]
00359 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419]->transfer([sip:d1d125a4-45fb-4efd-bc0b-050bf6837259@gw112.phono.com, 14803194368, 14802191300, 14808931904, sip:chrismatthieu@sip2sip.info]) [from:null,timeout:30000,ttsOrUrl:null,grammar:null,termChar:null,repeat:1,answerOnMedia:false]
00360 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419] : JavaException: com.voxeo.tropo.core.NotAnsweredException: RINGING
00361 65c1 10:23:29 PM ApplicationInstance[http://hosting.tropo.com/13539/www/findme.js, sas_2-15-sm1qfivuztkeuuwtropo] has runtime errors: org.mozilla.javascript.JavaScriptException: com.voxeo.tropo.core.NotAnsweredException: RINGING (<Unknown Source>#473) in <Unknown Source> at line number 473 at line #473 with cause: org.mozilla.javascript.JavaScriptException: com.voxeo.tropo.core.NotAnsweredException: RINGING (<Unknown Source>#473) com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.JavaScriptException: com.voxeo.tropo.core.NotAnsweredException: RINGING (<Unknown Source>#473) in <Unknown Source> at line number 473 at com.sun.phobos.script.javascript.RhinoCompiledScript.eval(RhinoCompiledScript.java:64) at com.voxeo.tropo.app.SimpleInstance.run(SimpleInstance.java:207) ...
00362 65c1 10:23:29 PM Thread Script returned engine of type js, activeEngines = 2
00363 65c1 10:23:29 PM Hanging up call [id=92119ddbdde7486a45f0907af4d6540c]
00364 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419]->hangup(), headers ={}
00365 65c1 10:23:29 PM Call[8723cafe-a323-4d5e-bbc7-01a910bf46f9->9991443419] state is changed: RINGING->DISCONNECTED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment