developer.com
Search EarthWeb
CodeGuru | Gamelan | Jars | Wireless | Discussions
Navigate developer.com
Architecture & Design  
Database  
Java
Languages & Tools
Microsoft & .NET
Open Source  
Project Management  
Security  
Techniques  
Voice  
Web Services  
Wireless/Mobile
XML  
New
 
Technology Jobs  

   Developer.com Webcasts:
  The Impact of Coding Standards and Code Reviews

  Project Management for the Developer

  Defining Your Own Software Development Methodology

  more Webcasts...




See the Winners!




Developer Jobs

Be a Commerce Partner














 


 Whitepaper: Integrating Telephony Services into .NET Applications
Sponsored by Avaya
Learn how developers using Microsoft's .NET framework can use SIP Objects.NET to gain simple and flexible access to telephony networks. SIP Objects.NET enables developers to access a wide variety of enterprise or traditional carrier networks by leveraging technologies such as Avaya's SIP Application Server. »
 
  Whitepaper: SIP—Creating Next-Generation Telecom Applications
Sponsored by Avaya
Developing applications to run on a telecommunications network has never been easier with Internet-based standards such as the Session Initiation Protocol (SIP). Combined with the power and simplicity of Java technology in the form of the SIP Servlet API, an application developer can create and deploy new services to users in a fraction of the time it previously took. »
 
 Whitepaper: Event Driven Architectures in the Responsive Enterprise
Sponsored by Avaya
This whitepaper introduces the concept of Event Driven Architecture (EDA) and describes the key role it plays in enabling new business strategies for Communications Enabled Business Processes. Learn more. Download this whitepaper.»
 
 Whitepaper: Developing Contact Center Telecom Applications
Sponsored by Avaya
SIP servlets make developing applications for telecommunications networks easier than ever before. Learn just how easy it is to create a basic telecommunications application using SIP servlets. The use of open standards such as SIP, together with Java programming, has radically simplified the task of creating complex applications. »
 
Developer News -
iPhone Users Just Want to Have Fun    August 26, 2008
Oops! I Fixed the Linux Kernel    August 22, 2008
Jim Zemlin: The New Center of Linux Gravity    August 21, 2008
Microsoft's Novell Investment Tops $340M    August 20, 2008
Free Tech Newsletter -

Whitepaper: SQL Server Application Platform Optimization. Get a ready-made solution that delivers comprehensive infrastructure optimization in accordance with Microsoft's APO model.

VoiceXML 2.0 Grammars, Part I
By Jonathan Eisenzopf

Go to page: Prev  1  2  

Grammar Headers

ABNF and XML grammar files must contain specific header information; otherwise, the VoiceXML interpreter will fail to recognize the grammar properly. The elements of a grammar file are:

  • grammar declaration
  • language/locale
  • mode
  • root grammar
ABNF
# ABNF 1.0 ISO-8859-1;
language en;
mode voice;
root $topRule;
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar version="1.0" 
  xmlns="http://www.w3.org/2001/06/grammar"
  xml:lang="en" mode="voice" root="topRule">
...

Grammar declaration

The grammar declaration specifies the grammar version and optionally, the character encoding scheme that should be used. The grammar version should always be set to 1.0. The character encoding specifies the character symbols that will be used for the grammar. For example, ISO-8859-1 is usually the character encoding used for English. Asian languages including Japanese and Chinese (Big5 or Mandarine) would use a different encoding scheme. In ABNF grammars, this is the first line. In XML, the encoding scheme is defined by the encoding attribute of the XML declaration (the first line of any XML file). 

ABNF
# ABNF 1.0 ISO-8859-1;
language en;
mode voice;
root $topRule;
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar version="1.0" 
  xmlns="http://www.w3.org/2001/06/grammar"
  xml:lang="en" mode="voice" root="topRule">
...

The grammar version in an XML grammar is defined by the version attribute of the <grammar> element.

Language

Unless the grammar is a DTMF grammar, a language must be specified in the grammar header. For ABNF grammars, the language parameter defines the language (in this example, US English):

ABNF
# ABNF 1.0 ISO-8859-1;
language en;
mode voice;
root $topRule;
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar version="1.0" 
  xmlns="http://www.w3.org/2001/06/grammar"
  xml:lang="en" mode="voice" root="topRule">
...

The language in an XML grammar is specified by the xml:lang attribute of the <grammar> element.

Mode

Grammars can be scoped for speech input (voice) or touch-tone input (dtmf) based on the value of the mode parameter. The default mode is voice. If the grammar is scoped dtmf, then speech input will not be recognized. VoiceXML 2.0 grammars do not allow mixed mode grammars. That means that a voice scoped grammar cannot include a dtmf scoped grammar or vice versa. In cases where we may want an application to accept both voice and DTMF input, two separate grammars can be defined within a given VoiceXML scope so long as they aren't combined into a single grammar in any way.

ABNF
# ABNF 1.0 ISO-8859-1;
language en;
mode voice;
root $topRule;
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar version="1.0" 
  xmlns="http://www.w3.org/2001/06/grammar"
  xml:lang="en" mode="dtmf" root="topRule">
...

Root grammar 

When grammars contain many sub-grammar rules in a single file, it's important to identify the root grammar, or main the grammar that will be executed when a VoiceXML dialog calls the grammar file. 

ABNF
# ABNF 1.0 ISO-8859-1;
language en;
mode voice;
root $topRule;
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar version="1.0" 
  xmlns="http://www.w3.org/2001/06/grammar"
  xml:lang="en" mode="voice" root="topRule">
...

Filename Extensions

The filename extension for ABNF grammars is .gram and .grxml for XML grammars. This is the recommended (but not required) filename extension format for grammar files.

About Jonathan Eisenzopf

Jonathan is a member of The Ferrum Group, LLC which specializes in Voice Web consulting and training. Feel free to send an email to eisen@ferrumgroup.com regarding questions or comments about this or any article.

Go to page: Prev  1  2  

Next article: VoiceXML 2.0 Grammars, Part II


Tools:
Add www.developer.com to your favorites
Add www.developer.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed


Voice Archives

Windows Server Catalog: Certified Servers
Intel Go Parallel Portal: Translating Multicore Power into Application Performance. Learn more.
Whitepaper: Virtualization from the Data Center to the Desktop
Developing Intelligent Communications? Visit the Avaya DevConnect Center on DevX.
Best Practices for Developing a Web Site. Checklists, Tips & Strategies. Download Exclusive eBook Now.



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers