Are you building real-time gaming applications that use the phone (Voice or DTMF touch-tone) and require immediate response to your application? Ever wondered how to get input from a caller at the speed of light – rather than traditional AJAX API calls?
Tropo’s Scripting API allows you to do all sorts of interesting hacks to make this possible! Earlier, Jason Geocke demonstrated how to do this using real-time TCP sockets in the following blog post: Using Persistent Sockets in Tropo Applications. I recently had a customer asking about a similar request but using XMPP Instant Messaging to relay the DTMF touch-tones to any IM client.
I’m always up for a new challenge but was disappointed to find that this request wasn’t challenging at all. Tropo is ideal for building multi-modal communications apps like this going from Voice to IM in the same application.
Here is a video that demonstrates how this works.
Here is the Tropo Scripting that I used to make this demo possible.
answer
sleep 2
keeprunning = true
while keeprunning
ask "press a key or zero to end", {
:choices => "[1 DIGITS]",
:onChoice => lambda { |event|
message event.value, {
:to => "christoffe@jabber.org",
:network => "JABBER"}
if event.value == "0"
keeprunning = false
end
}
}
end
The only thing left to do is connect your IM bot to your Tropo application by simply creating one dynamically like cmtest@tropo.im. See below:
That’s all she wrote :)

