Platform SDK: Web Telephony Engine

Using the %1 and %2 Notation

The WTE provides a convenient way for you to include the DTMF digit in the announcements for menu items. It involves using the %1 notation in the VOICEFILE attribute and the cue, cue-before, and cue-after style properties.

TTS-Rendered Menu Items

For menus items to be rendered using TTS, you can include %1 wherever you want the DTMF digit to be mentioned. As the WTE renders the item, it replaces all occurrences of %1 with the item's assigned DTMF digit. Using the %1 notation frees you from having to keep track of the DTMF digits that WTE assigns to your menu items.

The following example shows how to use the %1 notation:

<A HREF="account.htm" STYLE="cue-before:For; cue-after:press %1">Account Balance</A>
<A HREF="xaction.htm" STYLE="cue-before:For; cue-after:press %1">Transaction History</A>

In the previous example, if the InitialAutoNumber property were to specify an empty string, the menu items would be assigned the DTMF digits 1 and 2. However, if InitialAutoNumber were to specify a value of, for example, 13, the menu items would be assigned the DTMF digits 13 and 14.

Menu Items with Wave Files

For menu items that have wave files associated with them, you can use the %1 notation in the names of the files specified in the VOICEFILE attribute and the cue, cue-before, and cue-after style properties. For example, consider the following menu:

<P VoiceFile = "Welcome.wav">
<A Voicefile = "ForBooks,wav" STYLE = "cue-after: 'URL(Press%1.wav)'">Books</A><BR>
<A Voicefile = "ForSales.wave" STYLE = "cue-after: 'URL(Press%1.wav)'">Sales</A><BR>
<A Voicefile = "ForInfo.wav" STYLE = "cue-after: 'URL(Press%1.wav)'">Information</A><BR>
</P>

The application author, not wanting to use TTS, created wave files named Press1.wav, Press2.wav, and so on. These wave files contain the phrases "Press 1", "Press 2", and so on. The WTE, when assigning the access keys for each item, substitutes the number of an item's access key for the %1 in the file name. The WTE performs this substitution for the VOICEFILE attribute and all cues properties. The WTE would render the previous example as follows:

"Welcome to our customer service line." (from Welcome.wav)
"For books" (from ForBooks.wav) "press 1" (from Press1.wav)
"For sales"(from ForSales.wav) "press 2" (from Press2.wav)
"For information" (from ForInfo.wav) "press 3" (from Press3.wav)

Using the %1 notation is especially useful when creating dynamic menus that have a variable number if items and you cannot know in advance what the assigned access key values will be. In this case, you would record in advance all the possible "Press" phrases, and use %1 in the VOICEFILE attributes and cues. In this way, you will get correct menu announcements without having to use TTS.

Check Boxes and Stand-alone Buttons

For check boxes and stand-alone buttons, you can use the %1 and %2 notation.

The WTE treats a check box as a menu that has two options, selected or cleared. The WTEApplication.SelectCheckBoxKey and ClearCheckBoxKey properties define the DTMF digits that the caller uses to select or clear a check box. In the VOICEFILE attribute or cue properties of a check box, you can use the %1 notation to refer to the select digit, and the %2 notation to refer to the clear digit.

For example, suppose the SelectCheckBoxKey property is "3", the ClearCheckBoxKey property is "4", and you create the following check box:

<INPUT STYLE = "cue-after: 'URL(Clear%2.wav)'" VoiceFile="Select%1.wav" TYPE = CHECKBOX OnClick="Function1();">

The announcement for this check box would consist of phrases from the files named Select3.wav and Clear4.wav.

A stand-alone button is a button created either by the BUTTON element, or by the INPUT TYPE=button element outside of a FORM element. Like check boxes, the WTE treats a stand-alone button as a menu that has two options. In the case of stand-alone buttons, the options are clicked and skipped.

The WTEApplication.ClickButtonKey and SkipButtonKey properties define the DTMF digits that the caller uses to click or skip a stand-alone button. In the VOICEFILE attribute or cue properties of a stand-alone button, you can use the %1 notation to refer to the clicked digit, and the %2 notation to refer to the skip digit.

For example, suppose the ClickButtonKey property is "5", the SkipButtonKey property is "7", and you create the following stand-alone button:

<BUTTON STYLE = "cue-before: 'For'; cue-after: 'Press %1, To Skip press %2'" OnClick="Function1()">Books</BUTTON> 

The WTE would render the button using TTS as follows:

"For Books press 5, To Skip press 7"

Suppose you create the following stand-alone button, keeping the same digits for the click and skip buttons:

<INPUT VoiceFile="Press%1Skip%2.wav" TYPE=BUTTON VALUE="Perform Something" OnClick="Function1();">

The announcement for this button would consist of phrases from the file named Press5Skip7.wav.