Home > Articles > Web Services > XML

  • Print
  • + Share This
Like this article? We recommend

Web 2.0 Voice Mashups

Now let’s really try and expand our thinking about how voice can play a role in the expanding space of Web 2.0 and web services. Stepping back and looking at the growing universe of web services, where servers can act as both servers and clients to other servers, two roles for Voice XML stand out: One is to receive notification when some event of interest occurs; the other is to trigger one or more web services via voice.

Let’s look first at notification. Imagine that you’re a manager responsible for nightly software builds and you want to know when the number of unit test failures exceeds some level. Instead of hoping that the technician on duty is alert enough to catch the failures (and awake enough to call), how about adding a script trigger that composes a Voice XML dialog that includes the number of failures and the text of the error messages. Combined with the call-generating powers of CCXML, the XML Call Control Dialog standard, you’ll be alerted about what’s going on even before the technician realizes that there is a problem.

On the trigger side, Voice XML’s capability to trigger server-side action using the Voice XML submit command to send an HTTP GET or POST, opens the door to countless mashup possibilities. To illustrate how might use voice to trigger other services, let’s write a little Voice XML app that uses voice to send email or text messages. The dialogue might sound something like:

C: Hey boss, what’s the message?
U: dinner
C: what time?
U: 9
C: send to?
U: wife
C: Message sent to zelda@yahoo.com. Dinner at 9. Goodbye boss.

The key to making this happen is the Voice XML submit element

<submit next=http://myserver.com/GmailServlet namelist="to subject msg"/> 

where the servlet recipient of the submit turns around and acts as a client to an email service. I’ve actually set such a servlet up for myself using a Google Gmail account. Google makes its SMTP mail server available as a web service so that when you feed it a mailing address, a message and of course, your user name and password (delivered securely), a Gmail message will be sent in your name. I used the Java Mail API to program the servlet, which is available at http://www.frankcoyle.org.

With the servlet in place, the Voice XML that will trigger email looks like this:

Listing 6 Voice XML that triggers Gmail email delivery

<vxml version="2.1" xmlns=’http://www.w3.org/2001/vxml’
    <form id="getRequest">
      <field name="subject" >
        <prompt>Hey boss, what’s the message?</prompt>
        <grammar type="application/x-gsl" mode="voice">
      [(dinner) (eat) (restaurant)]  {<subject "dinner">}
      [(meeting rescheduled)]     {<subject "meetingchange">}      

    <field name="time" type="digits">
      <prompt>what time?</prompt>
    <field name="to">
       send to??
       <break/> for <value expr="_prompt"/> 
       <value expr="_dtmf"/>
      <option dtmf="1" value="zelda@yahoo.com">wife </option> 
      <option dtmf="2" value="davew@gmail.com">dave</option> 
       <var name="msg" expr="subject + ’ at ’ + time"/>            
       Message sent to <value expr="to"/>.
        <value expr="msg"/>.
        Goodbye boss.
       <submit next="http://myserver.com/GmailServlet"
            namelist="to subject msg"/>

Hopefully, this and the other examples will trigger your thinking about how to leverage voice to enable other mashup possibilities.

  • + Share This
  • 🔖 Save To Your Account