| Article ID: | 305 |
| Last updated: | January 19, 2007 |
| User Opinions |
|
No users have voted.
|
|
Thank you for rating this answer.
|
SUMMARY
This article describes some reasons why you might include Ecmascript in your Audium application's root document for use at runtime.
SYMPTOMS
Developer is wondering if they should use Ecmascript for runtime processing.
RESOLUTION
Javascript (also called Ecmascript) that you include in your voice application's root document is executed by the voice browser. This functionality is useful if you have a need for something to be done on the browser side, such as proprietary browser functionality that is only available via Javascript or to obtain browser-centric information such as the browser's timestamp (note that Call Services has done this latter example for quite some time).
Any Javascript in your voice app's root document is only executed when it is referenced. There is no concept of a "main" method in the root doc that would be executed without being called. It is instead used for putting various utility methods in the root doc for later access from within your app's VoiceXML.
One of the strengths of Audium Call Services is the fact that it leverages a web app architecture and stores session data on the app server; this design takes much of the burden of processing a call and storing data off of the voice browser, and distributes it to the app server. However, since the caller's session is stored on the application server (which includes element, session, call data, and more), that information is not available to Javascript.
As a best practice, it is generally not recommended to use your voice browser to perform CPU-intensive processing or to store large amounts of caller-centric data since it could adversely affect other calls (which need CPU and memory resources for many other purposes). On the other hand, that's precisely what Call Services is meant for: doing the heavy-lifting, and packing the results up into VoiceXML that the voice browser can then execute.
Information about adding Javascript to your app's root doc can be found in the Audium Studio online help (Help -> Help Contents), under "Root Document Settings").
|