Created by: Janine Graves on 10-01-2007 06:03:11 PM regarding the javascript that we can put into the Properties of the project in Studio 5.1.3:
1. what information can that javascript access, does it have access to the session, element, call data?
2. does it execute on the app server or on the voice browser?
3. when does it execute? at the start of the app, or when you invoke it? If you have to invoke it, then must that be done from java code, or can you do it in Studio? Or it must be invoked from vxml code?
4. where is this documented?
Subject: RE: javascript Replied by: Vance Vagell on 11-01-2007 08:02:13 PM Hi Janine,
Javascript (also called Ecmascript) that you include in your voice app'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").
Regards, Vance
Subject: RE: javascript Replied by: Janine Graves on 15-01-2007 03:27:19 AM Thanks for the information.
But, what did Audium have in mind when they added the ability to add Javascript into Studio 5.1.3? There must have been some need for it, do you have any good examples of when your customers might use it with Audium?
Thanks.
Subject: RE: javascript Replied by: Vance Vagell on 16-01-2007 08:19:09 PM Hi Janine,
Support for Ecmascript is a feature of VoiceXML (per section 5.3.12 of the VoiceXML 2.09 spec), and as we strive to ensure that all VoiceXML functionality is easily accessible using Audium software we have added root document Ecmascript support to Studio. A few examples of why one might use Ecmascript are as follows:
To parse user input that was gathered via the <object> tag. Some voice browsers provide the ability to gather input and store it in proprietary Java objects rather than strings, and developers may wish to process those objects on the browser-side to make decisions and/or play back data.
To access simple information that is available in Ecmascript, such as the current time.
To perform simple calculations or string operations. For example, Call Services already uses Ecmascript to pre-process input given to the Form element before it is submitted back.
We hope that you find these examples helpful. If you have further questions, please do not hesitate to ask.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: