Telephony Isn't All Talk for Java Developers (cont'd)

Starting the Input Field

We've started an input field now, so we have to define a grammar to tell the processor how to decipher what the user will say to retrieve information. In this simple application, we'll limit the choices to "mail" and "weather," just to keep the size manageable. We'll talk a bit more about the grammar later.

<grammar src="javavxml.gsl#VXMLgrammar"/>
      </field>

At this point, the input field is fully defined and we have to tell the processor what to do with the information returned in this field. The tag, appropriately enough, is named "filled" and the name of the input field has to be identified here.

<filled namelist="Destination">">
      <if cond="Destination == 'Mail'">
        <goto next="#Mail"/>
      <elseif cond="Destination == 'Weather'"/>
        <goto next="#Weather"/>
        </if>
      </filled>
    </form>

And that's the end of the form. We've defined an input field, how to fill the field, and inserted the branching logic to process each input variation separately.

Now we can write out the actual processing sections, which are also forms. We'll just do stubs to avoid having to worry about thread-safe code and database issues, but you could insert calls to an actual mail application here and a real weather server later on. Since the stubs are also forms, you could even solicit more input from the user in each one.

<form id="Mail">
    <block>
      <audio src="vxmlnomail.wav" />
      </block>
      <!-- More logic can be inserted here -->
    <block>
      <goto next="#Goodbye" />
      </block>
    </form>

  <form id="Weather">
    <block>
      <audio src="vxmlnoweather.wav" />
      </block>
      <!-- More logic can be inserted here -->
    <block>
      <goto next="#Goodbye" />
      </block>
    </form>

  <form id="Goodbye">
    <block>
      <audio src="vxmlgoodbye.wav" />
      <exit />
      </block>
    </form>

     Next: Closing out the Statement

1 Introduction 2 Coding a Java Telephony Application 3 Outputting the Actual Code
^ Starting the Input Field 5 Closing Out the Statement 6 Code It Yourself
Back to Top of This Page
 

Sun Microsystems

Polyphone, Inc.

IBM's Alphaworks

Lucent Technologies

DevX Book Bonus: A Review of "Essential JTAPI--Java Telephony API," by Spencer Roberts (Prentice Hall, 1999)


 TALK BACK
What has been your experience writing telephony applications? What are the pitfalls involved? If you haven't worked on one, do you expect to do so anytime in the near future? Join the discussion.
Click here to Join


Save on Hot Java Specials
SOFTWARE:
dtSearch Web
Add power searching to your web site.
Buy Now!
BOOKS:
PointBase Mobile Edition
Enable local data access for mobile users.
Buy Now!
Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map
Jupiterweb networks

internet.comearthweb.comDevx.comClickZ

Search Jupiterweb:

Jupitermedia Corporation has four divisions:
JupiterWeb, JupiterResearch, JupiterEvents, and JupiterImages

Copyright 2004 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | E-mail Offers