* especially good for games (like touch tone tanks)!
call in /controller.xml?From=555-501-1337&Digits=9
press 9 /digits.xml?From=555-501-1337&Digits=9
press 2 /digits.xml?From=555-501-1337&Digits=2
hang up /digits.xml?From=555-501-1337&CallStatus=completed
controller.xml and digits.xml are POSTed to by Twilio. This is important, because some servers refuse to serve files that are POSTed to :|
Twilio adds parameters when it hits asks for those files, which is how the server finds out about keypresses and new connections. The server then sends this information to whatever browser window you have open.
If you buy a number, remember to appropriately set your Voice URL, http://nodaphone.dtrejo.com/controller.xml
, and your StatusCallback URL, http://nodaphone.dtrejo.com/digits.xml
(substitute your own URLs).
If you have free trial twilio account, you only need to set one URL (the big textbox once you've logged-in.
<?xml version="1.0" encoding="UTF-8" ?> <Response> <Gather action="/digits.xml" method="POST" timeout="9999" numDigits="1" finishOnKey=""> <Say>Press sum buttons!</Say> </Gather> </Response>
<?xml version="1.0" encoding="UTF-8" ?> <Response> <Gather action="/digits.xml" method="POST" timeout="9999" numDigits="1" finishOnKey=""> <Say>Pew!</Say> </Gather> </Response>
— Source at github.com/DTrejo/nodaphone. Powered by Twilio, node.js, and socket.io