Building an IVR with Twilio

Developing an IVR can immediately be a daunting task if you have not had any experience doing so before. To simplify it, Twilio.com came up with a solution that takes the complicated choices in technology away from the project. You will immediately start to think about your call system instead of which text-to-speech solution should we go with, which software pbx technology to implement, how much will our phone costs be, can we afford it? Wait, what about multi-lingual call handling? Don’t get me wrong, I like to build systems, asterisk is quite fun to get dirty with, but you can’t do both and have immediate results.

A glimpse at a call diagram

A glimpse at a call diagram

So after whiteboarding your idea, you want to start out with a menu system. I’d recommend splitting up the greeting from your initial menu. For example in TwiML, do a call redirect from the greeting to your menu.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Response>
  3. <Say>
  4. Welcome to Hello IVR.
  5. </Say>
  6. <Redirect>
  7. http://example.com/voice/hello/
  8. </Redirect>
  9. </Response>

Menu’s should be simple, they should also conform to the same usage standard through every call screen.

Some common dial keys that have been recommended by others are:

  • * – Repeat
  • # – Go back
  • 7 – Previous
  • 9 – Next
  • 0 – Operator

Also, when asking for user selection, keep the number of choices to 5. Have them enter 9 for more options. With menu’s always make sure to gather input at anytime to allow quick navigation for experienced phone users. Here’s an example of a call menu with TwiML.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Response>
  3. <Gather
  4. numDigits="1"
  5. method="GET">
  6. <Say>
  7. Sales, press 1.
  8. </Say>
  9. <Say>
  10. Support, press 2.
  11. </Say>
  12. <Say>
  13. Frontdesk, press 3.
  14. </Say>
  15. <Say>
  16. For more options, press 9.
  17. </Say>
  18. <Say>
  19. For the operator, press 0.
  20. </Say>
  21. <Say>
  22. To hear the options again, please stay on the line.
  23. </Say>
  24. </Gather>
  25. <Pause />
  26. <Redirect>
  27. http://example.com/voice/menu/
  28. </Redirect>
  29. </Response>

When you want to build a search interface into your IVR, you need to make it simple, but also make sure you accept all input and handle all operations normally. People really want to press 0 when it doesn't work. Additionally, you need to keep track of the number of search failures and offer a solution. In most cases, a dial out to a human will suffice. In the case of no man power, I recommend a voicemail using TwiML's record tags. Here's an example search interface:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Response>
  3. <Gather
  4. method="GET"
  5. numDigits="3"
  6. finishOnKey=""
  7. timeout="5"
  8. action="http://example.com/voice/search/?failures=0">
  9. <Say>
  10. Please enter the first three letters of what you are looking for.
  11. </Say>
  12. </Gather>
  13. <Redirect>
  14. http://search.earth911.com/voice/what/?failures=0
  15. </Redirect>
  16. </Response>
  17.  

When you have too much data, too little structure, and need to tell the phone user a book, don't. Give them options, a details menu is a good thing. If you provide information such as phone numbers, add an option to redirect the call. If you have related information or you are nested one level deep in a list, offer the option to go directly to the next item. It's important to provide this level of navigation as it will save them time and you money on your minutes.

Voicemail systems are not complicated, but are difficult to maintain. Fortunately, for us we don't have to worry about that, we just want to send the recorded message to the right dept. Handle your voicemail successes & failures accordingly. Have the user try again if the voicemail fails and always provide a fail-safe redirect so that they can try something else if they can't leave a voicemail at that time.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Response>
  3. <Say>
  4. Leave your name, company, and your phone number to best reach you.
  5. </Say>
  6. <Say>
  7. Press the star key when finished.
  8. </Say>
  9. <Record
  10. action="http://example.com/voice/voicemail/"
  11. method="GET"
  12. maxLength="20"
  13. finishOnKey="*"
  14. />
  15. <Say>
  16. Try again.  Press the star key when finished.
  17. </Say>
  18. <Record
  19. action="http://example.com/voice/voicemail/"
  20. method="GET"
  21. maxLength="20"
  22. finishOnKey="*"
  23. />
  24. <Redirect>
  25. http://example.com/voice/
  26. </Redirect>
  27. </Response>
  28.  

Next up, I'll talk about Robo-Calling!

About aballai

something about myself...hrmmm
This entry was posted in General and tagged , , . Bookmark the permalink.

One Response to Building an IVR with Twilio

  1. Jeff Lawson says:

    Hi Adam,

    Great post, I love your clean IVR design and thought process! A couple notes and ideas that I thought I’d offer:

    1. In menu.xml, you don’t need separate blocks for each option, you could just as easily use For sales, press1. For service, press 2…. Your solution works as well, so maybe it’s just personal preference :)

    2. If you have multiple exit paths, and keeping track of the failure-counter in the URLs is difficult, you can keep track of failures in a cookie instead! Twilio is a well-behaved HTTP client, so you can use cookies to track data across many pages. You can even use PHP sessions, etc.

    Again, great post! Keep the awesome ideas coming.

    -jeff

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>