<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.voxeo.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.voxeo.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Voxeo Developer's Corner</title>
	
	<link>http://blogs.voxeo.com/voxeodeveloperscorner</link>
	<description>Tips, tricks and tutorials about developing applications on Voxeo's platform</description>
	<pubDate>Mon, 01 Dec 2008 18:32:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.voxeo.com/VoxeoDevelopersCorner" type="application/rss+xml" /><item>
		<title>SIPMethod 4.0 has been released</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/471565085/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/12/01/sipmethod-40-has-been-released/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 18:32:10 +0000</pubDate>
		<dc:creator>Wei Chen</dc:creator>
		
		<category><![CDATA[Voxeo]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=106</guid>
		<description><![CDATA[SIPMethod Application Server 4.0 has been officially released. SIPMethod Application Server 4.0 is compliant with the new SIP Servlet Specification 1.1 and has passed the TCK.
SIPMethod 4.0 fully supports converged multi-model applications - mixing web, VoIP and web services capabilities in a single application. It supports SIP Servlet Specification 1.1, Java Servlet Specification 2.5 and [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "SIPMethod 4.0 has been released",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/12/01/sipmethod-40-has-been-released/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p>SIPMethod Application Server 4.0 has been officially released. SIPMethod Application Server 4.0 is compliant with the new <a href="http://jcp.org/en/jsr/detail?id=289">SIP Servlet Specification 1.1</a> and <a href="http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/09/sipmethod-application-server-now-passes-jsr-289-tck/">has passed the TCK</a>.</p>
<p>SIPMethod 4.0 fully supports converged multi-model applications - mixing web, VoIP and web services capabilities in a single application. It supports <a href="http://jcp.org/en/jsr/detail?id=289">SIP Servlet Specification 1.1</a>, <a href="http://jcp.org/en/jsr/detail?id=154">Java Servlet Specification 2.5</a> and <a href="http://jcp.org/en/jsr/detail?id=224">Java API for Web Services 2.0</a>.</p>
<p>SIPMethod 4.0 comes with the all-new Web Console to allow you easily manage and monitor the server and applications.</p>
<p>For production environment, SIPMethod 4.0 can be deployed as in clusters to provide high availability and load balance.</p>
<p>SIPMethod Application Server 4.0 can be <a href="http://www.micromethod.com/develop/dz.htm">downloaded</a> for 30 day evaluation.</p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=SIPMethod+4.0+has+been+released&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F12%2F01%2Fsipmethod-40-has-been-released%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/471565085" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/12/01/sipmethod-40-has-been-released/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/12/01/sipmethod-40-has-been-released/</feedburner:origLink></item>
		<item>
		<title>Adding Call Control to Voxeo Designer Applications via CCXML</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/466617866/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/11/26/creating-voxeo-designer-dialogs/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 21:05:50 +0000</pubDate>
		<dc:creator>voxeojeff</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[CCXML]]></category>

		<category><![CDATA[Designer]]></category>

		<category><![CDATA[Grammar]]></category>

		<category><![CDATA[Mashups]]></category>

		<category><![CDATA[VoiceXML]]></category>

		<category><![CDATA[Voxeo]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=108</guid>
		<description><![CDATA[
Lately, the Voxeo Designer platform has become increasingly popular.  However, it can be somewhat limited in terms of call control.  Customers who are used to a combination of CCXML and VoiceXML may be turned away by this idea.  Well, fear not, as we can easily integrate CCXML and Designer now, adding that [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "Adding Call Control to Voxeo Designer Applications via CCXML",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/11/26/creating-voxeo-designer-dialogs/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p><img src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/01/voicexmlcertifieddeveloper.gif" alt="voicexmlcertifieddeveloper.gif" align="right" border="0" height="150" width="119" /></p>
<p>Lately, the Voxeo Designer platform has become increasingly popular.  However, it can be somewhat limited in terms of call control.  Customers who are used to a combination of CCXML and VoiceXML may be turned away by this idea.  Well, fear not, as we can easily integrate CCXML and Designer now, adding that game-changing call control aspect that CCXML brings to the table.  Why use a CCXML front end, you say?  Well, lots of reasons.  CCXML brings call control, conferencing, whisper dialogs, hold dialogs, as well as the ability to pass in parameters to your Designer application.  Whether it&#8217;s &#8220;you have a call from John Smith, press 1 to accept this call,&#8221; or a simple repeating hold music dialog, it is now possible with Designer dialogs.</p>
<p>So now let&#8217;s take a look at how we put it all together.  Let&#8217;s assume that you already have a basic Designer application established.  At this point, we don&#8217;t care what it does.  Now, we need to write a CCXML front end for it.</p>
<p></p>
<blockquote>
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml"&gt;
&nbsp;&nbsp;&lt;var name="myDialogID"/&gt;
&nbsp;&nbsp;&lt;eventprocessor&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="connection.alerting"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'Preparing to answer the call.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accept/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="connection.connected"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'Caller has connected.  Executing VoiceXML dialog now.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dialogstart src="'helloworld.vxml'" type="'application/voicexml+xml'" dialogid="myDialogID"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="dialog.exit"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'The dialog is now complete.  Exiting application.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;exit/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="error.*"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'An error has occured (' + event$.reason + ').  Exiting application.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;exit/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&lt;/eventprocessor&gt;
&lt;/ccxml&gt;
</pre>
</blockquote>
<p>
This simple CCXML code snippet accept a user&#8217;s call, and launches a VoiceXML dialog titled helloworld.vxml.  Now, all we need to do is modify the &#8220;src&#8221; attribute to reference the Designer application.  How, you ask?  Well, it&#8217;s a little tricky, but far from impossible.  All we need to do is grab the Designer URL from the Application Debugger (or the Prophecy Log Viewer, for all the local installations out there).  The full URLs will look something like this, and may require copying the link to the clipboard (in Evolution, at least) in order to see the entire thing:</p>
<p><strong>Evolution Designer:</strong></p>
<p>
&nbsp;&nbsp;<strong>http://evodesigner-internal.voxeo.com/CallRouter?vr.application.id=XXXX</strong><br />
&nbsp;&nbsp;<em>(where XXXX is your specific Application ID)</em></p>
<p><strong>Prophecy Designer:</strong></p>
<p>
&nbsp;&nbsp;<strong>http://127.0.0.1:9992/CallRouter?vr.application.id=X</strong><br />
&nbsp;&nbsp;<em>(where X is your specific Application ID)</em></p>
<p>We can then inject this into the &lt;dialogstart&gt; keeping everything else the same.  The dialog &#8220;type&#8221; remains &#8220;application/voicexml+xml&#8221; since Designer is pure VoiceXML behind the scenes, coupled with a custom GUI.</p>
<p>Now let&#8217;s take a look at the finalized code, with our Designer dialog in place.</p>
<blockquote>
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml"&gt;
&nbsp;&nbsp;&lt;var name="myDialogID"/&gt;
&nbsp;&nbsp;&lt;eventprocessor&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="connection.alerting"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'Preparing to answer the call.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;accept/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="connection.connected"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'Caller has connected.  Executing Designer dialog now.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dialogstart src="'http://127.0.0.1:9992/CallRouter?vr.application.id=1'" type="'application/voicexml+xml'" dialogid="myDialogID"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="dialog.exit"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'The dialog is now complete.  Exiting application.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;exit/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;transition event="error.*"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;log expr="'An error has occured (' + event$.reason + ').  Exiting application.'"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;exit/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/transition&gt;

&nbsp;&nbsp;&lt;/eventprocessor&gt;
&lt;/ccxml&gt;
</pre>
</blockquote>
<p>
And there you have it &#8212; a basic application which launches a Designer dialog.  Hopefully this will help shed some light on how developers can combine the utility of CCXML with the usability of Voxeo Designer.</p>
<p>Jeff Menkel<br />
VXML Certified Developer</p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=Adding+Call+Control+to+Voxeo+Designer+Applications+via+CCXML&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F11%2F26%2Fcreating-voxeo-designer-dialogs%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/466617866" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/11/26/creating-voxeo-designer-dialogs/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/11/26/creating-voxeo-designer-dialogs/</feedburner:origLink></item>
		<item>
		<title>SIP Servlet programming: Basics</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/431079848/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/24/sip-servlet-programming-basics/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 20:21:19 +0000</pubDate>
		<dc:creator>Wei Chen</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[SIP]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Voxeo]]></category>

		<category><![CDATA[SIP Servlets]]></category>

		<category><![CDATA[SIPMethod]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=67</guid>
		<description><![CDATA[Here I would like to start a series of blogs to talk about how to build advanced VoIP services with SIP servlet technology.
This blog covers some of the basic concepts about SIP servlet technology and demonstrate a simple SIP proxy server using SIP servlet programming model.
What is a Servlet and a Servlet Container?
A servlet is  [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "SIP Servlet programming: Basics",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/24/sip-servlet-programming-basics/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p>Here I would like to start a series of blogs to talk about how to build advanced VoIP services with SIP servlet technology.</p>
<p>This blog covers some of the basic concepts about SIP servlet technology and demonstrate a simple SIP proxy server using SIP servlet programming model.</p>
<p><strong>What is a Servlet and a Servlet Container?</strong></p>
<p style="padding-left: 30px">A servlet is  a Java component which is managed by a servlet Container and which responds to messages of an application protocol.</p>
<p style="padding-left: 30px">A servlet container, typically part of an application server, manages the lifecycle of servlets, sends and receives the messages for servlets. It also provides other services such as security to servlets as well.</p>
<p style="padding-left: 30px">The following diagram shows the relationship of a servlet, servlet container, application server, and Java virtual machine.</p>
<p style="text-align: center;padding-left: 30px"><a href="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/tutorial.jpg"><img class="size-medium wp-image-72 aligncenter" src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/tutorial-300x143.jpg" alt="" /></a></p>
<p style="padding-left: 30px">When needed, the servlet container loads the servlet class, instantiates (a.k.a. <code>new()</code>) the servlet and invokes its <code>init()</code> method with the configuration in the form of <code>ServletConfig</code> object. Once initialized, the servlet is able to serve the messages. The servlet container repeatedly invokes the servlet&#8217;s <code>service()</code> method with the incoming messages in the form of <code>ServletRequest</code> and <code>ServletResponse</code> objects. The servlet container can deactivate a servlet by invoking its <code>destroy()</code> method and makes the servlet eventually be garbage collected.</p>
<p style="padding-left: 30px">As you can tell, the lifecycle of a servlet is rather simple. The <code>service()</code> method is where all the interesting actions are during its life. What a servlet does in its <code>service()</code> method fundamentally depends on the application protocol the servlet supports.</p>
<p><strong>What is a HTTP and a SIP Servlet?</strong></p>
<p style="padding-left: 30px">Simply speaking, a HTTP servlet is a kind of servlet that supports HyperText Transfer Protocol, and a SIP servlet is a kind of servlet that supports Session Initiation Protocol. If you are familiar with Object Oriented programming, you should be able to think of the following class diagram.</p>
<p style="padding-left: 30px;text-align: center"><a href="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/tutorial2.jpg"><img class="size-medium wp-image-92 aligncenter" src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/tutorial2-300x169.jpg" alt="" width="300" height="169" /></a></p>
<p style="text-align: center;padding-left: 30px">
<p style="padding-left: 30px">The latest HTTP servlet specification (and the generic servlet specification) is <a href="http://jcp.org/en/jsr/detail?id=154">Servlet 2.5</a>. The latest SIP servlet specification is <a href="http://jcp.org/en/jsr/detail?id=289">SIP Servlet 1.1</a>. You may notice that the APIs of both specifications are quite similar. However there are many subtle differences due to the differences of the protocols.</p>
<p style="padding-left: 30px">The most fundamental difference of a HTTP servlet and a SIP servlet is what a servlet can do in <code>the service()</code> method.</p>
<p style="padding-left: 30px">HTTP is a synchronous protocol where a HTTP servlet is expected to receive a HTTP request and respond with a HTTP response before it can serve another HTTP request. In the <code>HttpServlet.service(HttpServletRequest request, HttpServletResponse response) method</code>, a HTTP servlet is expected to process the request and write the output into the response within the method invocation.</p>
<p style="padding-left: 30px">SIP is an asynchronous protocol where a SIP servlet can receive a SIP request and response at any time. In the <code>SipServlet.service(SipServletRequest request, SipServletResponse response)</code> method, only one of the parameters - either the request or the response - is valid. The SIP servlet is expected to receive the request or response in the <code>service()</code> method but can either process it within the method invocation or save it for processing at a later time. A SIP servlet can also issue requests or responses at any time as long as the servlet is in the initialized state.</p>
<p><strong>How to write a SIP servlet?</strong></p>
<p style="padding-left: 30px">Writing a SIP servlet starts with creating a subclass of the SipServlet class. Instead of overwriting the <code>service()</code> method, you typically overwrite one of the <code>doXXX()</code> methods.</p>
<p style="padding-left: 30px">The <code>doXXX()</code> methods are defined to modularize the logic within the <code>service()</code> method. The default implementation of <code>SipServlet.service()</code> method calls one of the <code>doXXX()</code> methods based on the type of the message it receives. For example, for a SIP INVITE request, <code>doInvite()</code> method is invoked.</p>
<p style="padding-left: 30px">Because most of SIP protocol details, such as message parsing, retransmission, transaction and dialog management, are abstracted away from a SIP servlet, the logic with these <code>doXXX()</code> methods shall just focus on the high level functionality.</p>
<p style="padding-left: 30px">Here I demonstrate how easy it is to write a stateful SIP proxy with a SIP servlet - just 4 lines of code, including one optional line.</p>
<pre style="padding-left: 60px"><code>public class ProxyServlet extends SipServlet {
  public void doInvite(SipServletRequest request) throws ServletException, IOException {
    if (request.isInitial()) {
      Proxy proxy = request.getProxy();
      proxy.setRecordRoute(true); //optional
      proxy.proxyTo(request.getRequestURI());
    }
  }
}
</code></pre>
<p style="padding-left: 30px">In the <code>doInvite()</code> method, I first check to see if the request is an initial request - a request that doesn&#8217;t match any existing SIP dialogs. If true, I simply create a <code>Proxy</code> object out of the request. I can optionally invoke <code>Proxy.setRecordRoute()</code> method to indicate this SIP proxy records the route. Then just simply proxy the request to its destination by invoking <code>Proxy.proxyTo()</code> method with the original request URI.</p>
<p style="padding-left: 30px">That&#8217;s it - now I have a functional stateful SIP proxy. What about all the complex <a href="http://tools.ietf.org/html/rfc3261#section-16">Proxy Behavior in RFC 3261</a>? The SIP servlet container has taken care of most of the standard work once it knows the SIP dialog associated the INVITE request is intended for proxy. Isn&#8217;t this wonderful to an application developer?</p>
<p><strong>How to build a SIP servlet application?</strong></p>
<p style="padding-left: 30px">A typical SIP servlet application probably involves more than just one SIP servlet class. In order for the SIP servlet container to properly load and run a SIP servlet application, the application has to be assembled into a hierarchical directory structure with additional deployment descriptors, as shown in the following.</p>
<pre style="padding-left: 30px">  |-- WEB-INF
  |     |-- classes  (where all the java classes are)
  |     |   |-- com
  |     |       |-- voxeo
  |     |           |-- sipmethod
  |     |               |-- tutorial
  |     |                   |-- one
  |     |                       |-- ProxyServlet.class
  |     |-- lib (where all the library JARs are, if any)
  |     |-- sip.xml (optional SIP deployment descriptor XML)
  |     |-- web.xml (optional HTTP deployment descriptor XML)
  |-- index.html (document files)</pre>
<p style="padding-left: 30px">The root of the hierarchy is where all the documents, such as index.html, are, although there is none in this tutorial.</p>
<p style="padding-left: 30px">A special directory under root is WEB-INF, which is where all other stuff are, such as Java classes, libraries, deployment descriptors, etc.</p>
<p style="padding-left: 30px">All the Java classes including servlets shall be placed under WEB-INF/classes directory. The above diagram shows how ProxyServlet.class is placed. WEB-INF/lib is where all the third-party libraries (i.e. JARs) are, in which I don&#8217;t have any in this tutorial. All the deployment descriptors - sip.xml and web.xml - are also under WEB-INF directory.</p>
<p style="padding-left: 30px">A deployment descriptor is an XML file that conveys information about how the application is assembled and to be deployed. In other words, these are meta data about the application.</p>
<p style="padding-left: 30px">With the latest servlet standards, these meta data can also be specified in the Java classes using Java annotations. For example, to specify deployment information about the ProxyServlet, we add a class level annotation - @SipServlet - to specify the name for the servlet</p>
<pre style="padding-left: 60px"><code>@javax.servlet.sip.annotation.SipServlet(name="Proxy")
public class ProxyServlet extends SipServlet {
  ...
}</code></pre>
<p style="padding-left: 30px">sip.xml is the deployment descriptor for all the SIP related meta data. Here I specify the application name, the default timeout value for proxy and the main servlet of the application. (These information can be specified using Java annotation as well.)</p>
<pre><code>      &lt;sip-app xmlns="http://www.jcp.org/xml/ns/sipservlet"
               xmlns:javaee="http://java.sun.com/xml/ns/javaee"&gt;
        &lt;app-name&gt;SIP Proxy Server&lt;/app-name&gt;
        &lt;main-servlet&gt;Proxy&lt;/main-servlet&gt;
        &lt;proxy-config&gt;
          &lt;proxy-timeout&gt;300&lt;/proxy-timeout&gt;
        &lt;/proxy-config&gt;
      &lt;/sip-app&gt;</code></pre>
<p style="padding-left: 30px">I don&#8217;t have web.xml in this tutorial. I will cover web.xml when talking about converged applications.</p>
<p style="padding-left: 30px">Typically we package the above directory structure into a Servlet Archive (SAR) using the standard <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html">Java Archieve (JAR)</a> format, which is essentially a ZIP file. Here is the <a href="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/tutorial1.sar">SAR</a> file of the above SIP proxy sample.</p>
<p><strong>How to deploy and run a SIP servlet application?</strong></p>
<p style="padding-left: 30px">Deploying a SIP servlet application typically means deploying the SAR of the application to a SIP servlet container. Running the SIP servlet container typically runs all the SIP servlet applications deployed within that container.</p>
<p style="padding-left: 30px">The exact steps of deploying and running a SIP servlet application depends on which SIP servlet container and application server you use. The following steps are based on SIPMethod Application Server.</p>
<ol style="padding-left: 60px">
<li>Make sure you have JDK 1.5 or later installed on your system.</li>
<li>Install <a href="http://www.micromethod.com/develop/dz.htm">SIPMethod Application Server 4.0 (beta)</a>. Let&#8217;s call where SIPMethod Application Server is installed &lt;sm_home&gt;.</li>
<li>Remove all all the files and directories under &lt;sm_home&gt;/apps. This step is to simplify the application routing since we haven&#8217;t talked about the concept of Application Router yet.</li>
<li>Copy the <a href="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/tutorial1.sar">SAR</a> file of the above sample into &lt;sm_home&gt;/apps directory.</li>
<li>Assuming environment variable JAVA_HOME is pointing to where the JDK is installed, running &lt;sm_home&gt;/bin/startup.[bat | sh] shall start SIPMethod Application Server.</li>
<li>Now your SIP proxy server is up and running.</li>
</ol>
<p style="padding-left: 30px">To test your SIP proxy server, you can try any softphone that can be configured with an outbound proxy server. Once you configure SIPMethod Application Server as the outbound proxy server (by default, SIPMethod listens on port 5060 on all local IPs), the call made from the softphone shall be proxied through your SIP servlet based SIP proxy server to its destination.</p>
<p>Hopefully this blog gives you some basic ideas about SIP servlet programming. There are still quite a lot to be covered, such as converged applications, application composition, etc. So stay tuned for more SIP servlet programming blogs.</p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=SIP+Servlet+programming%3A+Basics&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F10%2F24%2Fsip-servlet-programming-basics%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/431079848" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/24/sip-servlet-programming-basics/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/24/sip-servlet-programming-basics/</feedburner:origLink></item>
		<item>
		<title>Evolution Designer &amp; Answering Machine Detection</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/423059774/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/16/evolution-designer-answering-machine-detection/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 21:13:46 +0000</pubDate>
		<dc:creator>Dustin Hayre</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[Designer]]></category>

		<category><![CDATA[Prophecy]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Voxeo]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=63</guid>
		<description><![CDATA[
Hi, I&#8217;m Dustin, and I&#8217;m a VoiceXML Certified Developer. This is the part where you all clap and welcome me and we spend the next hour talking about our feelings. Since this is my first blog on the interweb, I&#8217;ll spare you the pain this time and skip right to the meat and potatoes.
In this [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "Evolution Designer &#38; Answering Machine Detection",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/16/evolution-designer-answering-machine-detection/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="vertical-align: middle" src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/01/voicexmlcertifieddeveloper.gif" alt="" width="119" height="150" /></p>
<p>Hi, I&#8217;m Dustin, and I&#8217;m a VoiceXML Certified Developer. This is the part where you all clap and welcome me and we spend the next hour talking about our feelings. Since this is my first blog on the interweb, I&#8217;ll spare you the pain this time and skip right to the meat and potatoes.</p>
<p>In this week&#8217;s Developer&#8217;s Corner blog, we&#8217;ll explore Answering Machine Detection - or Call Progress Analysis(CPA) if you wanna get technical. The kicker here is we&#8217;re not writing a complex CCXML to do it. In fact, we&#8217;re not going to write a single line of code today; we&#8217;re gonna whip it all up real quick and easy like in Designer - it&#8217;s Shake and Bake™, and you helped.</p>
<p><em>This blog assumes you have some working knowledge of the Designer tool. If not, check out <a href="http://docs.voxeo.com/voicexml/2.0/ed_t1.htm">our starter tutorial about Designer</a>. This blog is geared towards our hosted platform; if you&#8217;re using a Premise installation of <a href="http://www.voxeo.com/prophecy">Prophecy</a>, check out the bottom of this post where I&#8217;ve detailed the differences.</em></p>
<p><strong>So what is CPA?</strong></p>
<p>The Voxeo Call Progress Analyzer (CPA) offers customizable answering machine detection.  It uses advanced Digital Signal Processing (DSP) and voice activity detection to analyze the audio signal after a call is connected, making it possible to programmatically determine if the answering party is a human speaker, an answering machine, a modem or Cylon. Ok, so I made the Cylon part up&#8230;that part&#8217;s still in beta. Voxeo recently enabled Call Progress Analysis(CPA or Answering Machine Detection) on its shared hosting platform for Evolution Designer, so we figured we should probably let you know how to use it.</p>
<p><strong>Creating our Project</strong></p>
<p>If you&#8217;re not already logged into <a href="http://evolution.voxeo.com">Evolution</a>, go ahead and do so now. Click Evolution Designer and this should open a new window with the manage projects popup. Select Create a new project, New Project and click Next. Go ahead and enter a name and description for your project here and click Save. We don&#8217;t need the &#8216;Start&#8217; step, so left-click on it and select Remove. This should bring us back to our call flow with only one step: Initial Step. Go ahead and click on this and click the blue plus sign at the bottom.</p>
<p><img style="vertical-align: top" src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/picture1.png" alt="" /></p>
<p>This will bring up the create step dialog. Let&#8217;s name this step CPA Result, because we&#8217;re creative like that, and select Decision as the type. Back at the call flow diagram now, we should see our new step. Go ahead and click on it and click Add. Let&#8217;s name our first rule Human. Click Browse and select CPA Result from the Data Variable pull down and click Ok. We&#8217;re checking to see if our string equals human, so go ahead and type human in the box next to the VC icon and click Add Condition. Under Select Destination click the blue plus and create a Prompt step and name it Human, click Save and then Ok. Repeat the rule creation process again, instead using machine instead of human. We&#8217;ll also need to create a &#8216;When No Rules Apply&#8217; step, so click the blue plus one more time and create a Prompt step called Unknown. This is where our callee will be sent if CPA can&#8217;t figure out what they are. With all that completed, our step should now look like this:</p>
<p><img src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/picture2.png" alt="" /></p>
<p>All that&#8217;s left to do know is edit our Human, Machine and Unknown steps. We&#8217;ll need to add TTS for each open, so open them up and click New Audio. In my example, I simply put &#8216;CPA says you are a human/machine/etc&#8217; and selected the Destination as the Hangup step. You, however, are free to get fancy here and create human and machine specific logic and input steps. Once we&#8217;re done here, all that&#8217;s left to do is click Publish and map our project up in Application Manager.</p>
<p><img src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/10/pic-17.gif" alt="" width="149" height="249" /></p>
<p>On our Evolution start page, click Application Manager then Add Application at the bottom. We should have a few options for application type here but we&#8217;ll want to select Evolution Designer and click Next. Now we&#8217;ll just need to fill in a name for our app, select it from the pulldown, click Create Application and we&#8217;re just about set. If you don&#8217;t already have an Evolution Designer token, you&#8217;ll want to grab one from the Voxeo support team. Open a new support ticket in your account from the Evolution home page or send an email to <a href="mailto:support@voxeo.com">support@voxeo.com</a> with your account name and the application you&#8217;d like the token for. Once we have this in hand, we can start launching outbound Designer calls by popping the URL below in our favorite browser and replace YOURPHONENUMBER with the number you wish to dial and YOURTOKENID with the token ID provided to you by the support team.</p>
<p><em>http://api.voxeo.net/SessionControl/VoiceXML.start ?numbertodial=YOURPHONENUMBER &amp;tokenid=YOURTOKENID &amp;voxeo-cpa-maxtime=4000 &amp;voxeo-cpa-maxsilence=1000 &amp;voxeo-cpa-runtime=20000</em></p>
<p>So what do these settings mean? I&#8217;ll steal some information directly from our docs to explain:</p>
<ul>
<li><strong>voxeo-cpa-maxsilence</strong> The &#8216;cpa-maxsilence&#8217; parameter is used to identify the end of voice activity.  When activity begins, CPA will measure the duration until a period of silence greater than the value of &#8216;cpa-maxsilence&#8217; is detected.  Armed with start and end timestamps, CPA can then calculate the total duration of voice activity.  A value of 800 to 1200ms is suggested for this parameter.</li>
<li><strong>voxeo-cpa-maxtime</strong> The &#8216;cpa-maxtime&#8217; parameter is the &#8220;measuring stick&#8221; used to determine &#8216;human&#8217; or &#8216;machine&#8217; events.  If the duration of voice activity is less than the value of &#8216;cpa-maxtime&#8217;, the called party is considered to be &#8216;human.&#8217;  If voice activity exceeds the &#8216;cpa-maxtime&#8217; value, your application has likely called a &#8216;machine.&#8217;  The recommended value for this parameter is between 4000 and 6000ms.</li>
<li><strong>voxeo-cpa-runtime</strong> The &#8216;cpa-runtime&#8217; parameter specifies the maximum amount of time CPA should listen for events.  If the &#8216;runtime&#8217; exprires, CPA will return an &#8220;unknown&#8221; result.  Therefore, &#8216;cpa-runtime&#8217; should always be longer than the average answering machine outgoing message.  We recommend a value of at least 15000-20000ms.</li>
</ul>
<p><strong>Possible CPA events:</strong></p>
<p><em>These will be populated to the CPA Result variable within Designer as a string value.</em></p>
<ul>
<li>human</li>
<li> machine</li>
<li>beep</li>
<li>modem</li>
<li>faxtone</li>
<li>sit</li>
</ul>
<p><strong>Enabling CPA for Prophecy Designer</strong></p>
<p>Enabling CPA for Designer on a Premise installation of Prophecy is fairly simple. The wrapper that handles all the logic is already there, we just need to tell Designer to look out for CPA result. Assuming you installed Prophecy in the default path, open up C:\Program Files\Voxeo\Designer\config\GlobalVariables.conf. At the bottom of this file, paste in this line: voxeo_cpa_result=CPA Result</p>
<p>That&#8217;s it. Restart the Designer service by clicking the Prophecy tray icon and select Restart Services and Voxeo Prophecy Designer.</p>
<p><strong>Publishing your project on a Premise installation</strong></p>
<p>Once you&#8217;ve clicked Publish on your completed Designer project, return to Management Console(Prophecy tray icon &gt; Prophecy home &gt; Management Console) and select the Call Routing menu option. Scroll down until you find the route named Designer. Click the App Name drop down and select your project. Verify App Version is set to Latest and then scroll to the bottom of the page and click Save Changes. To test our new outbound application, open the Prophecy SIP phone(Prophecy tray icon &gt; SIP Phone), open up your web browser and paste in this URL:</p>
<p><em>http://127.0.0.1:9998/VoiceXML.start ?numbertodial=sip:user@127.0.0.0.1:5070 &amp;tokenid=designer &amp;voxeo-cpa-maxtime=4000 &amp;voxeo-cpa-maxsilence=1000 &amp;voxeo-cpa-runtime=20000</em></p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=Evolution+Designer+%26amp%3B+Answering+Machine+Detection&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F10%2F16%2Fevolution-designer-answering-machine-detection%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/423059774" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/16/evolution-designer-answering-machine-detection/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/16/evolution-designer-answering-machine-detection/</feedburner:origLink></item>
		<item>
		<title>SIPMethod Application Server now passes JSR 289 TCK</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/416454959/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/09/sipmethod-application-server-now-passes-jsr-289-tck/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 04:51:39 +0000</pubDate>
		<dc:creator>Wei Chen</dc:creator>
		
		<category><![CDATA[Voxeo]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[SIP Servlet]]></category>

		<category><![CDATA[SIPMethod]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=62</guid>
		<description><![CDATA[JSRs are specifications of Java technologies. JSR 289 is the new specification for SIP Servlet technology. Each JSR comes with a Technology Compatibility Kit (TCK) to verify if an implementation of the JSR indeed fully complies with the specification.
SIPMethod Application Server is a SIP application server based on SIP Servlet technology. Its latest release (beta [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "SIPMethod Application Server now passes JSR 289 TCK",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/09/sipmethod-application-server-now-passes-jsr-289-tck/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.voxeo.com/speakingofstandards/2008/10/08/speaking-of-jsrs/">JSRs are specifications of Java technologies</a>. <a href="http://jcp.org/aboutJava/communityprocess/final/jsr289/index.html">JSR 289</a> is the new specification for SIP Servlet technology. Each JSR comes with a Technology Compatibility Kit (TCK) to verify if an implementation of the JSR indeed fully complies with the specification.</p>
<p><a href="http://www.micromethod.com/products/sipmethod.htm">SIPMethod Application Server</a> is a SIP application server based on SIP Servlet technology. Its latest release (beta 3) passes JSR 289 TCK, which means now SIPMethod is in full compliance with JSR 289 specification.</p>
<p>SIPMethod supports not only SIP servlets but also HTTP servlets and Web Service endpoints. It enables the development of <em>converged applications</em> - applications that mix VoIP, Web and SOA capabilities.</p>
<p><img style="vertical-align: middle" src="http://www.micromethod.com/images/pro_as.gif" alt="" width="533" height="248" /></p>
<p>SIPMethod is available for <a href="http://www.micromethod.com/develop/dz.htm">download</a> for evaluation purpose right now. Please do check it out if you are interested in building cool Web 2.0 applications with VoIP.</p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=SIPMethod+Application+Server+now+passes+JSR+289+TCK&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F10%2F09%2Fsipmethod-application-server-now-passes-jsr-289-tck%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/416454959" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/09/sipmethod-application-server-now-passes-jsr-289-tck/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/09/sipmethod-application-server-now-passes-jsr-289-tck/</feedburner:origLink></item>
		<item>
		<title>Demystifying VoiceXML Subdialogs</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/413074042/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/06/demystifying-voicexml-subdialogs/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 19:31:47 +0000</pubDate>
		<dc:creator>Mark Headd</dc:creator>
		
		<category><![CDATA[Prophecy]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[VoiceXML]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=61</guid>
		<description><![CDATA[This is a guest post from Mark Headd, a voice application developer who was one of the first 10,000 users of our platform, and was originally published on his Vox Populi blog on October 3, 2008.

Note – this post demonstrates the use of VoiceXML subdialogs.  The examples below were tested on the Voxeo Prophecy [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "Demystifying VoiceXML Subdialogs",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/06/demystifying-voicexml-subdialogs/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p><em>This is a guest post from <a href="http://www.voiceingov.org/blog/">Mark Headd</a>, a voice application developer who was one of the first 10,000 users of our platform, and was <a href="http://www.voiceingov.org/blog/?p=148">originally published on his Vox Populi blog on October 3, 2008</a>.</em><br />
<hr />
<p><i>Note – this post demonstrates the use of VoiceXML subdialogs.  The examples below were tested on the Voxeo Prophecy platform.  To download the Prophecy software and run these examples locally, go to <a href="http://www.voxeo.com/prophecy/" target="_blank">http://www.voxeo.com/prophecy/</a>.</i></p>
<p><strong>What are Subdialogs?</strong></p>
<p><a href="http://www.w3.org/TR/2004/REC-voicexml20-20040316/#dml2.3.4" target="_blank">Subdialogs</a> are a powerful, but often misunderstood, part of the VoiceXML specification that can be used to create reusable components for telephone applications.</p>
<p>The official W3C VoiceXML specification defines subdialogs thusly:</p>
<blockquote><p>
A subdialog is like a function call, in that it provides a mechanism for invoking a new interaction, and returning to the original form. Variable instances, grammars, and state information are saved and are available upon returning to the calling document. Subdialogs can be used, for example, to create a confirmation sequence that may require a database query; to create a set of components that may be shared among documents in a single application; or to create a reusable library of dialogs shared among many applications.
</p>
</blockquote>
<p>One of the most confusing aspects of subdialogs is that they run in a completely separate execution context from the dialog that invokes them (the parent dialog).  However, once developers get over this conceptual hurdle, the real power of subdialogs becomes apparent.</p>
<p><strong>Fun with Subdialogs</strong></p>
<p>One of the things I like most about subdialogs is their reusability.  I often find myself in situations where I need to collect input from a caller in several steps that are generally the same (i.e., a series of digits), but each has a specific validation requirement.</p>
<p>For example, in order to process a credit card payment there are several pieces of information that need to be obtained form a caller – credit card number, CVV number, expiration date, etc.  All have the same common characteristic that they are a series of digits, but all have unique verification requirements. Valid credit card numbers have specific lengths and must pass <a href="http://en.wikipedia.org/wiki/Luhn_algorithm" target="_blank">a &#8220;mod 10&#8243; check</a>.  CVV numbers are <a href="http://en.wikipedia.org/wiki/Card_Security_Code" target="_blank">specific lengths</a> for different card types.</p>
<p>As with a typical function call in any programming language, parameters can be passed into a VoiceXML subdialog when it is invoked.  These parameters often take the form of a string of text to be read out to the caller, or a number that is used to count actions.  However, we also have the option of passing more complex data types into a subdialog call</p>
<p>We can pass JavaScript arrays and custom object into a subdialog, or we can pass some of the native object types in JavaScript.  For example, every function that is declared in JavaScript is also an instance of the <a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function" target="_blank"> JavaScript Function Object</a>.  So a JavaScript function that is declared in a parent dialog can be passed into a subdialog as a parameter.</p>
<p>For example, consider the following simple subdialog:</p>
<blockquote><p>&lt;form id=&#8221;S_1&#8243;&gt;</p>
<p>&lt;!&#8211; Parameters passed into subdialog &#8211;&gt;<br />
&lt;var name=&#8221;myPrompt&#8221; /&gt;<br />
&lt;var name=&#8221;myFunction&#8221; /&gt;</p>
<p>&lt;catch event=&#8221;noinput nomatch&#8221;&gt;<br />
&nbsp;&nbsp;&lt;prompt&gt;That was not valid input.  Try again.&lt;/prompt&gt;<br />
&nbsp;&nbsp;&lt;reprompt/&gt;<br />
&lt;/catch&gt;</p>
<p>&lt;field name=&#8221;getInput&#8221; type=&#8221;digits&#8221;&gt;</p>
<p>&nbsp;&lt;prompt&gt;&lt;value expr=&#8221;myPrompt&#8221;/&gt;&lt;/prompt&gt;<br />
&nbsp;&nbsp;&lt;filled&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;if cond=&#8221;myFunction(getInput)&#8221;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;return namelist=&#8221;getInput&#8221;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;else/&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;clear/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;throw event=&#8221;nomatch&#8221;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/if&gt;<br />
&nbsp;&nbsp;&lt;/filled&gt;<br />
&lt;/field&gt;</p>
</blockquote>
<p>This subdialog accepts two parameters – a prompt that is read out to the caller, and a function that is used to validate the input.  The conditional logic in the &lt;filled&gt; block assumes that the function returns a boolean (true/false).</p>
<p>This same subdialog structure can be used to collect input that meets a wide range of validation criteria.  To use this subdialog to collect a 5-digit zip code, we would set the parameters as follows:</p>
<blockquote><p>
// JavaScript function to determine length of a string variable<br />
function isFive(x) {<br />
&nbsp;&nbsp;if (x.length == 5 ) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;return true;<br />
&nbsp;&nbsp;}<br />
    return false;<br />
  }</p>
<p>&lt;var name=&#8221;myPrompt&#8221; expr=&#8221;&#8216;Please enter your five digit zip code.&#8217;&#8221;/&gt;<br />
&lt;var name=&#8221;myFunction&#8221; expr=&#8221;isFive&#8221;/&gt;
</p>
</blockquote>
<p>To use this subdialog to collect and validate a credit card numbers, we would set the parameters as follows:</p>
<blockquote><p>
// JavaScript function to perform a mod 10 check<br />
function mod10Check(x) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// logic of mod 10 check<br />
&nbsp;&nbsp;&nbsp;&nbsp;return true;<br />
    }<br />
    return false;<br />
  }</p>
<p>&lt;var name=&#8221;myPrompt&#8221; expr=&#8221;&#8216;Please enter your credit card number.&#8217;&#8221;/&gt;<br />
&lt;var name=&#8221;myFunction&#8221; expr=&#8221;mod10Check&#8221;/&gt;
</p>
</blockquote>
<p>A sample VoiceXML document, demonstrating how this same basic subdialog can be used to collect different kinds of input <a href="http://www.voiceingov.org/tutorials/sub_db_example.vxml.txt" target="_blank">can be found here</a>.</p>
<p>As this discussion shows, subdialogs are a tremendously powerful tool that can enhance the reusability of code and reduce the maintenance requirements of telephone applications.  So, if you find yourself in a situation where you need to collect the same type of input from a  caller several times during a call flow, take a look at subdialogs.  </p>
<p>Their power and reusability have the potential to make your life a lot easier.</p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=Demystifying+VoiceXML+Subdialogs&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F10%2F06%2Fdemystifying-voicexml-subdialogs%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/413074042" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/06/demystifying-voicexml-subdialogs/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/10/06/demystifying-voicexml-subdialogs/</feedburner:origLink></item>
		<item>
		<title>Code Walk: OSCON 2008 Demo #1: Is Twitter Down? (VXML &amp; JavaScript)</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/406237508/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/29/code-walk-oscon-2008-demo-1-is-twitter-down-vxml-javascript/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 12:57:09 +0000</pubDate>
		<dc:creator>Dan York</dc:creator>
		
		<category><![CDATA[Code Walk]]></category>

		<category><![CDATA[Conferences]]></category>

		<category><![CDATA[Mashups]]></category>

		<category><![CDATA[Microblogging]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Twitter]]></category>

		<category><![CDATA[oscon]]></category>

		<category><![CDATA[VoiceXML]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=60</guid>
		<description><![CDATA[As I mentioned previously over on our Voxeo Talks blog, I&#8217;m going to walk through here in this blog several of the demonstrations that I did at the O&#8217;Reilly Open Source Convention (OSCON) back in July. The slide deck is embedded in the previous post, and I&#8217;m going to jump right to slide 48 where [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "Code Walk: OSCON 2008 Demo #1: Is Twitter Down? (VXML &#38; JavaScript)",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/29/code-walk-oscon-2008-demo-1-is-twitter-down-vxml-javascript/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://blogs.voxeo.com/voxeotalks/2008/08/01/my-oscon2008-presentation-on-voice-mashups-and-identica-microblogging-now-available/">I mentioned previously over on our Voxeo Talks blog</a>, I&#8217;m going to walk through here in this blog several of the demonstrations that I did at the O&#8217;Reilly Open Source Convention (OSCON) back in July. The slide deck is embedded in the previous post, and I&#8217;m going to jump right to slide 48 where I began Demo #1: Is Twitter Down?</p>
<p>This was just a short little demo that was designed to show how VoiceXML can be used with embedded JavaScript/ECMAScript. It performs three basic steps:<br />
<uL>
<li> Connects to www.istwitterdown.com</p>
<li>Uses JavaScript to parse the result
<li>Relays result to caller using Text-To-Speech</ul>
<p>If you&#8217;d like to hear it, you can actually call it - but do note the Big Caveat noted farther down in the article - at either of these numbers:</p>
<ul>
<li> 1-206-701-7091
<li><a href="sip:9996078017@sip.voxeo.net">sip:9996078017@sip.voxeo.net</a>
<li><a href="skype:+990009369996078017">skype:+990009369996078017</a></ul>
<p><strong>WALKING THE CODE</strong></p>
<p>So let&#8217;s take a walk through the code.  The first part is simply the initial VoiceXML starting statements, a declaration of a variable called &#8220;MyData&#8221; and the start of a form called &#8220;F1&#8243;:</p>
<blockquote><pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;vxml version = "2.1"&gt;
  &lt;var name="MyData"/&gt;
  &lt;form id="F1"&gt;
</pre>
</blockquote>
<p>The next part is a JavaScript function that uses the JavaScript &#8220;getElementsByTagName&#8221; function to walk the HTML of the page that is loaded in:<br />
<blockquote>
<pre>
    &lt;script&gt;
      &lt;![CDATA[
          function GetData(d,t,n)  {
            return (d.getElementsByTagName(t).item(n).firstChild.data);
          }
      ]]&gt;
    &lt;/script&gt;
</pre>
</blockquote>
<p>Now I can&#8217;t claim credit for this code - I really just modified the example provided in <a href="http://docs.voxeo.com/voicexml/2.0/frame.jsp?page=data.htm">the VoiceXML documentation for the <tt>&lt;data&gt;</tt> element</a>. The way to think about it is this - the system loads the entire document requested by the &lt;data&gt; element into memory as an XML tree (even though it is in fact HTML). The &#8216;getElementsByTagName&#8217; function then walks the XML tree to find the tag requested.</p>
<p>Let&#8217;s look at how I called the function to see how this makes sense:</p>
<blockquote><pre>
    &lt;block&gt;
      &lt;data name="MyData" src="http://www.istwitterdown.com/"/&gt;
      &lt;assign name="status" expr="GetData(MyData,'a',0)"/&gt;
</pre>
</blockquote>
<p>Now the first line uses the &lt;data&gt; command in VoiceXML to retrieve the contents of the web page at <a href="http://www.istwitterdown.com/">www.istwitterdown.com</a> and assign that to a variable called &#8220;MyData&#8221;.</p>
<p>The second line calls the JavaScript function above with the &#8220;MyData&#8221; variable and says that I am interested in all the &lt;a&gt; tags and specifically the first &lt;a&gt; tag (numbered &#8220;0&#8243;).  Now to figure out what tag I wanted, I didn&#8217;t honestly do anything overly brilliant.  I just went to <a href="http://www.istwitterdown.com/">www.istwitterdown.com</a>, did a &#8220;View Page Source&#8221; in my browser and then looked for where the word &#8220;No&#8221; appeared in the body text. Now this site happens to have a <em>very</em> simple page structure and so finding the node to use was trivial:</p>
<blockquote><pre>&lt;body&gt;
&lt;h1&gt;&lt;a href="<em>link removed</em>"&gt;No&lt;/a&gt;&lt;/h1&gt;</pre>
</blockquote>
<p>So the site had the content I wanted (&#8221;No&#8221; or &#8220;Yes&#8221;) right in the very first &lt;a&gt; tag. Filling in the contents of the getElementsByTagName call with the variables sent to the JavaScript function, it looked like this:</p>
<blockquote><pre>d.getElementsByTagName('a').item(0).firstChild.data</pre>
</blockquote>
<p>Which translates to wanting the &#8220;data&#8221; of the first &lt;a&gt; tag in the document.  In this case, &#8220;No&#8221; or &#8220;Yes&#8221;.</p>
<p>This data is then assigned to the VoiceXML variable &#8220;status&#8221;.</p>
<p>The rest of the VoiceXML app is then simply branching on what the &#8220;status&#8221; variable is. If it is &#8220;No&#8221;, then Twitter is up. (A bit of a double negative kind of thing going on.)  If it is anything else, the site is down:</p>
<blockquote><pre>
      &lt;if cond="status=='No'"&gt;
          &lt;prompt&gt;Twitter is currently up.  Yea!&lt;/prompt&gt;
      &lt;else/&gt;
          &lt;prompt&gt;Twitter is currently down. &lt;/prompt&gt;
      &lt;/if&gt;
    &lt;/block&gt;
   &lt;/form&gt;
&lt;/vxml&gt; </pre>
</blockquote>
<p>I then close off the block, the form and the VXML file.  Note that I could have checked to see if <tt>status==&#8217;Yes&#8217;</tt> but I just made the assumption that if it was <em>not</em> &#8220;No&#8221; then there was a problem with Twitter.</p>
<p><strong>THE BIG CAVEAT</strong></p>
<p>Which does bring me to the big caveat of this application - because I was relying on some other web site (istwitterdown.com in this case) I made a big assumption <em>that the external site would work!</em></p>
<p>It didn&#8217;t.</p>
<p>When I was out at OSCON, I was delighted by the fact that at one point <em>Twitter was actually down</em>! However, throughout all the time that Twitter was down and despite multiple browser hard refreshes, the www.istwitterdown.com site always said &#8220;No&#8221;, meaning Twitter was up.</p>
<p><em>Oops.</em></p>
<p>Now, the site <em>did</em> work in the past. I know because I used it successfully when Twitter was going up and down earlier this year.  However, sometime along the way whatever logic the folks at the site were using to detect that Twitter was down seemed to stop working.  Or, at least it stopped working on the day that I was testing it. Maybe it&#8217;s working now&#8230; I don&#8217;t know&#8230; the good news is that Twitter hasn&#8217;t been down much at all in recent weeks.</p>
<p>Anyway, it&#8217;s a good lesson that if you rely on external sites, you do need to ensure that the external site is in fact giving you the correct data that you want.</p>
<p><strong>WRAPPING UP</strong></p>
<p>I hope this little example gave you a useful glimpse into how VoiceXML&#8217;s <tt>&lt;data&gt;</tt> tag can be used to pull in web pages and how JavaScript can be used to parse those web pages.  More information can be found on <a href="http://docs.voxeo.com/voicexml/2.0/frame.jsp?page=data.htm">the VoiceXML documentation page for the data element</a>. I would encourage you to read both the main documentation page as well as the comments to that page.</p>
<p>In my next blog posts walking through my subsequent OSCON 2008 demos, I&#8217;ll explore what else can be done with the data element and other tools. Stay tuned&#8230;</p>
<hr />
<p><strong>THE WHOLE CODE</strong></p>
<p>For those of you who want to do a straight copy-and-paste to play with the code, here it is in its entirety:</p>
<blockquote><pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;vxml version = "2.1"&gt;
  &lt;var name="MyData"/&gt;
  &lt;form id="F1"&gt;
    &lt;script&gt;
      &lt;![CDATA[
          function GetData(d,t,n)  {
            return (d.getElementsByTagName(t).item(n).firstChild.data);
          }
      ]]&gt;
    &lt;/script&gt;
    &lt;block&gt;
      &lt;data name="MyData" src="http://www.istwitterdown.com/"/&gt;
      &lt;assign name="status" expr="GetData(MyData,'a',0)"/&gt;
      &lt;if cond="status=='No'"&gt;
          &lt;prompt&gt;Twitter is currently up.  Yea!&lt;/prompt&gt;
      &lt;else/&gt;
          &lt;prompt&gt;Twitter is currently down. &lt;/prompt&gt;
      &lt;/if&gt;
    &lt;/block&gt;
   &lt;/form&gt;
&lt;/vxml&gt; </pre>
</blockquote>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/voicexml" rel="tag">voicexml</a>, <a href="http://technorati.com/tag/voxeo" rel="tag">voxeo</a>, <a href="http://technorati.com/tag/javascript" rel="tag">javascript</a>, <a href="http://technorati.com/tag/ecmascript" rel="tag">ecmascript</a>, <a href="http://technorati.com/tag/oscon" rel="tag">oscon</a>, <a href="http://technorati.com/tag/oscon2008" rel="tag">oscon2008</a>
</p>
<p><!-- Technorati Tags End --></p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=Code+Walk%3A+OSCON+2008+Demo+%231%3A+Is+Twitter+Down%3F+%28VXML+%26amp%3B+JavaScript%29&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F09%2F29%2Fcode-walk-oscon-2008-demo-1-is-twitter-down-vxml-javascript%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/406237508" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/29/code-walk-oscon-2008-demo-1-is-twitter-down-vxml-javascript/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/29/code-walk-oscon-2008-demo-1-is-twitter-down-vxml-javascript/</feedburner:origLink></item>
		<item>
		<title>Moshe Yudkowsky updates his CCXML video tutorials…</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/386870657/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/08/moshe-yudkowsky-updates-his-ccxml-video-tutorials/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 17:47:31 +0000</pubDate>
		<dc:creator>Dan York</dc:creator>
		
		<category><![CDATA[CCXML]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=58</guid>
		<description><![CDATA[Back in April, I wrote about some video tutorials about CCXML that Moshe Yudkowsky had made available.  While the videos worked okay, Moshe has gone and re-encoded the videos and made them available in both Flash Video and AVI formats.  You can now get them at:

CCXML Workshop, Part 1
CCXML Workshop, Part 2

Each video [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "Moshe Yudkowsky updates his CCXML video tutorials&#8230;",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/08/moshe-yudkowsky-updates-his-ccxml-video-tutorials/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p>Back in April, <a href="http://blogs.voxeo.com/voxeodeveloperscorner/2008/04/03/want-to-learn-about-ccxml-a-slideaudio-tutorial-is-now-online/">I wrote about</a> some video tutorials about CCXML that Moshe Yudkowsky had made available.  While the videos worked okay, Moshe has gone and re-encoded the videos and made them available in both Flash Video and AVI formats.  You can now get them at:</p>
<ul>
<li><a href="http://blip.tv/file/790382">CCXML Workshop, Part 1</a></p>
<li><a href="http://blip.tv/file/796040">CCXML Workshop, Part 2</a>
</ul>
<p>Each video runs between 1 to 1.5 hours and are part of a half-day tutorial session that Moshe gave a year ago at SpeechTEK 2007.</p>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/tutorials" rel="tag">tutorials</a>, <a href="http://technorati.com/tag/ccxml" rel="tag">ccxml</a>, <a href="http://technorati.com/tag/voicexml" rel="tag">voicexml</a>, <a href="http://technorati.com/tag/speechtek" rel="tag">speechtek</a>, <a href="http://technorati.com/tag/voxeo" rel="tag">voxeo</a>
</p>
<p><!-- Technorati Tags End --></p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=Moshe+Yudkowsky+updates+his+CCXML+video+tutorials%26%238230%3B&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F09%2F08%2Fmoshe-yudkowsky-updates-his-ccxml-video-tutorials%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/386870657" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/08/moshe-yudkowsky-updates-his-ccxml-video-tutorials/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/09/08/moshe-yudkowsky-updates-his-ccxml-video-tutorials/</feedburner:origLink></item>
		<item>
		<title>Prophecy 9 Early Access release now out on Mac OS X, Linux and WIndows</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/376474675/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/27/prophecy-9-early-access-release-now-out-on-mac-os-x-linux-and-windows/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 20:19:34 +0000</pubDate>
		<dc:creator>Dan York</dc:creator>
		
		<category><![CDATA[Prophecy]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=57</guid>
		<description><![CDATA[When we announced last week that a &#8220;early access&#8221; release of Prophecy 9 was available, the software was actually only available that day on Mac OS X.  Now, however, the Prophecy 9 early access release is out on all three platforms: Windows, Linux and Mac OS X.  You can download it from www.voxeo.com/prophecy [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "Prophecy 9 Early Access release now out on Mac OS X, Linux and WIndows",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/27/prophecy-9-early-access-release-now-out-on-mac-os-x-linux-and-windows/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p>When <a href="http://blogs.voxeo.com/voxeotalks/2008/08/19/voxeo-announces-prophecy-9-with-new-management-ui-new-sip-apis-and-linux-and-mac-os-x-support/">we announced last week that a &#8220;early access&#8221; release of Prophecy 9 was available</a>, the software was actually only available <em>that day</em> on Mac OS X.  Now, however, the Prophecy 9 early access release is out on all three platforms: Windows, Linux and Mac OS X.  You can download it from <a href="http://www.voxeo.com/prophecy">www.voxeo.com/prophecy</a> in the Prophecy 9 - Early Access column a little bit down the page.  The software is still in very active development, so we&#8217;ll be posting updated versions over time and yes, some things may not work exactly right.  </p>
<p>Please do check it out if you are interested in seeing the future of our application platform - and please do send along any comments and feedback that you have.  We definitely do appreciate it all. </p>
<p><!-- Technorati Tags Start --></p>
<p>Technorati Tags:<br />
<a href="http://technorati.com/tag/voxeo" rel="tag">voxeo</a>, <a href="http://technorati.com/tag/prophecy" rel="tag">prophecy</a>, <a href="http://technorati.com/tag/windows" rel="tag">windows</a>, <a href="http://technorati.com/tag/linux" rel="tag">linux</a>, <a href="http://technorati.com/tag/macosx" rel="tag">macosx</a>
</p>
<p><!-- Technorati Tags End --></p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=Prophecy+9+Early+Access+release+now+out+on+Mac+OS+X%2C+Linux+and+WIndows&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F08%2F27%2Fprophecy-9-early-access-release-now-out-on-mac-os-x-linux-and-windows%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/376474675" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/27/prophecy-9-early-access-release-now-out-on-mac-os-x-linux-and-windows/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/27/prophecy-9-early-access-release-now-out-on-mac-os-x-linux-and-windows/</feedburner:origLink></item>
		<item>
		<title>VoiceXML Variable Scoping</title>
		<link>http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~3/363988710/</link>
		<comments>http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/13/voicexml-variable-scoping/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 15:43:43 +0000</pubDate>
		<dc:creator>voxeojeremyr</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[VoiceXML]]></category>

		<guid isPermaLink="false">http://blogs.voxeo.com/voxeodeveloperscorner/?p=45</guid>
		<description><![CDATA[
Here in Support we get a fair amount of tickets asking about variables.  Namely, if a variable is created in a form can it be accessed in the field of that form or in a different form?  What I am talking about is called variable scoping.  In VXML there are several different variable scopes.  [...]

<script type="text/javascript">
SHARETHIS.addEntry({
	title: "VoiceXML Variable Scoping",
	url: "http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/13/voicexml-variable-scoping/"
});
</script>
	]]></description>
			<content:encoded><![CDATA[<p><img src="http://blogs.voxeo.com/voxeodeveloperscorner/files/2008/01/voicexmlcertifieddeveloper.gif" alt="VoiceXML certified developer logo" align="right" height="150"><br />
Here in Support we get a fair amount of tickets asking about variables.  Namely, if a variable is created in a form can it be accessed in the field of that form or in a different form?  What I am talking about is called variable scoping.  In VXML there are several different variable scopes.  You might have heard of global and local variables with other programming languages.  VXML, while not a programming language, is similar in how it approaches variables and how they can be accessed. </p>
<p>First lets get a proper definition for variable scope.  The scope of a variable defines when and where the variable exists and may be accessed. When the VXML browser exits the scope where the variable is defined, the variable is out-of-scope and cannot be accessed. When a variable is in scope, it can be accessed by both VoiceXML and ECMAScript.</p>
<p>Here is a table of the different scope levels of variables in VXML:<br />
<TABLE border="”1″"><br />
<TR><br />
<TH>Scopes</TH><br />
<TH>Declared In</TH><br />
<TH>Initialized In</TH><br />
<TH>Where accessible</TH><br />
<TH>Becomes Unavailable</TH><br />
</TR><br />
<TR><br />
<TD>Session</TD><br />
<TD>By the VXML browser </TD><br />
<TD>At the beginning of a session </TD><br />
<TD>Anytime during the session </TD><br />
<TD>At the end of the session </TD><br />
</TR><br />
<TR><br />
<TD>Application </TD><br />
<TD>In the root document </TD><br />
<TD>When VXML browser loads the root document </TD><br />
<TD>Throughout the application </TD><br />
<TD>When the VXML browser leaves the root document </TD><br />
</TR><br />
<TR><br />
<TD>document </TD><br />
<TD>In the &lt;vxml&gt; document </TD><br />
<TD>When the VXML browser loads the document </TD><br />
<TD>Within the &lt;vxml&gt; element </TD><br />
<TD>When VXML browser leaves the document </TD><br />
</TR><br />
<TR><br />
<TD>dialog </TD><br />
<TD>In the &lt;field&gt; element of a &lt;form&gt; or &lt;menu&gt; element </TD><br />
<TD>When the VXML browser loads the element </TD><br />
<TD>Within the element </TD><br />
<TD>When the VXML browser leaves the element </TD><br />
</TR><br />
<TR><br />
<TD>anonymous </TD><br />
<TD>In a &lt;block&gt;, &lt;filled&gt; or &lt;catch&gt; element </TD><br />
<TD>When the VXML browser begins to interpret the element </TD><br />
<TD>Within the element</TD><br />
<TD>When the VXML browser leaves the element </TD><br />
</TR><br />
</TABLE></p>
<p>Here is an example of document scoped variable.  As you can see it is accessible throughout the current VXML document.</p>
<blockquote><p>
&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;vxml version=&#8221;2.0&#8243;&gt;</p>
<p>&lt;var name = &#8220;counter&#8221; expr = &#8220;0&#8243;/&gt;</p>
<p>&lt;form id=&#8221;F_1&#8243;&gt;<br />
&lt;!&#8211; additional VXML code &#8211;&gt;<br />
&lt;filled&gt;<br />
&lt;assign name=&#8221;counter&#8221; expr = &#8220;counter + 1&#8243;/&gt;<br />
&lt;/filled&gt;<br />
&lt;/form&gt;</p>
<p>&lt;form id=&#8221;F_2&#8243;&gt;<br />
&lt;!&#8211; additional VXML code &#8211;&gt;<br />
&lt;filled&gt;<br />
&lt;assign name=&#8221;counter&#8221; expr = &#8220;counter + 2&#8243;/&gt;<br />
&lt;/filled&gt;<br />
&lt;/form&gt;</p>
<p>&lt;/vxml&gt;
</p></blockquote>
<p>Here is an example of a dialog scoped document.  In form &#8220;F_1&#8243; the value of &#8220;counter&#8221; after the assign &lt;element&gt; would be 1.  In form &#8220;F_2&#8243; the value after the &lt;assign&gt; value would be 2.</p>
<blockquote><p>
&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;vxml version=&#8221;2.0&#8243;&gt;</p>
<p>&lt;form id=&#8221;F_1&#8243;&gt;<br />
&lt;!&#8211; additional VXML code &#8211;&gt;<br />
&lt;filled&gt;<br />
&lt;var name = &#8220;counter&#8221; expr = &#8220;0&#8243;/&gt;<br />
&lt;assign name=&#8221;counter&#8221; expr = &#8220;counter + 1&#8243;/&gt;<br />
&lt;/filled&gt;<br />
&lt;/form&gt;</p>
<p>&lt;form id=&#8221;F_2&#8243;&gt;<br />
&lt;!&#8211; additional VXML code &#8211;&gt;<br />
&lt;filled&gt;<br />
&lt;var name = &#8220;counter&#8221; expr = &#8220;0&#8243;/&gt;<br />
&lt;assign name=&#8221;counter&#8221; expr = &#8220;counter + 2&#8243;/&gt;<br />
&lt;/filled&gt;<br />
&lt;/form&gt;</p>
<p>&lt;/vxml&gt;
</p></blockquote>
<p>It is also good to know that variable references will match the closest applicable scope. You can prefix a reference with a scope name, such as application.counter, for clarity or to resolve ambiguity.</p>
<p>We hope this clears up a little confusion about VXML variables and where they are defined and when they can accessed.</p>
<p>Jeremy Richmond<br />
VXML Certified Developer</p>
<p><a href="http://sharethis.com/item?publisher=c0af778a-87ab-41b4-be56-8ec058cd3e46&title=VoiceXML+Variable+Scoping&url=http%3A%2F%2Fblogs.voxeo.com%2Fvoxeodeveloperscorner%2F2008%2F08%2F13%2Fvoicexml-variable-scoping%2F">ShareThis</a></p><img src="http://feeds.voxeo.com/~r/VoxeoDevelopersCorner/~4/363988710" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/13/voicexml-variable-scoping/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.voxeo.com/voxeodeveloperscorner/2008/08/13/voicexml-variable-scoping/</feedburner:origLink></item>
	</channel>
</rss>
