Platform SDK: Web Telephony Engine |
The WTE maintains a large set of configuration parameters for an application, and exposes the parameters through the WTEApplication object. This object is intended for third-party vendors to create programs that install and configure Web telephony applications. In addition, authors of Web telephony applications can use this object to change an application's configuration parameters dynamically at run time.
There are two ways to retrieve the WTEApplication object. First, third-party installation and configuration programs can use the COM interfaces exposed for administrative purposes through the WTE object. Changing the configuration through this object changes the stored configuration parameters of the given Web telephony application (after the program calls the Save method). For more information, see The Web Telephony Object Model.
The second way to retrieve the WTEApplication object is to use the Configuration property of the External object. For example, an application can use the following code in a script to retrieve the WTEApplication object for the active call:
set conf = window.external.configuration
An application can use the WTEApplication object to query and change its parameters dynamically through the ExOM. The changes affect only the active call and last only the duration of the session.
When an application dynamically changes a configuration parameter, the change affects all pages that the caller subsequently visits. If you want a change to affect only a particular page, you must save the parameter's old setting as the page is loaded, change the setting, and then restore the old setting when the page is unloaded. Typically, an application saves and changes a parameter by using an immediate script, and restores the parameter's old setting by using a handler for the onunload event on the BODY element.
The following example shows an immediate script that saves and changes the settings of the OfferItems, UserSR, and FirstTimeoutInterval properties:
<SCRIPT LANGUAGE="JSCRIPT"> var CallConfiguration; var PreviousOfferItems, PreviousUseSR, PreviousTimeOut; var IsMSWTE = (typeof(window.external.hostName) == "string") if( IsMSWTE == true) { IsMSWTE = (window.external.hostName == "Microsoft Web Telephony Engine"); } if( IsMSWTE == true) { CallConfiguration=window.External.Configuration; PreviousOfferItems = CallConfiguration.OfferItems; CallConfiguration.OfferItems = false; PreviousUseSR = CallConfiguration.UseSR; CallConfiguration.UseSR = true; PreviousTimeOut = CallConfiguration.FirstTimeoutInterval; CallConfiguration.FirstTimeoutInterval = 30; } </SCRIPT>
The following example shows an onunload event handler that restores the parameter settings that were changed in the previous example:
<BODY onunload="CancelPageSettings();"> <SCRIPT LANGUAGE="JSCRIPT"> function CancelPageSettings() { var IsMSWTE = (typeof(window.external.hostName) == "string") if( IsMSWTE == true) { IsMSWTE = (window.external.hostName == "Microsoft Web Telephony Engine"); } if( IsMSWTE == true) { CallConfiguration.OfferItems = PreviousOfferItems; CallConfiguration.UseSR = PreviousUseSR; CallConfiguration.FirstTimeoutInterval = PreviousTimeOut; } } </SCRIPT>
<!-- put page content here. --> </BODY>
The properties of the WTEApplication object provide access to several configuration parameters. For example, one group of properties defines the phone keys that the caller uses to navigate and interact with the application. Another group determines the text or wave files that the WTE plays when the caller presses a non-valid key or waits too long before responding. The following sections briefly describe the properties of the WTEApplication object (for more detailed information, see Objects in the WTE Reference section):