UCCX Script Editor Get Digits

The Cisco UCCX Script Editor offers many configurable steps for controlling call flow, including IVR functionality that uses ASR and TTS. Some of the predefined scripting steps do not work well with Capacity Private Cloud (or with some other ASR providers). This article describes an alternate approach that delivers the same Get Digits functionality and works reliably with the platform's ASR.


Create the Grammars

To collect a digit string using either DTMF or voice recognition in the Script Editor, use the Generic Recognition step. First, you need two grammars — one for DTMF and one for voice.

DTMF Grammar

Create the following grammar and save it to a convenient temporary location as SimpleDigitsDTMF.grxml:

<?xml version="1.0" encoding="UTF-8" ?>
<grammar xml:lang="en-US"
         root="rootrule"
         mode="dtmf"
         tag-format="semantics/1.0.2006">
 
    <rule id="rootrule">
        <one-of>
             <item><ruleref uri="builtin:dtmf/digits"/></item>
         </one-of>
         <tag>out.digits = rules.latest();out.dtmf = 0;</tag>
    </rule>
</grammar>

Voice Grammar

Create the following grammar and save it as SimpleDigitsVoice.grxml:

<?xml version="1.0" encoding="UTF-8" ?>
<grammar xml:lang="en-US"
         root="rootrule"
         mode="voice"
         tag-format="semantics/1.0.2006">
 
    <rule id="rootrule">
        <one-of>
             <item><ruleref uri="builtin:grammar/digits"/></item>
         </one-of>
         <tag>out.digits = rules.latest();out.dtmf = 0;</tag>
    </rule>
</grammar>

Upload the Grammars

Upload both grammars to UCCX, into the en_US folder. For other languages, modify the xml:lang tag in the grammars and upload to the corresponding language folder.

  1. Go to the UCCX Administrator.
  2. Open Applications > Grammar Management.
  3. Open the en_US folder (or other language as needed).
  4. Click Upload Grammars.
  5. Click Browse in the grammar upload pop-up.
  6. Find the grammar file on your computer.
  7. Click Upload.
  8. Repeat for the second grammar.

Cisco Unified CCX Administration menu: Applications > Grammar Management

Grammar Management showing the language folders with en_US selected

Grammar Management for the en_US folder with the Upload Grammars button


Build the Script

Create a new script in the UCCX Script Editor, or modify an existing one.

Add the Grammar Parameter Variables

Add two Grammar variables, named DigitsGrammarDTMF and DigitsGrammarVoice, making sure they are defined as Parameter variables:

Two Parameter grammar variables: DigitsGrammarDTMF and DigitsGrammarVoice

Add a Generic Recognition Step

On the General tab, enter a string in Result Name. This can be anything, but you will reference it in a later step. This example uses ASRResult.

Generic Recognition step General tab with Result Name set to ASRResult

On the Prompt tab, enter a prompt variable — the audio played to the caller to request the digits. The exact wording depends on your application.

Generic Recognition step Prompt tab with a prompt variable

On the Filter tab, enter both grammar variables with a || (logical OR) between them, to activate both grammars simultaneously:

Generic Recognition Filter tab with DigitsGrammarDTMF and DigitsGrammarVoice combined with a logical OR

In the Successful branch of the Generic Recognition step, add a Get Recognition Interpretation step.

Successful branch of the Generic Recognition step containing a Get Recognition Interpretation step

In the Get Recognition Interpretation step, add a slot with the slot name digits (case sensitive). For the variable, choose the string variable you want the digits placed in — this example uses Digits.

Get Recognition Interpretation step with Result Name ASRResult and a slot named digits mapped to the Digits variable

Set the Application Grammar Parameters

Finally, when setting up the application in UCCX, fill in the two grammar parameters so the script associates them with the grammar files uploaded earlier.

Cisco Script Application page mapping DigitsGrammarVoice to SimpleDigitsVoice.grxml and DigitsGrammarDTMF to SimpleDigitsDTMF.grxml


Example

The attachment below contains an example Get Digits implementation in .aef script format that can be loaded directly into your Cisco UCCX Script Editor, along with both the voice and DTMF grammars to upload to UCCX.

For an example of how to install and run scripts in UCCX, see UCCX Simple Integration Test.

FileSizeDownload
GetDigitsCodeSample.zip5.8 KBDownload file

Related Articles


Was this article helpful?