CCXML 1.0 Development Guide Home  |  Frameset Home


<script>  element

A <script> element may occur in a <ccxml> element and in executable content. <transition> elements and <if> elements contain executable content.

Script elements in a <ccxml> element are evaluated just after the document is loaded, along with the <var> and <assign> elements, in document order. Script elements in a <transition> element are evaluated as they are encountered. A <script> element in an <if> element is executed like other executable elements, as it is encountered.

The Voxeo implementation of the <script> element includes additional, platform-specific support for two features usable by the developer:



usage
<script fetchid="(ECMAScript Expression)" maxage="CDATA" maxstale="CDATA" src="(ECMAScript Expression)" timeout="(ECMAScript Expression)">


attributes
fetchid Data Type: (ECMAScript Expression) Default: Optional
The fetchid attribute allows the developer to specify an ECMAScript expression evaluating to the fetch identifier of a completed fetch request. This value is acquired via  either in a fetch with the fetchid attribute, or from the fetchid attribute of a fetch.done event. In the event that the identiier is invalid, the fetch is not completed, or if the fetched content is not valid ECMAScripot, then an error.semantic will be thrown to the CCXML interpreter.
maxage Data Type: CDATA Default: Optional
The maxage and maxstale attributes specify the maximum acceptable staleness, in seconds, of the resource in question. However, it is strongly advised not to rely on this attribute for cache-control; caching is always best controlled by the hosting server's response headers. If no headers are specified, then no cache control will be present, regardless of the value set for the maxage and maxstale attributes.
maxstale Data Type: CDATA Default: Optional
The maxage and maxstale attributes specify the maximum acceptable staleness, in seconds, of the resource in question. However, it is strongly advised not to rely on this attribute for cache-control; caching is always best controlled by the hosting server's response headers. If no headers are specified, then no cache control will be present, regardless of the value set for the maxage and maxstale attributes.
src Data Type: (ECMAScript Expression) Default: none - attribute is optional
The src atttribute indicates the URI of the <script> to be executed. If unspecified, then the elements CDATA provides the inline content.
timeout Data Type: (ECMAScript Expression) Default: Optional
The timeout attribute specifies the amount of time to allow the fetch attempt to be made. If the fetch is not successful by the end of the duration specified, then an error.fetch will be thrown.



parents
none


children
none


code samples
<1.0 script -src-timeout> sample
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml">

    <script src="myScript.js" timeout="'10s'"/>

    <eventprocessor>
<transition event="connection.alerting" name="evt">
  <accept/>
          <log expr="'***** CALL ACCEPTED *****'"/>
</transition>

<transition event="connection.connected" name="evt">
  <dialogstart src="'null://?text=' + message" type="'application/x-texttospeech'"/> 
</transition>

        <transition event="dialog.exit">
          <log expr="'***** CALL EXITING *****'"/>
          <exit/>
        </transition>

<transition event="error.*" name="evt">
<log expr="'ERROR OCCURRED: '+ evt.name"/>
        <exit/>
</transition>
</eventprocessor>

</ccxml>

<myScript.js>
// simple js code for CCXML example

var sympathy = 'Pleased to meet you. I hope you guess my name. ';
var devil = 'But, whats puzzling you is the nature of my game. hoo! hoo!';
var message = sympathy + devil;



additional links
W3C Specification


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2006 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site