Using context files

This section describes how to create a context file and how to refer to it from within your VoiceXML documents.

You can set properties within <property> elements in any VoiceXML document in your application. However, this means that if you want to change a property in the course of application tuning, you must locate it in the appropriate VoiceXML document and change it there. This can be a cumbersome process if your application is large and you have many properties to modify.

As an alternative, you can define all properties in a context file to simplify the tuning process. This is an XML file that you can import into a VoiceXML document. It specifies values for each property at each point in the application. You specify a context file as a hook in the VoiceXML files at development time. Later, a tuning expert simply edits the context file and adds, removes, and modifies the properties as appropriate. This technique eliminates the need for a tuning expert to have intricate knowledge of VoiceXML.

For example, this context file sets timeout values for the “vary_timeout” and “confirmation” fields from our previous example:

<?xml version="1.0"?>
<context>
document-level default properties
   <context>
      <context id="vary_timeout">
      <property name="timeout" value="10s"/>
      </context>
      <context id="confirmation">
      <property name="timeout" value="5s"/>
      </context>
   </context>
</context>

The advantage of this approach is that it puts all properties in a single file, so it’s more convenient to locate and modify each property.

Not all properties are appropriate for use in a context file. Check the property descriptions in VoiceXML properties to determine whether a given property can appear in a context file.