Platform SDK: Web Telephony Engine

Using Other Web Technologies

You can use many other Web technologies in your Web telephony applications besides HTML. This section describes these other technologies. For information about specific topics, see the following sections:

ActiveX Controls

You can insert any ActiveX controls into your HTML pages to provide customized functionality. These ActiveX controls can be ones that you created or bought from a third-party vendor. For more information about ActiveX controls, see the MSDN library.

Automation

Any Automation object available to the WebBrowser control can be controlled in a Web telephony application. You might use Microsoft Excel, for example, to carry out some mathematical functions by launching it without displaying it, putting some numbers in some cells, and calling an Excel function to evaluate the results.

Set objExcelApp = CreateObject(Excel.Application)
Set objWks = objExcelApp.Open("Temp.XLS")
...
Set objExcelApp = Nothing 

Some automation objects are not secure and may cause Internet Explorer to display a warning message. Before using an automation object in a WTE application, you should check that the object is secure by running it under Internet Explorer. Alternatively, you can check an automation object by running it under WTE while the WTE service is running in window mode (see Running the Web Telephony Service in Window Mode).

For more information about Automation, see the MSDN library.

Client-side Scripting

You can use scripts in VBScript or JScript (or both languages) on your HTML pages. For more information about scripting, see the MSDN library.

Dynamic HTML

You can use any dynamic HTML (DHTML) functionality in your Web telephony applications. For example, you can change the inner text of an element to provide lengthier descriptions to new users.

For more information about DHTML, see the Web Workshop on the MSDN Web site.

ODBC Databases

You can access any ODBC database from your Web telephony applications. You can use any Internet technology that you would normally use to access databases from an HTML page, such as Visual Database Tools or ActiveX Data Objects (ADO).

You use Automation scripting or ActiveX controls as you would with any Web page that accesses an ODBC database.

Set DB = CreateObject(ADO.CreateConnection)

Scriptlets

The WTE supports scriptlets. This section describes scriptlets and explains how to use them in an application. For information on specific topics, see the following sections:

Introducing Scriptlets

Scriptlets are a standard feature of Internet Explorer. They allow you to take a combination of HTML elements, encapsulate them as an object, and then use the object again as needed. For example, suppose you need to use the same menu in several places in your Web telephony application. You could define the elements for this menu on one page, encapsulate them as a scriptlet object, and use the object anywhere you needed the menu. You could also use scriptlets to keep a library of frequently used configuration settings for various applications, or to present special graphical user interface elements in a dual-access application.

You insert a scriptlet onto a page as an object of type "scriptlet", supplying the relative or absolute path to the HTML page that contains the scriptlet HTML code.

A scriptlet may or may not have a visual UI. If it does, you can define the size of the window for the UI when inserting a scriptlet into a page. A scriptlet might not have a UI if it contains only scripts and no visual elements.

Advantages and Benefits

A key advantage to using scriptlets is that you only need to write the HTML once. Another advantage is that if you need to make changes, you only need to edit one HTML page and any changes are reflected in all instances of the object.

The main benefit of scriptlets is that they can expose properties, methods, and events as if they where COM objects, making their capabilities easy to use inside the hosting document. A scriptlet's properties and methods can be called from scripts on any page where the scriptlet is inserted.

Scriptlets in Web Telephony Applications

The WTE fully supports scriptlets, but slightly differently than Internet Explorer. In general, the WTE treats HTML code in a scriptlet as an extension to the host document. This means that the code is rendered under the hosting OBJECT element as if it was cut and pasted there. This allows you to create rich menu items, buttons, and so on, and embed them into different documents. However, as in Internet Explorer, a scriptlet is a completely different document and does not inherit any property from its host. For example, if the host's text color is red, it does not influence the color of the text inside the scriptlet. In a Web telephony application, no TTS rendering, voice file, and so forth, in the host influences the scriptlet.

The following example contains a menu in which the second item is a scriptlet whose UI is defined by OtherItems.htm and with functionality accessible through public interfaces. Note that this scriptlet actually can contain several menu items that will be joined with "ITEM1" and "Akey4".

<BODY>
<A ID="ITEM1" HREF="#ID0">Item1 </A><BR>
<object data="OtherItems.htm" type="text/x-scriptlet"></object>
<A id="AKey4" HREF="#ID0">Last Item </A><BR>
</BODY>

For the WTE to render a scriptlet's HTML document, the scriptlet must expose the document through a property named WTEScriptletDocument. For example:

public_description = new MyScriptlet(); 
function MyScriptlet() { 
    this.get_WTEScriptletDocument = DoGetDoc; 
} 
function DoGetDoc() { 
    return document; 
} 

If the scriptlet does not expose the WTEScriptletDocument property, or exposes anything else through this property, it is ignored by the WTE. Also, because it does not support rendering a FRAMESET scriptlet, the WTE also ignores such a scriptlet and generates a log warning.

To access the WTE External object from a scriptlet, use the window.parent.external property. Alternatively, an application can pass the External object to the scriptlet by defining a special property such as "IVRExternal" that has a "put" method, and setting the External object from the host.

Server-side Scripting

You can use ASP pages to do server-side scripting.

If you want to verify a password, for example, you don't want to put the valid values into a client-side script that users could easily view.

Other examples of server-side scripting include getting dynamically requested information from a database and formatting this as a standard HTML table that is returned to the user in standard HTML elements.

For more information about server-side scripting, see the Web Workshop on the Microsoft Developer Network (MSDN) Web site.