ivr advanced auto attendant user guide 2 october 2007

Upload: vid-debelak

Post on 08-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    1/53

    Zultys Technologies

    Page 1 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    IVR Advanced Auto Attendant User Guide

    1 IntroductionIt is very common for a voice application to access data stored in an enterprise database. The mostcommon way is to use a scripting language, such as Perl, ASP or PHP, as a conduit to the database. Thispermits the voice application to take advantage of an infrastructure for getting or storing data that mayalready exist for a Web application that uses the scripting languages mentioned.

    Zultys IVR solution or Advanced Auto Attendant (AAA), available starting from MX30 and MX250release 3.0, extends the ability of the existing Auto Attendant1 to create interactive voice applications byenabling access to databases, and providing the ability to receive information from other sources on theWeb. The AAA is able to supply the common IVR functionality required by most businesses.

    1.1 Audience

    Reader of this document should have ZCSE certification2 and a detailed understanding of the AutoAttendant scripting tool in the MX Admin User Interface. In addition the reader should be familiar withat least one of the scripting languages mentioned in the introduction and a working knowledge of how touse SQL queries to access information in a database. It is also highly recommended that the reader takethe IVR training course offered by Zultys which covers the topics in this document in detail.

    2 IVR Architecture in BriefIn this document, we define the term IVR as the combination of the following components:

    o VoiceService. This is a VoiceXML based application running on MX250;

    o VoiceXML script that controls the VoiceService application;

    o AAA scripting tool, which is a part of the MX Admin UI dedicated to AAA VoiceXML scriptpreparation and loading for execution by the VoiceService application.

    The IVR fully utilizes the ability of VoiceXML to create powerful voice applications that fully utilizeany existing Web-based infrastructure a user may have in place or wish to create. Particularly, whileinteracting with a caller, the IVR may have various transactions with a Web server, where informationthat has been collected from the caller is POSTed back for further processing with the Web serverresponding with additional VoiceXML to be used by the IVR.

    The IVR can be thought of as a standard MX Auto Attendant with several additions.

    1. The ability to communicate with an external Web server. .

    1 Refer to the MX Administrators Manual for a detailed description of the Auto Attendant.2 Zultys Certified Systems Engineer (ZCSE) training is provided by Zultys and teaches the fundamentals required as a basis forunderstanding the material covered in this document.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    2/53

    Page 2 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    2. The ability to create and modify variables providing a means to receive data from enterprisedatabases.

    3. Automatic script generation to aid partners in writing supporting applications on the Web serverthat interact with the IVR. Such applications are responsible for data retrieval from databases andother sources based on parameters passed from the MX. These Web server scripts passinformation back to the MX in VoiceXML snippets..

    The basic architecture of the IVR solution is shown in Figure .

    Figure 1 IVR Solution Overview

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    3/53

    Advanced Auto Attendant G

    Page 3 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    2.1 Examples in this document

    For the examples in this document, Perl is used as the scripting language and MySQL is used as theexternal data base due to their wide circulation and availability for Windows and Linux. All examples

    provided in this document can be converted to operate with different scripting languages and databases.The MySQL database server can be obtained from http://www.mysql.org, and the Perl interpreter isavailable for download from http://www.perl.org. Information about installing and tuning both tools canbe found at http://learn.perl.org/library/beginning_perl/.

    All examples presented in this document will work with any web-server that supports CGI and Perl. Fordebugging, we used Apache (http://www.apache.org ) and Xitami (http://www.iMatix.com ).

    3 Brief Introduction to the AAA Scripting Tool

    3.1 Types of Variables

    Each AAA variable declared by a user is assigned one of the predefined types shown in Table 1. Withthese variables the user may construct expressions used in Web server scripts and control responsesreceived from the Web server. The main reason for using these predefined types has to do with therestrictions of the Text-to-Speech mechanism discussed in the next section.

    The variable types affect AAA script builder only and are not necessarily propagated directly into theVoiceXML script generated by the MX. Some checking of Web server response can be based on thisinformation.

    Variable Type Description Example

    VAR_STRING Includes all characters (the entire printableASCII character set)

    Example #1

    VAR_INTEGER Numeric characters (includes 0-9 and theminus sign(-) as leading character). Thesevariables always reflect integer values(nodecimal point can be used)

    12345

    VAR_NUMBER Includes all numeric characters and the decimal point(.)

    3.1415

    VAR_DATE Date, numeric characters, and the /, formatted asMM/DD/YYYY

    12/31/2005

    VAR_TIME Time, numeric characters, and the :, formatted asHH:MM

    19:00

    Table 1 Types of Variables

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    4/53

    Page 4 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    All variable types can participate in Dialog switching within the AAA script.. Note that there is notype BOOLEAN. It is recommended to use variable of VAR_INTEGER type equal to 1 for TRUE and 2for FALSE as is common for Yes or No interfaces.

    3.2 Predefined VariablesA number of Predefined Variables are provided which are described in Table 2). These variables allowaccess to system data and call information.

    Table 2 -Pre-defined Variables

    3.3 Dialogs and ActionsAn AAA script is a sequence of dialogs and actions. From the users point of view, a dialog is either astate where the MX is waiting for a users input, or switching a point where the script execution can bebranched based on the results that have been gathered. The script executes and moves from dialog todialog based upon actions. The various predefinedactions belong are listed in the Table 3.

    Variable Name Variable Type Description

    __CUR_DATE__ VAR_DATE Current date

    __CUR_TIME__ VAR_TIME Current time

    __ANI__ VAR_ NUMBER Calling party number

    __DNIS__ VAR_NUMBER Called party number

    __CALL_ID__ VAR_STRING Unique identifier for a call (which can be used forcorrelating the internal MX CDR database informationwith an external database.

    __LNG__ VAR_STRING Represents a language used by a script. The currentlanguage can be changed using the Changelanguage action.

    __ERR_CODE__ VAR_INTEGER Describes the result of a web script execution.Possible values:

    0 No errors detected

    2 Invalid input parameters

    3 Invalid output parameters

    4 Incorrect version

    5 Internal error

    _ERR_DETAILS_ VAR_STRING Error description

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    5/53

    Advanced Auto Attendant G

    Page 5 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Action Description

    Go to Unconditional transition to a specified dialog

    Transfer Script execution is terminated and the phone call is transferredto a specified extension

    Transfer to Attendant Script execution is terminated and the phone call is transferredto a pre-configured system attendant

    Transfer to VM Caller is transferred to an MX users voice mail box where theymay leave a message for the user with a given extension. Oncethe call is transferred, the script execution is terminated.

    Dial by name Invokes a search for a user on the MX system by first name, lastname, or both.

    Disconnect Script execution is terminated and the phone call isdisconnected.

    Web Server request Request is sent to an external web server. Script execution iscontinued for specified dialog after a response is received fromthe web server.

    Assign to variable Script transitions to a specified dialog with a variable beingassigned a specified value.

    Change language Allows the script to switch between the various language packsthat have been installed on the MX for pronunciation of

    variablesFax on Demand Sends a specified fax to a specified phone number

    Table 3 - Pre-defined Actions

    3.4 Prompts

    The dialogs and actions executed by a script are typically accompanied by various prompts. A prompt isa sequence of audio files in .wav format which are specified by the author of the script. There are anumber of system standard .wav files that are present on any MX which can be used for prompts. Topronounce a variable, the MX dynamically forms the required sequence of .wav files that correspond toa specific pronunciation type. For example, if variable V1 is assigned to 23, and it is required to

    pronounce in the prompt AS_INTEGER, then the sequence of {twenty.wav, three.wav} will besubstituted using system standard .wav files. The same variable pronounced using the type ofAS_DIGITS results in the sequence of {two.wav, three.wav} being substituted using systemstandard .wav files. Pronunciation types are closely related to variable types, as it shown in Table 4

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    6/53

    Page 6 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Variable Type Modifier Description

    AS_INTEGER Pronounced in the natural way

    AS_DIGITS Pronounced as a sequence of digits

    AS_MONEY_NATIVE Pronounced as monetary data usingthe requested language (theappropriate language pack must beinstalled)

    VAR_INTEGER

    AS_MONEY_SYSTEM Pronounced as monetary data using thedefault system language.

    AS_NUMBER Pronounced in the natural way

    AS_MONEY_NATIVE Pronounced as monetary data using

    the requested language (theappropriate language pack must beinstalled)

    VAR_NUMBER

    AS_MONEY_SYSTEM Pronounced as monetary data usingthe default system language.

    AS_DATE The full date information ispronounced (month, day, and year)

    VAR_DATE

    AS_TOD_TOM_YEST Pronunciation of Today,Tomorrow, Yesterday where dateis in that range. Otherwise

    pronounced AS_DATE.

    AS_HOUR_MINUTE The time is pronounced in Hours andMinutes

    VAR_TIME

    AS_NATIVE_TIME_FORMAT The time is pronounced as it isconfigured on the MX.

    AS_LOCAL_FILE The variable contains the name of a.wav -file to be played. This file islocated in the local files directory onthe MX for that script.

    AS_SYSTEM_PROMPT The variable contains the name of a .wav -fileto be played. This file is located in the systemprompts directory on the MX.

    VAR_STRING

    AS_INTERNET_FILE The variable contains the URL of a .wav-file, which is located somewhere on a website. The file will be downloaded to localstorage, and the local copy will be invokedon subsequent calls. The local copy may be

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    7/53

    Advanced Auto Attendant G

    Page 7 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    removed if there is no space is left, a afterspecified time has elapsed, or after asystem reboot.

    REAL_TIME_TTS3 The string is sent to an external Text-to-Speech server, which generates an audio fileinteractively in real time which is played bythe system.

    AS_SPELLING Each character is pronounced individuallyas if the word is being spelled.

    Table 4 Pronounciation Modifiers

    3.5 Using an External TTS Server

    The AAA allows customers to utilize a third party TTS server for real time .wav file generation. Thisability allows for the pronunciation of a string of variables with values which are not known in advance.

    3.5.1 Communicating with the TTS Server

    The communication between the MX and the external TTS server is shown in Figure 2.

    If a request is made to pronounce a string variable as REALTIME_TTS, the AAA first checks if therequired .wav file has been saved in file storage as a result of previously made request to the TTS server.If the .wav file is not found, the AAA sends an HTTP request to a web server specifying a requiredlanguage. The HTTP request passes the value of the string variable (text), user name (id), password(passw), language code (language), and voice id (speaker) as script parameters. For example:

    http://10.1.34.77/tts.asp?id=777&passw=1234&language=en-us&speaker=kate&text=hello

    The possible values for the language codes are shown in Table 6. The User name andpasswordarespecified in the Admin UI under Provision | System Settings | TTS tab as shown in Figure 4, and can beused by the Web script or by the TTS server. The Speakeris an additional parameter passed to the TTSserver. It is used for specifying the TTS voice to use for the TTS operation.

    3 This option is available only if a TTS Server is configured.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    8/53

    Page 8 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 2- Example Using external TTS servers.

    If the TTS server is successful in generating a .wav file in response to the request, it returns simple htmlpage with the following in the BODY of the file: Response = OK, result = 1 and a URL with thepath to the .wav file specified as file= .An example of a response is shown in Figure 3.

    Zultys recommends the TTS solutions and voices from Acapela (http://www.acapela-group.com/) andNeospeech (www.neospeech.com) as these are used internally by Zultys. Acapela supports Europeanlanguages and Neospeech supports US English and the Asian languages.

    Response = OK


    result = 1

    file = http://tts.zultys-support.com/sounds/kate7773471114564526.wav


    argv[0] = C:\Inetpub\wwwroot\TTSSample.exe
    argv[1] = 777

    argv[2] = 347

    argv[3] = 1234

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    9/53

    Advanced Auto Attendant G

    Page 9 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    argv[4] = 100

    argv[5] = hello

    Response time = 62.5 ms

    Figure 3 Example of Real-Time response from TTS server

    3.5.2 Configuring Access to the TTS Server

    Go to Provision | System Settings | TTS tab to configure the Real-time TTS server, as shown in Figure4. The User name and Password fields, when configured, are passed in HTML requests to authorize theMX in transactions with the TTS server. The user can right click to add an entry in the table below theusername and password entries. Users should select the languages and speakers supported by the TTSserver being used and enter the URL of the TTS server.

    Figure 4 Configuring Access to Real-Time TTS Server.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    10/53

    Page 10 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    3.6 Dynamic Fax On Demand

    Figure 5 Dynamic Fax On Demand to request fax files from a web server

    With Dynamic Fax on Demand a caller hears a recorded message which reads the list of fax documentsthat have been made available in a certain directory on a web server. The caller can choose a documentto be faxed, enter the number of the fax machine where the document should be sent and then go onhook. The MX automatically dials the fax number entered and faxes the appropriate document. The

    example shown in Figure 5 indicates how faxes can be received from an external web server.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    11/53

    Advanced Auto Attendant G

    Page 11 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    4 Example - Drug Refill SystemThis example illustrates how the Advanced AA can be used for a prescription refill application This

    allows for the automation of one of the most repetitive and resource consuming tasks performed bypharmacy personnel. With this application, a patient who already has a prescription can call the systemand enter a prescription refill number. The system determines if the patient is eligible to receive a refill.If so, the patient selects a pharmacy and a label is printed at that pharmacy. A pharmacist at thatpharmacy gets the label, puts it on a bottle, fills the prescription, and then it is ready for pick up. Theprescription refill application tells the patient when to pick up the medicine and confirms the pharmacylocation. If are no remaining refills for the prescription; the patient is informed that they must contact aphysician.

    4.1 Drug Refill System - State Machine

    It is recommended that when designing any web server script to interact with the Advanced AA on the

    MX that you begin with a drawing of a state machine. Doing so can dramatically simplify scriptbuilding, debugging, support, and documentation.

    The drawing shown in Figure 6for the Drug Refill script was done using Microsoft Visio. The ovalshapes represent dialogs; while actions appear as arrows. Prompts are indicated with commentscorresponding to actions and dialogs. Quoted numbers with the arrows correspond to the values of userinput or variables used in dialog switching. The execution of an action branches with successful orunsuccessful action execution. Black filled circles indicate exit points from script execution.

    The script execution can be divided into three phases:

    I. Theinitial phase starts with the incoming call. If the calling party number information (ANI) isavailable the MX tries to retrieve information about the caller based on this ANI (e.g., preference

    of using the automated drug refill system versus speaking to live person and preferred language).The caller can force the script to transfer call to an operator.

    II. During the main phase the caller is asked to enter their prescription ID and a database is queriedfor the prescription status. The MX then informs the caller whether or not they have any refillsremaining on their prescription. If a caller does have refills left on their prescription and wish tohave a refill, they are asked about their preferred way of picking up the refill and to provide acontact phone number.

    III. During the concluding phasethe database is updated, a fax can be sent to a doctor, and the callcan be transferred to the voice mail system if required.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    12/53

    Page 12 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    13/53

    Advanced Auto Attendant G

    Page 13 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Figure 6 Drug Refill Application State Machine

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    14/53

    Page 14 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    4.2 Drug Refill System Script Variables

    To access the list of variables click on the Variables node in the dialog tree. The set of variables isshown in Figure 7. You have the ability to add or delete variables, assign initial values, and provide anycomments.

    Note: It is very important that you provide comments on your variables. The comments will appear inthe web server script that is automatically generated by the MX.

    There are three dialogs where requests are made and the results returned are stored in the variableswhich have been declared. These are theRootdialog,RefillStartdialog, andDBUpdate dialog. As aresult of the web script execution for theRootdialog, we have the iDBCallerInfo variable filled with oneof the following values:

    iDBCallerInfo = 1 The calling party number was found in the database and there is nopreference set against using the automated drug refill system.

    iDBCallerInfo = 2 The calling party number was found in the database and the caller prefers

    not to use the automated drug refill system.

    iDBCallerInfo = 3 The calling party number was not found in the database.

    We also have iDBLanguage which indicates the callers preference of language:

    iDBLanguage = 1 Caller prefers English

    iDBLanguage = 2 Caller prefers Spanish

    iDBLanguage = 3 Other foreign language

    The execution of the RefillStartdialog and the associated web request results in assigning values to thefollowing variables:

    iDBResult result of the database search for the given prescription ID entered by the caller:

    iDBResult = 1 Refills are available for this prescription

    iDBResult = 2 Prescription ID was not found

    iDBResult = 4 It is too soon to request refills for this prescription

    iDBResult = 5 The prescription has expired

    iDBResult = 6 There are no refills left for this prescription

    iDBResult = 10 The prescription ID is valid yet refills cannot be requested because of anunspecified error.

    sPatientLastName, sPatientFirstName Caller or patients name

    dPickupDate, tPickupTime date and time when the patient can pick up the refill

    sDoctorFax, sFaxURL doctors fax number and location where generated fax file can be found (forcases where a doctors authorization is required)

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    15/53

    Advanced Auto Attendant G

    Page 15 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Figure 7- Script Properties Screen

    4.2.1 Root Dialog

    Figure 8 shows theRootdialog for the drug refill system. This is the only mandatory dialog for anyAdvanced AA script.

    Figure 8 Root Dialog

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    16/53

    Page 16 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    The script execution begins with the Advanced AA pronouncing the .wav files specified in the Promptslist.

    The variable used as an input source is the __ANI__ system variable (which contains the calling partyphone number, if available). This is done by selecting the Variable or Dialog radio button and choosing_ANI_ from the list. The switching conditions are specified in theActions table. If__ANI__ is notreceived the No Input condition will be true and the dialogLanguage will be entered because of theGoTo action. Otherwise, theNo Match condition will be satisfied and the Web Server Requestactionwill be executed to initiate looking up the _ANI_ in the database.

    4.2.1.1 GoTo Action

    This action causes the script to unconditionally execute the specified dialog. In this case, it is theLanguage dialog is specified in the pull down menu as shown in Figure 9.

    Figure 9 Root Dialog, GoTo Action

    4.2.1.2 Web Server Request, Root Dialog

    The Web Server Request action allows an Advanced AA script to send information to an external scriptrunning on a web server. This script can perform a number of operations, such as looking up informationon a caller which may be contained in a database. When the Advanced AA sends an HTTP request to aspecified URL it passes a set of input parameters and receives a VoiceXML formatted response from theweb server containing the output parameters. In this example, after receiving the response Advanced AAscript execution will be passed to the dialogDBReq_1. If the web server script returns a non zero

    variable __ERR_CODE__ or the response from the web server script was not received after FetchTimeoutseconds) theLanguage dialog is invoked.

    4.2.1.2.1 Definition of parameters for the web server script

    Input and output parameters must be specified for the web script. The only information we have so far isthe callers ANI, which is available through the variable __ANI__. Let us name the corresponding input

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    17/53

    Advanced Auto Attendant G

    Page 17 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    parameter for the script as pANI, and then Request tab of Web Server Request action should look likeone shown on Figure 10.

    Note: If the checkbox under the Variable column is not selected. the string __ANI__ will be sent to

    the web server instead of the calling party number.

    The AAA sends the parameters to the web server using POST (if the Use Post Methodcheckbox ischecked) or GET HTTP methods. In the latter case the parameters are joined to the URL string, so youshould take into account the maximum length message that your web server can receive.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    18/53

    Page 18 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 10 Root Dialog, Web Server Request action, Request parameters

    4.2.1.2.2 Web script Output Parameters

    We expect to receive information from a database regarding user preferences and native language, andwill assign this data to the variables iDBCallerInfo and iDBLanguage. If we name the returnedparameters as OP_CallerInfo and OP_Language, then screen for the action will look like the one shownin Figure 11.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    19/53

    Advanced Auto Attendant G

    Page 19 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Note: The output parameters returned by the web script are temporary variables which are not availableoutside of this action.

    Note: If required you can assign the value of an output parameter to several variables. In other words

    the left column in theResponse tab can contain multiple different Script Parameters with the samevariable assigned to each.

    The predefined variables __ERR_CODE__ and __ERR_DETAILS__ are returned and usedautomatically and do not need to be explicitly specified.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    20/53

    Page 20 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 11 Root Dialog, Web Server Request action, Response parameters

    4.2.1.2.3 Web Script Stub Generation

    The third tab in this form allows you to specify the type and location of the web scripts stub. Youshould specify the script type (e.g., Perl, PHP, or ASP) and file name and location. In this example, weare going to use a Perl script and name the output fileRefill_1.pl. The files should be placed in anappropriate directory where they can be executed by your web server.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    21/53

    Advanced Auto Attendant G

    Page 21 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Figure 12 Root Dialog, Web Server Request action, Web Script generation

    You can skip this operation by selecting None in the Script Type field.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    22/53

    Page 22 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    4.2.2 Web Script

    4.2.2.1 Investigation of the Automatically Generated Script Stub

    The process of web script generation takes place when the Save and Upload Scriptbutton is pressed. At

    this moment, two files appear in the specified directory: one is the required web script, and the secondone is an auxiliary html file with the same name as the web script. In our example the files areRefill_1.pl andRefill_1.html, respectively. The html file is intended exclusively for debugging purposesand will be explained later.

    You can open the file Refill_1.pl using any text editor. The file contents will look like those shown inFigure 13:

    1 #! /usr/bin/perl

    2 #=======================================================

    3 # Generated by ScriptGen v1.38 (build 126, "OS_BUILD")

    4 # at Mon Oct 03 18:43:51 2005

    5

    6 #=======================================================

    7

    8 use warnings;

    9 use strict;

    10 use CGI qw(:all);

    11 $|++;

    12

    13 my $cgi = new CGI;

    14 #Variables ERR_CODE__ and ERR_DETAILS are reserved for errors indication

    15 my $ERR_CODE__="0";

    16 my $ERR_DETAILS__="";

    17

    18 #=======================================================

    19 # Input Parameters Section. DO NOT EDIT!

    20 #=======================================================

    21 #Name: pANI

    22 my $pANI = $cgi->param("pANI");

    23 if (!(defined $pANI)) {

    24 $ERR_CODE__ = "2";25 $ERR_DETAILS__ = "Input parameter 'pANI' is undefined";

    26 }

    27

    28 #=======================================================

    29 # Output Parameters Section. DO NOT EDIT!

    30 #=======================================================

    31 #Name: OP_caller_info

    32 #Variable: iDBCallerInfo

    33 #Type: Integer

    34 #Comment: 1=SPN,2=ENG,3=NoIVR,4=NotFound

    35 my $OP_caller_info="";

    36

    37 #Name: OP_language

    38 #Variable: iDBLanguage

    39 #Type: Integer

    40 #Comment: 1=English,2=Spanish

    41 my $OP_language="";42

    43

    44 #=======================================================

    45 #=== PLEASE INSERT THE CODE HERE FOR ASSIGNING THE REAL VALUES

    46 #=== TO FOLLOWING VARIABLES:

    47 #=== $OP_caller_info, $OP_language

    48 #=== SET $ERR_CODE__ = "5" (i.e. "User Defined Error")

    49 #=== AND $ERR_DETAILS__ TO EXPLANATION STRING IF A WRONG CONDITION SHOULD ARISE.

    50 #=== {{{{{

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    23/53

    Advanced Auto Attendant G

    Page 23 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    51

    52 #=== }}}}}

    53

    54 #=======================================================

    55 # Output variables checking.

    56 #=======================================================57 if (!(defined $OP_caller_info && isvalidinteger($OP_caller_info))) {

    58 $ERR_CODE__ = "3";

    59 $ERR_DETAILS__ = "Invalid value '$OP_caller_info' for parameter 'OP_caller_info'";

    60 }

    61 if (!(defined $OP_language && isvalidinteger($OP_language))) {

    62 $ERR_CODE__ = "3";

    63 $ERR_DETAILS__ = "Invalid value '$OP_language' for parameter 'OP_language'";

    64 }

    65 print qq||;

    66 print qq||;

    67 print qq| |;

    68 print qq| |;

    69 print qq| |;

    70 print qq| |;

    71 print qq| |;

    72 print qq| |;

    73 print qq| |;74 print qq| |;

    75 print qq| |;

    76 print qq| |;

    77 print qq| |;

    78 print qq| |;

    79 print qq| |;

    80 print qq| |;

    81 print qq||;

    82

    83 #=======================================================

    84 # Used functions. DO NOT EDIT!

    85 #=======================================================

    86

    87 sub convert2vxml {

    88 $_ = shift;

    89 s/&/&/g;

    90 s/\\/\\\\/g;

    91 s//>/g;

    93 s/"/\\"/g;

    94 s/chr(8)/\\b/g;

    95 s/chr(9)/\\t/g;

    96 s/chr(10)/\\n/g;

    97 s/chr(11)/\\v/g;

    98 s/chr(12)/\\f/g;

    99 s/chr(13)/\\r/g;

    100 s/'/\\'/g;

    101 return $_;

    102 }

    103

    104 sub isvaliddate {

    105 my $input = shift;

    106 my $DataPattern = '^(?:(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.]((?:19|20)\d\d))$';

    107 if ($input =~ m!$DataPattern!) {

    108 # At this point, $3 holds the year, $1 the month and $2 the day of the date entered

    109 if ($2 == 31 and ($1 == 4 or $1 == 6 or $1 == 9 or $1 == 11)) {

    110 return 0; # 31st of a month with 30 days

    111 } elsif ($2 >= 30 and $1 == 2) {

    112 return 0; # February 30th or 31st

    113 } elsif ($1 == 2 and $2 == 29 and not ($3 % 4 == 0 and ($3 % 100 != 0 or $3 % 400 == 0))) {

    114 return 0; # February 29th outside a leap year

    115 } else {

    116 return 1; # Valid date

    117 }

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    24/53

    Page 24 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    118 } else {

    119 return 0; # Not a date

    120 }

    121 }

    122 sub isvalidtime {

    123 my $input = shift;

    124 my $TimePattern = '^(([0-1][0-9]|2[0-3]):[0-5][0-9])$';125 if ($input =~ m!$TimePattern!) {

    126 return 1;

    127 }

    128 return 0;

    129 }

    130 sub isvalidnumber {

    131 my $input = shift;

    132 my $NumberPattern = '^([-+]?([0-9]*\.)?[0-9]+)$';

    133 if ($input =~ m!$NumberPattern!) {

    134 return 1;

    135 }

    136 return 0;

    137 }

    138 sub isvalidinteger {

    139 my $input = shift;

    140 my $IntegerPattern = '^([-+]?[0-9]+)$';

    141 if ($input =~ m!$IntegerPattern!) {142 return 1;

    143 }

    144 return 0;

    145 }

    146 sub isvalidstring {

    147 my $input = shift;

    148 return 1;

    149 }

    Figure 13 Script Generation Parameters for Refill_1.pl

    The breakdown of the script Refill_1.pl is shown in Table 5 . The script text should not be modifiedexcept to inserting the users procedure in the appropriate place. Otherwise, problems with compatibility

    between versions can arise.

    Line 1 Specifies the location of the Perl interpreter on the processing machine. Not used inWindows.

    Lines 2-6 Commented information about date of script generation and version of softwareused.

    Lines 8-9 Perl script tuning. Warning results in the generation of warnings and strictrequiresthat all variables be declared before they are used.

    Line 10 Imports the Perl CGI module that will handle the bulk of the CGI processing.

    Line 11 Turns off buffering so that the output is sent immediately from the server.

    Lines 13-16 Declaration of working variables. Variables $ERR_CODE__ and $ERR_DETAILS__ willcontain a numeric code and a text description of the last error and $cgi, an object of CGIclass, will be used for the retrieval of input parameters.

    Lines 21-26 This is a piece of code for handling the only input parameter passed to this script,pANI. A variable with the same name as the input parameter ($pANI) is introduced.Note that all information that is known about this parameter from the XML script

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    25/53

    Advanced Auto Attendant G

    Page 25 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    on the MX (variables name, type, description) is also included in the comments.The variable is initiated by calling $cgisparam function with correspondingargument. This function correctly works for both GET and POST methods of

    parameter transmission. If the required parameter is missing,param returns null,and the corresponding variable will be left undefined. In this case the script sets thevariable $ERR_CODE__ to 2 (Bad Input Parameter), and $ERR_DETAILS__contains an error description.

    Lines 31-41 Declaring of output variables. The names of these variables correspond to thenames of the output parameters in the XML script on the MX. Auxiliaryinformation about types, formats, and descriptions of corresponding variables isplaced in commented strings.

    Lines 50-52 This is the place where the user should add code for the population of the outputvariables.

    Lines 57-64 The values for the output variables received after execution of the users code arechecked against the defined variable formats. The error code is set to 3 Invalid Output Parameter if the format does not match.

    Lines 65-81 The web script VoiceXML output is formed here which is used for assigningvalues to the required variables. Note that the variables __ERR_CODE__ and__ERR_DETAILS__ will be returned in addition to the specified output parameters.

    Lines 82-149 Functions used for string conversion and syntax checking of the output parameters.These functions are based on the checking of regular expressions.

    Table 5: Breakdown of script Refill_1.pl

    4.2.2.2 Script Execution and Debugging

    We will first run and debug the script without involving the MX system. To do this, we can just call theweb script through a web browser. Since the web script returns XML formatted text it designed to use abrowser which can show the XML file in a convenient format.

    Let us modify script text to assign some dummy values to the output variables. To do this we add thefollowing text in lines 50 52 (i.e. between {{{{{ and }}}}}) in the web script:

    #=== {{{{{

    $OP_caller_info = 1;

    $OP_Language = 2;

    #=== }}}}}

    Figure 14 Temporary assignment of output variables to dummy values

    Next you should copy the file into a directory known to your web server and call the script by requestingthe next URL in your browser. As an example:

    http://localhost/cgi-bin/Refill_1.pl?pANI=4083280450

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    26/53

    Page 26 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Note that with this approach we can only pass parameters using the GET method. Parameters should beseparated from the script name by using the ? symbol, and separated from each other using the &. Inreturn the web browser should display a page similar to the one shown in Figure 15.

    Figure 15 Script Output

    As mentioned earlier, an auxiliary html file is generated which can simplify the calling of the web script.

    It can be especially helpful in cases where there are a large number of parameters or where the script isdeveloped by

    Figure 16 Script Input Parameters

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    27/53

    Advanced Auto Attendant G

    Page 27 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    a third party. For our example this web page is shown in Figure 16. The parameters can be passed bothby the GET and POST methods depending on the selection in Figure 25. After pressing the Sendbuttonthe corresponding script will be invoked and the web browser will display the corresponding output

    VoiceXML script..

    4.2.2.3 Script Output

    The output of the web server script is a primitive VoiceXML script. When this VoiceXML script isreceived by the MX, this script is interpreted by the Advanced AA and the required values (namelyiDBCallerInfo and iDBLanguage) are be assigned to corresponding variables in the Advanced AA.

    The VoiceXML script passed back to the MX consists of variable definitions and a form which returnsthe list of these variables. The values for these variables are received as a result of the execution of theweb script. The error diagnostic variables __ERR_CODE__ and __ERR_DETAILS__ are automaticallyreturned.

    In our example, we can see that output parameters are 1 and 2 as defined, and no errors weredetected (__ERR_CODE = 0). You can try to assign a non-integer value to $OP_caller_info to see howthe script output will change.

    4.2.2.4 Script for Initial Phase

    In the first script all we needed to do was to extract information about a patient from a database. We willnow continue with the development of the refill application.

    Note: To avoid accidentally overwriting a working part of the web server script as a result of the webscript being regenerated by the MX all working pieces of code should be moved to an external file.

    Modify lines 50 52 of the Refill_1.pl script as shown in Figure 17. The database request is not initiated

    if the input parameter is incorrect (e.g., $ERR_CODE__ is non zero). If the value of $ERR_CODE__ iszero the Perl moduleRefill_1_sup.pm is included which calls the functionRefill_1. This function returnsan array with the required output values.

    #=== {{{{{

    if ($ERR_CODE__ == 0) {

    use Refill_1_sup;

    ($OP_caller_info, $OP_Language,$ERR_CODE__,$ERR_DETAILS__) = Refill_1($pANI);

    }

    #=== }}}}}

    Figure 17 Modification of Refill_1.pl

    Refill_1_sup.pm can be realized as shown in Figure 18. The following is a short explanation of the codefor this Perl module.

    Line 3 This loads the Perl library for database access.

    Line 5 Declaration of subroutine Refill_1. Only one argument is expected.

    Lines 7-9 Declaration and initialization of output variables. The value of $err is set to 4(Internal Error).

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    28/53

    Page 28 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Lines 12-13 Connects to a database using the connectmethod of class DBI. This attempts toopen a connection to the local MySQL servers database named test. The user isrootand the password is thepassword. The connect method returns a databasehandle if it is successful and leaves the variable $dbh undefined otherwise.

    Lines 14-15 Preparation and execution of SQL statement. Two fields are selected from thepatienttable in the database based on the callers caller ID (ANI). The firstargument indicates whether the caller is able to use the IVR, while the seconddefines whether or not the caller is a Spanish speaker.

    Lines 16-26 If the previous step is successful the results are analyzed here. There may be nopatient with the given caller ID (ANI) or there may be more than one patient withthe same caller ID (ANI) . The output variable $ivrable is set to 0 if at least one ofthe patients prefers not use the IVR. The variable $spanish is set to 1 if any patientspeaks Spanish. The variables are left unchanged if no patient was found for thegiven ANI.

    It is required to set the value of$errto 0 here since this a successful subroutineexecution.

    Line 28 Closes the connection to the database.

    Line 30 Subroutine returns an array of results. Note that $DBI:errstrcontains the lastdatabase error description.

    1 use warnings;

    2 use strict;

    3 use DBI;

    4

    5 sub Refill_1 {

    6

    7 my $ivrable = 1;

    8 my $spanish = 0;

    9 my $err = 4;

    10 my $ani=shift;

    11

    12 my $dbh = DBI->connect('dbi:mysql:test','root',thepassword');

    13 if ($dbh) {

    14 my $sth = $dbh->prepare("SELECT pat_ivr_refill_allowed, pat_spanish_pcm_pde

    FROM patient

    WHERE pat_phone=\"$ani\" OR pat_phone2=\"$ani\"");

    15 if ($sth && $sth->execute()) {

    16 my ($pers_ivrable, $pers_spanish);

    17 $sth->bind_col(1, \$pers_ivrable);

    18 $sth->bind_col(2, \$pers_spanish);

    19

    20 while ($sth->fetch) {

    21 $ivrable = 0 if ($pers_ivrable ne "Y");

    22 $spanish = 1 if ($pers_spanish eq "Y");

    23 }

    24

    25 $sth->finish();

    26 $err = 0;

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    29/53

    Advanced Auto Attendant G

    Page 29 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    27 }

    28 $dbh->disconnect;

    29 }

    30 return ($ivrable, $spanish, $err, $DBI::errstr);

    31 }

    32 1;

    Figure 18 Refill_1_sup.pm Module

    It is a good idea at this point to check the correctness of this program using Refill_1.html.

    4.2.3 Using Script Output in Voice Scenario

    As a result of the web request we should receive the required information and execution continues withtheDBResp1 dialog shown in Figure 19. If the request returns an Internal Error indication or if aresponse was not received during the Fetch timeout period, execution will be passed to theLanguagedialog shown in Figure 21.

    4.2.4 DBReq_1 and LanguageDialogs and the Change LanguageActionThese dialogs are used to switch script execution between the English and Spanish languages. TheDBReq_1 dialog (shown in Figure 19) performs this switch based on the value of the iDBCallerInfovariable.

    To enable this behavior Variable or Dialog is selectedas theInput source and variable iDBCallerInfo isselected from the pull down menu. Depending on the value of iDBCallerInfo the script will transition toan English dialog or a Spanish dialog. The change to a Spanish dialog is accomplished with aChangeLanguage action or within theLanguage dialog with a GoTo action.

    The script reaches theLanguage dialog only if the callers language can not be determinedautomatically. TheLanguage dialog explicitly asks the caller to press 1 to switch to English, or 2 to

    switch to Spanish. A screen shot of this dialog is shown in Figure 21.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    30/53

    Page 30 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 19 DBReq_1 Dialog

    The Change Language action changes the language setting within the scope of a dialog. In our script thelanguage setting is changed to Spanish if the caller is identified as a Spanish speaker. Once the scriptexecution is transferred to the Spanish dialog a parallel script branch starts. The corresponding screen isshown in Figure 20. The system variable __LANGUAGE__ indicates the current selection.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    31/53

    Advanced Auto Attendant G

    Page 31 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Figure 20 Change Language Action

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    32/53

    Page 32 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 21 Language Dialog

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    33/53

    Advanced Auto Attendant G

    Page 33 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    4.2.5 EnglishDialog Main System Menu

    The dialog shown in Figure 22 contains an example of a main menu for a typical drug store. The caller

    is asked to press 1 to enter a refill request, 2 if they are a doctor calling to authorize a prescription,3 to leave a message for a pharmacy, and 4 for information about store locations (for example).

    Figure 22 English Dialog Sample Drug Store Main Menu

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    34/53

    Zultys Technologies

    Page 34 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Figure 23 English Dialog

    A new type of action provided is a Transfer To Voice Mail action. The only parameters that need to beconfigured are an extension (explicitly, or assigned to a variable) and the action that should be executedin case of a failure to transfer.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    35/53

    Advanced Auto Attendant G

    Page 35 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    RefillStartDialog Requesting Prescription Information from a Web Server

    Figure 24 RefillStartDialog

    The MX prompts the caller to enter the prescription number using the .wav file specified in the promptssection as shown in Figure 24

    The prescription number collected from the caller is sent as an input parameter in a second web requestinvolving the Refill_2.pl web script. Seven variables are assigned values retrieved from a database as aresult of the web request. The script then proceeds with theAnalyzeDB dialog. The details of the web

    request are shown in Figure 25.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    36/53

    Zultys Technologies

    Page 36 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Figure 25 Web Server Request, Response, Script inRefillStart Dialog

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    37/53

    Advanced Auto Attendant G

    Page 37 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    #! /usr/bin/perl

    #=======================================================

    # Generated by ScriptGen v1.38 (build 126, "OS_BUILD")

    # at Mon Oct 03 18:43:51 2005

    #=======================================================

    use warnings;

    use strict;

    use CGI qw(:all);

    my $cgi = new CGI;

    #Variables ERR_CODE__ and ERR_DETAILS are reserved for errors indication

    my $ERR_CODE__="0";

    my $ERR_DETAILS__="";

    #=======================================================

    # Input Parameters Section. DO NOT EDIT!

    #=======================================================

    #Name: pPrescrId

    my $pPrescrId = $cgi->param("pPrescrId");

    if (!(defined $pPrescrId)) {

    $ERR_CODE__ = "2";

    $ERR_DETAILS__ = "Input parameter 'pPrescrId' is undefined";}

    #=======================================================

    # Output Parameters Section. DO NOT EDIT!

    #=======================================================

    #Name: pDBResult

    #Variable: iDBResult

    #Type: Integer

    #Comment:

    0=OK,1=Unknown,2=NotFound,3=Discontinued,4=TooSoon,5=Expired,6=NoRefillsLeft,10=unknown

    my $pDBResult="";

    #Name: pPatientLastName

    #Variable: sPatientLastName

    #Type: String

    #Comment: Patient's last name

    my $pPatientLastName="";

    #Name: pPatientFirstName

    #Variable: sPatientFirstName

    #Type: String

    #Comment: Patient's first name

    my $pPatientFirstName="";

    #Name: pPickupDate

    #Variable: dPickupDate

    #Type: Date

    #Comment: Prescription pick-up date

    my $pPickupDate="";

    #Name: pPickupTime

    #Variable: tPickupTime

    #Type: Time

    #Comment: Prescription pick-up time

    my $pPickupTime="";

    #Name: pFaxNumb

    #Variable: sDoctorFax

    #Type: String

    #Comment: Doctor's fax number

    my $pFaxNumb="";

    #Name: pFaxLocation

    #Variable: sFaxURL

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    38/53

    Page 38 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    #Type: String

    #Comment: Path to prepared fax file

    my $pFaxLocation="";

    #=======================================================

    #=== PLEASE INSERT THE CODE HERE FOR ASSIGNING THE REAL VALUES#=== TO FOLLOWING VARIABLES:

    #=== $pDBResult, $pPatientLastName, $pPatientFirstName, $pPickupDate, $pPickupTime, $pFaxNumb,

    $pFaxLocation

    #=== SET $ERR_CODE__ = "5" (i.e. "User Defined Error")

    #=== AND $ERR_DETAILS__ TO EXPLANATION STRING IF A WRONG CONDITION SHOULD ARISE.

    #=== {{{{{

    if ($ERR_CODE__ == 0) {

    use Refill_1_sup;

    ($pDBResult,$pPatientLastName,$pPatientFirstName,$pPickupDate,$pPickupTime,$pFaxNumb,

    $pFaxLocation,$ERR_CODE__,$ERR_DETAILS__) = Refill_2($pPrescrId);}

    #=== }}}}}

    #=======================================================

    # Output variables checking.

    #=======================================================

    if (!(defined $pDBResult && isvalidinteger($pDBResult))) {$ERR_CODE__ = "3";

    $ERR_DETAILS__ = "Invalid value '$pDBResult' for parameter 'pDBResult'";

    }

    if (!(defined $pPatientLastName && isvalidstring($pPatientLastName))) {

    $ERR_CODE__ = "3";

    $ERR_DETAILS__ = "Invalid value '$pPatientLastName' for parameter 'pPatientLastName'";

    }

    if (!(defined $pPatientFirstName && isvalidstring($pPatientFirstName))) {

    $ERR_CODE__ = "3";

    $ERR_DETAILS__ = "Invalid value '$pPatientFirstName' for parameter 'pPatientFirstName'";

    }

    if (!(defined $pPickupDate && isvaliddate($pPickupDate))) {

    $ERR_CODE__ = "3";

    $ERR_DETAILS__ = "Invalid value '$pPickupDate' for parameter 'pPickupDate'";

    }

    if (!(defined $pPickupTime && isvalidtime($pPickupTime))) {

    $ERR_CODE__ = "3";$ERR_DETAILS__ = "Invalid value '$pPickupTime' for parameter 'pPickupTime'";

    }

    if (!(defined $pFaxNumb && isvalidstring($pFaxNumb))) {

    $ERR_CODE__ = "3";

    $ERR_DETAILS__ = "Invalid value '$pFaxNumb' for parameter 'pFaxNumb'";

    }

    if (!(defined $pFaxLocation && isvalidstring($pFaxLocation))) {

    $ERR_CODE__ = "3";

    $ERR_DETAILS__ = "Invalid value '$pFaxLocation' for parameter 'pFaxLocation'";

    }

    print qq||;

    print qq||;

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    39/53

    Advanced Auto Attendant G

    Page 39 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;

    print qq| |;print qq| |;

    print qq||;

    ... as in the previous script .

    Figure 26 Refil_2.pl. Inserted code is Indicated in a bold red font

    1 use warnings;

    2 use strict;

    3 use DBI;

    4

    5 sub Refill_1 {

    6

    7 my $ivrable = 1;

    8 my $spanish = 0;

    9 my $err = 4;

    10 my $ani=shift;

    11

    12 my $dbh = DBI->connect('dbi:mysql:test','root',thepassword');

    13 if ($dbh) {

    14 my $sth = $dbh->prepare("SELECT pat_ivr_refill_allowed, pat_spanish_pcm_pde

    FROM patient

    WHERE pat_phone=\"$ani\" OR pat_phone2=\"$ani\"");

    15 if ($sth && $sth->execute()) {

    16 my ($pers_ivrable, $pers_spanish);

    17 $sth->bind_col(1, \$pers_ivrable);

    18 $sth->bind_col(2, \$pers_spanish);

    19

    20 while ($sth->fetch) {

    21 $ivrable = 0 if ($pers_ivrable ne "Y");

    22 $spanish = 1 if ($pers_spanish eq "Y");

    23 }

    2425 $sth->finish();

    26 $err = 0;

    27 }

    28 $dbh->disconnect;

    29 }

    30 return ($ivrable, $spanish, $err, $DBI::errstr);

    31 }

    32 1;

    Figure 27 Refill_1_sup.pm Perl Module

    4.2.6 AnalyzeDBDialog

    Control is passed to this dialog if no errors are reported in response to the web request action in theRefillStartdialog. TheAnalyzeDB dialog continues the script execution based on a code returned from

    the web server which is assigned to the variable iDBResultas shown in Figure 28:

    In case of a positive response to the refill request (iDBResult =1) script execution proceeds with theContactPhone dialog.

    If the prescription ID is not found (iDBResult = 2), is discontinued (iDBResult = 3), or it is too soon torefill the prescription (iDBResult = 4) - the caller is informed and the call is disconnected.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    40/53

    Page 40 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    If the prescription has expired or there are no refills are left (iDBResult = 5 and 6, respectively), then theAskIfContactDoctordialog is executed.

    The call is transferred to an Attendant if there are any problems with the retrieved data not matching thedefined values.

    Figure 28 AnalyzeDBDialog

    4.2.7 AskIfContactDoctorDialog Demonstrating the Fax on DemandAction

    In this dialog the caller has the option of requesting that the MX contact the doctor about thisprescription (so they can proceed with the refill request and wait for the doctors authorization) ordisconnecting the call.

    If the caller chooses to contact a doctor the system activates the Fax on Demandaction whichdownloads a fax file (prepared in advance) from the URL specified by the sFaxURL variable on the MX.Then MX then sends the fax to the phone number specified by the sDoctorFax variable. The script thenproceeds with the ContactPhone dialog. See the Fax on Demand action configuration screen in Figure29.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    41/53

    Advanced Auto Attendant G

    Page 41 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Fax sending is performed in background mode, i.e. a script does not wait until the operation isexecuted. The number of attempts to send a fax and the time interval between attempts are specified inMX system settings. The results can be tracked using CDR reports.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    42/53

    Page 42 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 29 AskIfContactDoctor Dialog and the Fax on Demand Action

    4.2.8 Refill Delivery

    The final part of this pharmacy script deals with finalizing the order and determining the deliveryoptions.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    43/53

    Advanced Auto Attendant G

    Page 43 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    In the ContactPhone dialog the caller is asked to enter a contact phone number. In theDeliveryOptionsdialog the caller selects their preferred method of obtaining the refill (1-pickup, 2-delivery, 3-by mail).This is shown in Figure 30 below:

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    44/53

    Page 44 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 30 ContactPhoneand DeliveryOptionsDialogs

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    45/53

    Zultys Technologies

    Page 45 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Figure 31 -DBUpdate Dialog

    In the DBUpdate dialog the last request to the web-server is performed to save the order and to receive adelivery date and time for the caller. This process is illustrated in and Figure 32.

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    46/53

    Zultys Technologies

    Page 46 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    .

    Figure 32 Web Server Request in the DBUpdateDialog

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    47/53

    Zultys Technologies

    Page 47 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    #=== {{{{{

    if ($ERR_CODE__ == 0) {

    use DBUpdate_sup;

    ($the_date,$the_time,$ERR_CODE__,$ERR_DETAILS__) =

    DBUpdate_sub($prescr_id,$phone,$delivery,$previousResult);

    }

    #=== }}}}}

    Figure 33 Modification of DBUpdate.pl

    1 use warnings;

    2 use strict;

    3 use DBI;

    4

    5 sub DBUpdate_sub {6

    7 my $ivrable = 1;

    8 my $spanish = 0;

    9 my $err = 4;

    10 my $ani=shift;

    11

    12 my $dbh = DBI->connect('dbi:mysql:test','root',thepassword');13 if ($dbh) {

    14 my $sth = $dbh->prepare("SELECT pat_ivr_refill_allowed, pat_spanish_pcm_pde

    FROM patient

    WHERE pat_phone=\"$ani\" OR pat_phone2=\"$ani\"");

    15 if ($sth && $sth->execute()) {

    16 my ($pers_ivrable, $pers_spanish);

    17 $sth->bind_col(1, \$pers_ivrable);

    18 $sth->bind_col(2, \$pers_spanish);

    19

    20 while ($sth->fetch) {

    21 $ivrable = 0 if ($pers_ivrable ne "Y");

    22 $spanish = 1 if ($pers_spanish eq "Y");

    23 }

    24

    25 $sth->finish();

    26 $err = 0;

    27 }

    28 $dbh->disconnect;

    29 }

    30 return ($ivrable, $spanish, $err, $DBI::errstr);

    31 }

    32 1;

    Figure 34 DBUpdate_sup.pm Modulo

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    48/53

    Page 48 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    Figure 35 DBUpdate_sup.pm Modulo

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    49/53

    Advanced Auto Attendant G

    Page 49 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    5 Appendix A. Database Scheme

    rx

    PK rx_id

    FK1 pat_idrx_statusprev_refill

    expiredFK2 drug_abbrev

    patient

    PK pat_pers_id

    pat_lnamepat_fname

    pat_phoneFK1 pat_usual_doctor_code

    pat_refill_reminder

    pat_ssnpat_spanish_pcm_pde

    doctor

    PK doc_code

    doc_lname

    doc_fnamedoc_title

    doc_phonedoc_fax

    doc_call_fax_pref

    drug

    PK drug_abbrev

    drug_trade_name

    drug_generic_namedrug_refill_reminderdrug_discontinued

    Figure 36 Database Scheme (simplified)

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    50/53

    Page 50 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    6 Appendix B. Language codes passed to a TTS Serverscript

    Language Code Language Code

    Arabic (Kuwait) ar-kw Korean (North) ko-kp

    Arabic (Saudi) ar-sa Korean (South) ko-kr

    Bulgarian (Bulgaria) bg-bg Malay (Bruney) ms-bn

    Chinese (Cantonese) zh-hk Malay (Bahasa Melayu) ms-my

    Chinese (Mandarin) zh-tw Malay (Singapore official) ms-sg

    Chinese (Mandarin mainland) zh-cn Polish (Poland) pl-pl

    Chinese (Singapore official) zh-sg Portugese (Brazil) pt-br

    English (UK) en-uk Portugese (Portugal) pt-pt

    English (USA) en-us Russian (Russia) ru-ru

    French (Canada) fr-ca Spanish (Castilian) es-es

    French (France) fr-fr Spanish (Mexican) es-mx

    German (Austria) de-at Swedish (Sweden) sv-se

    German (Germany) de-de Tagalog (Philippine official) tl-ph

    Hebrew iw-il Tamil (Singapore official) ta-sg

    Indonesian (Bahasa Indonesia, malay) in-id Thai (Thailand) th-th

    Italian (Italy) it-it Ukranian (Ukraine) uk-ua

    Japanese ja-jp Vietnamese(Vietnam) vi-vn

    Table 6 Language Codes Passed to a TTS Server Script

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    51/53

    Advanced Auto Attendant G

    Page 51 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    7 Table of Contents

    1 Introduction .........................................................................................................................1

    1.1 Audience .......................................................................................................................................................1

    2 IVR Architecture in Brief......................................................................................................1

    2.1 Examples in this document ........................................................................................................................... 3

    3 Brief Introduction to the AAA Scripting Tool........................................................................3

    3.1 Types of Variables ........................................................................................................................................3

    3.2 Predefined Variables.....................................................................................................................................4

    3.3 Dialogs and Actions ......................................................................................................................................4

    3.4 Prompts ......................................................................................................................................................... 5

    3.5 Using an External TTS Server ......................................................................................................................73.5.1 Communicating with the TTS Server ............................................................................................................73.5.2 Configuring Access to the TTS Server..........................................................................................................9

    3.6 Dynamic Fax On Demand...........................................................................................................................10

    4 Example - Drug Refill System ...........................................................................................11

    4.1 Drug Refill System - State Machine............................................................................................................11

    4.2 Drug Refill System Script Variables ..........................................................................................................144.2.1 Root Dialog .................................................................................................................................................154.2.2 Web Script................................................................................................................................................... 224.2.3 Using Script Output in Voice Scenario........................................................................................................294.2.4 DBReq_1 and LanguageDialogs and the Change LanguageAction ........................................................ 294.2.5 EnglishDialog Main System Menu ..........................................................................................................334.2.6 AnalyzeDBDialog .......................................................................................................................................394.2.7 AskIfContactDoctorDialog Demonstrating the Fax on DemandAction .....................................................404.2.8 Refill Delivery ..............................................................................................................................................42

    5 Appendix A. Database Scheme ........................................................................................49

    6 Appendix B. Language codes passed to a TTS Server script ...........................................50

    7 Table of Contents..............................................................................................................51

    8 List of Tables.....................................................................................................................52

    9 List of Figures....................................................................................................................52

    10 Colophon...........................................................................................................................53

    10.1 Software ......................................................................................................................................................53

    10.2 Fonts ...........................................................................................................................................................53

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    52/53

    Page 52 of 532 October 2007 Document 95-10098-03 IVR - Advanced Auto Attendant Guide

    Advanced Auto Attendant Guide

    8 List of Tables

    Table 1 Types of Variables......................................................................................................3

    Table 2 -Pre-defined Variables..................................................................................................4

    Table 3 - Pre-defined Actions....................................................................................................5

    Table 4 Pronounciation Modifiers............................................................................................7

    Table 5: Breakdown of script Refill_1.pl...................................................................................25

    Table 6 Language Codes Passed to a TTS Server Script.....................................................50

    9 List of Figures

    Figure 1 IVR Solution Overview ..............................................................................................2

    Figure 2- Example Using external TTS servers.......................................................................8Figure 3 Example of Real-Time response from TTS server .......................................................9

    Figure 4 Configuring Access to Real-Time TTS Server...........................................................9

    Figure 5 Dynamic Fax On Demand to request fax files from a web server ....................10

    Figure 6 Drug Refill Application State Machine .....................................................................13

    Figure 7- Script Properties Screen...........................................................................................15

    Figure 8 Root Dialog ...........................................................................................................15

    Figure 9 Root Dialog, GoTo Action ....................................................................................16

    Figure 10 Root Dialog, Web Server Request action, Request parameters.....................18

    Figure 11 Root Dialog, Web Server Request action, Response parameters.........................20

    Figure 12 Root Dialog, Web Server Request action, Web Script generation ........................21

    Figure 13 Script Generation Parameters for Refill_1.pl............................................................24

    Figure 14 Temporary assignment of output variables to dummy values ...............................25

    Figure 15 Script Output .........................................................................................................26

    Figure 16 Script Input Parameters ........................................................................................26

    Figure 17 Modification of Refill_1.pl ......................................................................................27

    Figure 18 Refill_1_sup.pm Module........................................................................................29

    Figure 19 DBReq_1 Dialog ...................................................................................................30

    Figure 20 Change Language Action......................................................................................31

    Figure 21 Language Dialog ................................................................................................32

    Figure 22 English Dialog Sample Drug Store Main Menu .............................................33

  • 8/6/2019 IVR Advanced Auto Attendant User Guide 2 October 2007

    53/53

    Advanced Auto Attendant G

    Figure 23 English Dialog ....................................................................................................34

    Figure 24 RefillStartDialog ................................................................................................35

    Figure 25 Web Server Request, Response, Script in RefillStartDialog .........................36Figure 26 Refil_2.pl. Inserted code is Indicated in a bold red font ...................................39

    Figure 27 Refill_1_sup.pm Perl Module ................................................................................39

    Figure 28 AnalyzeDBDialog .................................................................................................40

    Figure 29 AskIfContactDoctor Dialog and the Fax on Demand Action ..................................42

    Figure 30 ContactPhoneand DeliveryOptionsDialogs .........................................................44

    Figure 31 - DBUpdateDialog .................................................................................................45

    Figure 32 Web Server Request in the DBUpdateDialog.......................................................46

    Figure 33 Modification of DBUpdate.pl..................................................................................47

    Figure 34 DBUpdate_sup.pm Modulo ...................................................................................47

    Figure 35 DBUpdate_sup.pm Modulo ...................................................................................48

    Figure 36 Database Scheme (simplified) ..............................................................................49

    10 Colophon

    10.1 Software

    This document was created in Microsoft Word 2002. The figures were imported from Microsoft Visio2002.

    10.2 Fonts

    The following the list of paragraph styles and fonts used in this document:

    Heading 1 (1) Arial, 16 pt, bold Heading 2 (1.1) Arial, 14 pt, bold, italic

    Heading 3 (1.1.1) Arial, 13 pt, bold

    Heading 4 (1.1.1.1) Times New Roman, 12 pt, bold

    Heading 5 (1.1.1.1.1) Times New Roman, 11 pt, bold, italic

    Body text Times New Roman, 12 pt Caption (Figures and Tables) Arial, 10 pt, bold

    Footer Arial, 8 pt

    Header Arial, 12 pt, boldTOC1 A i l 12