Building IVR applications with Tropo, a cloud-based telephony and messaging system, is easy. This presentation details support for Tropo in Grails using the tropo-webapi-grails plugin.
2. Summary 2
■ What is Tropo?
■ How do I integrate Tropo with Grails?
■ Tropo WebAPI overview
■ Lessons learned
3. Terminology 3
■ IVR: Interactive Voice Response
■ VoiceXML or VXML:
■ CCXML: Call Control XML
■ TTS: Text to Speech
4. What is Tropo? 4
■ Cloud-based services for telephony and messaging
■ Make and receive phone calls
■ Use voice recognition
■ Messaging via SMS, IM, or Twitter
■ Backed by Voxeo.com
■ Industry leader in IVR and VoIP solutions
5. Why should I care? 5
■ Many applications benefit from voice and messaging
user interfaces
■ Tropo provides telephony and messaging infrastructure
and APIs for integrating these services into your
applications
■ Traditionally this was hosted in-house
■ APIs insulate developers from needing to write in
VoiceXML, CCXML, and other markups
6. How do I use it with Grails? 6
■ Install the Tropo WebAPI Grails plugin (version 0.21)
■ tropo-webapi-grails
■ Provides the TropoBuilder object for building
standard Tropo JSON documents
■ TropoService for provisioning and servicing
Tropo applications
7. TropoBuilder 7
■ Builds Tropo JSON response documents
■ Provides an array of JSON objects to control the
Tropo-based applications hosted in the cloud
■ ask, call, conference, hangup, message, on,
record, redirect, reject, result, say, session,
startRecording, stopRecording, transfer
8. TropoService 8
■ Grails service for administering Tropo applications
■ Abstraction around Tropo’s REST API
■ Create, update, and delete Tropo applications
■ Provision phone numbers, IM addresses, tokens
■ Retrieve information about applications
9. Tropo.com 9
■ Web-based administration UI
■ Create, update, and delete Tropo applications in the
cloud
■ Provision telephone numbers (both local and toll-
free) and IM accounts for your applications
■ Application debugging tool
■ Billing profile
10. Tropo Development 10
■ Create your Grails application
■ Add tropo-webapi-grails Grails plugin
■ Create your starting endpoint in your Grails app
■ Create application on tropo.com
■ Need externally available starting endpoint for your
Grails app
■ Provision local phone number
11. Tropo WebAPI 11
■ Use the TropoBuilder object to create Tropo-compliant
JSON objects
■ Tropo calls back to your application for instructions on
how to power the IVR infrastructure in the Tropo cloud
■ You application is a collection of interconnected
endpoints, rendering Tropo JSON objects to control
the IVR infrastructure in the Tropo cloud
13. session 13
■ Sent to your application in the first Tropo request
■ The callId field identifies this request body to a unique
call in Tropo
■ You will use the callId as the correlation identifier
for all requests
■ https://www.tropo.com/docs/webapi/session.htm
14. result 14
■ Sent to your application in all subsequent requests
from Tropo
■ The callId field identifies this request body to a unique
call in Tropo
■ You will use the callId as the correlation identifier
for all requests
■ https://www.tropo.com/docs/webapi/result.htm
15. say 15
■ Say something to the caller
■ Can be TTS or pre-recorded audio
■ Does not wait for user response
■ https://www.tropo.com/docs/webapi/say.htm
16. ask 16
■ Say something to the caller and wait for a response
from the caller
■ Can be TTS or audio file for say
■ Response can be collected speech or touch-tone
keypad (DTMF)
■ The choices object specifies how Tropo handles
user input
■ https://www.tropo.com/docs/webapi/ask.htm
18. hangup 18
■ Hangs up the current call.
■ https://www.tropo.com/docs/webapi/hangup.htm
19. record 19
■ Plays a prompt and then waits for a response from the
caller, which it records
■ Responses may be speech recognition or touch-tone
keypresses (DTMF)
■ At the conclusion of the recording, the collected audio
file is sent to FTP or HTTP POST/Multipart Form
endpoint
20. transfer 20
■ Transfer an in-progress call to another destination or
phone number
■ Can be a phone number or a SIP address
■ https://www.tropo.com/docs/webapi/transfer.htm
21. startRecording
stopRecording 21
■ Start and stop recording a call session
■ Resultant recording can be sent via FTP or HTTP
POST/Multipart form to a URL
■ You have to provide an endpoint or FTP server to
receive the binary file
■ https://www.tropo.com/docs/webapi/startrecording.htm
■ https://www.tropo.com/docs/webapi/stoprecording.htm
22. Lessons Learned 22
■ Testing
■ Test call flow in isolation by using a testing Tropo
application and a testing endpoint to bootstrap the
call session appropriately
■ In the future, look to building an automated test
runner that can be scripted and exercise the Grails
app through HTTP calls
23. Lessons Learned 23
■ The ask noinput and timeout APIs don’t work well
■ Issues with audio getting played out of sequence
■ Build this functionality into our call flow explicitly
using on events
24. Lessons Learned 24
■ Call recording is all or nothing
■ Unable to start and stop recording to allow for
omission of sensitive data recording
■ We toggle recording for debugging call flow
■ Keep it off for production usage
25. Lessons Learned 25
■ Call duration can be difficult to determine
■ Maintain a last Tropo callback timestamp on call
session domain object
■ Update the timestamp on each Tropo callback
invocation
■ Allows approximation of the call duration
26. Lessons Learned 26
■ Abandoned calls can be difficult to determine
■ We used a Quartz job in Grails
■ Periodically inspect in-progress calls
■ If last Tropo callback timestamp is beyond a
specified threshold, set the call session to
abandoned