Introduction to Xtend IVR

What is Xtend IVR?

Xtend IVR is a Rapid Application Development toolkit for implementing Interactive Voice Response Systems quickly and easily. Any Computerised Telephony Integration solution can be implemented with reduced cost, time and complexity using our toolkit. Possible application areas include:

  • Banking
  • Price & Stock Enquiry
  • Payment Reminder systems
  • Package & Delivery Tracking
  • Employee Benefit
  • Complaint Booking
  • Voice Mail
  • All Telephone Enquiry solutions

Xtend IVR is the only toolkit in the market with extensive support for multiple voice devices. Supported devices include all VoIP, Digital (E1/T1) and Analog devices from Eicon (Diva Server), Dialogic (Global Call API), Ai-Logix, Telephony API, Opal (OpenH323) and Skype. The development of drivers for other popular voice devices is in progress. Please check with our website at http://www.xtendtech.com/ivr for an updated list of all supported voice devices.

Xtend IVR includes support for open interfaces like Telephony API (TAPI), Speech API (SAPI), ActiveX Data Objects (ADO) and Open Database Connectivity (ODBC), due to which the toolkit works with nearly all available Telephony hardware, Speech Engines and Databases. Xtend IVR integrates with and can be extended using most programming languages.

Xtend IVR works right from a single port voice device to a 4000+ port T1/E1 solution with no changes in code. This means that an IVR can be developed for a single port implementation and can then be extended to a 4000+ port IVR system without having to make any source code changes. Xtend IVR also supports clustering of systems to provide for higher port densities of 1000+ ports and to provide for fail-over/redundant backup.

The power of Xtend IVR resides in its scripting language which is simple to learn, flexible and easy to code. Complex telephony operations like call transfer, speech recognition etc. can be coded in just a couple of lines of script. The scripting language includes the ability to call functions written in Vbscript, Javascript and Perlscript (Windows Scripting Host), functions written in C# or VB.Net (.Net Framework) and the ability to call programs written in Foxpro, Clipper, Visual Basic, C, C++ and other legacy languages.

Xtend IVR is fully Internet enabled and supports http, get/post, smtp and pop3 which enable information to be obtained from or submitted to the Internet. This enables easy integration with existing Internet solutions.

The Number to Speech Technology supported by Xtend IVR enables easy creation of regional language solutions by providing support for speaking Amounts, Dates and Numbers in Indian English and Hindi.

Multi-lingual support enables developers to handle multiple language prompts easily with no modifications in the code.

The user interface of Xtend IVR can be completely customised. This includes the About box, Window Caption and the ability to call your own executable from the user interface. Besides this, a tamper free client installation can be ensured by compiling and distributing the compiled script.

Xtend IVR supports advanced features like background play, real-time voice snooping/mixing and voice logging capability that enables one to provide superior voice solutions with minimal effort.

The Developer Edition of Xtend IVR is available for free download and contains comprehensive help, a one port runtime that works with all supported voice devices, debugging and emulation technology to enable an IVR to be developed using any multimedia system and does not have any time or feature restrictions.

Minimal system requirements for the Developer Edition of Xtend IVR include a Pentium 800 MHz system with 128 MB RAM, 80 MB of free disk space and multimedia support running Windows 2000/XP or above. Emulated telephone calls are possible via the multimedia system. However, a supported voice device like Dialogic D/4 PCI, D300JCT or Eicon Diva Server is required to be able to test the scripts in action on actual telephone lines.

Copyright © 1997 - 2014 Xtend Technologies Pvt Ltd.


Xtend IVR Features

Key Features

  • Built-in scripting language - Simple to learn, flexible and easy to code
    The power of Xtend IVR resides in its scripting language which is simple to learn, flexible and easy to code. Complex telephony operations like call transfer, speech recognition etc. can be coded in just a couple of lines of script.
  • Support for Multiple Voice Devices - Digital, Analog, H323, SIP, TAPI & Skype Supported
    Xtend IVR implements a driver model for interfacing with voice devices. This enables Xtend IVR to support practically any voice device in the market. At present, drivers are available that support Digital (E1/T1), SS7, H323 & SIP and Analog voice devices from Eicon and Dialogic. Examples of supported devices include Diva Server PRI/E1, Diva Server Analog 4P, Diva Server V-PRI/E1, Diva Server V-4PRI, Diva Server V-PRI/T1, Diva Server Soft SS7, Diva Server SoftIP, D/4 PCI, D/4 PCI UF, D/300 JCT E1 etc. Additional voice devices are being supported on a ongoing basis, depending on customer requests and device availability.
  • Comprehensive Database Support - Use ADO or ODBC to query SQL Server, Oracle or Access
    Xtend IVR provides simple database functions to access SQL Server, DB2, Oracle, Sybase, Access and other standard databases via ADO and ODBC. In most cases, direct SQL statements can be inserted inside the script to obtain the required data. Advanced database functionality can be implemented by interfacing to any of the supported languages.
  • Extensive Language Integration - Call Vbscript, C#, VB.Net, Foxpro, VB or C++ functions
    The scripting language includes the ability to call functions written in Vbscript, Javascript and Perlscript (Windows Scripting Host), functions written in C# or VB.Net (.Net Framework) and the ability to call programs written in Foxpro, Clipper, Visual Basic, C, C++ and other legacy languages.
  • Exhaustive Examples - Over 40 samples demonstrating ivr capabilities
    Over 40 samples demonstrating the different capabilities and functionality of Xtend IVR are included in the developer and standard editions. Samples include tele-banking, examination result announcement, calling web services, .Net integration, streaming voice channels and many more.
  • Scalability and Multi-Port Capability - Scale up to 4000+ ports with no changes to code
    Xtend IVR works right from a single port voice device to a 4000+ port T1/E1 solution with no changes in code. This means that the developer can code for a single port IVR and deploy the same for a 4000+ port IVR simply by purchasing and installing the 4000+ port Xtend IVR Runtime. All multitasking and inherent inter-process complexities are automatically handled by the toolkit leaving the developer free to concentrate on the application being deployed. Xtend IVR also supports clustering of systems to provide for higher port densities of 1000+ ports and to provide for fail-over / redundant backup.
  • Text to Speech - Speech API 4.x and 5.x compliant
    Support of all Speech API 4.x and 5.x compatible engines for Text to Speech. UT8 strings are supported for TTS enabling support of foreign language speech engines.
  • Speech Recognition - Speech API 5.x compliant
    All Speech API 5.x engines are supported for Speech Recognition. The ability to dynamically create and load multiple recognition grammars is supported as is the ability to perform speech cut-through on complete recognition of sentence, on recognition of the first word and in presence of speech.
  • Multi-language prompts - Implement prompts for multiple language prompts easily
    The scripting language is designed from ground up for easy multi-language prompt support and enables the user to quickly implement ivr support for multiple languages without having to make any substantial modifications to code.
  • Innovative Number to Speech - Speak out numbers in English, Hindi and Malayalam
    The extensible number to speech conversion enables any number, date or monetary value to be spoken out. Languages currently supported include English, Hindi or Malayalam. Country dependant number to speech ensures that numbers are converted correctly based on the prevailing standard of that country. At present US, UK and Indian standards are supported.
  • Background Playback - Add corporate or advertising jingles into your ivr
    Ability to play a wave file in the background while simultaneously playing prompts enables one to incorporate background jingles or corporate tunes instantly into an ivr solution.
  • Real-time Voice Streams - Soft conference between difference voice devices
    Voice streams from any full-duplex voice device can be streamed to any other voice device channel thereby enabling soft interconnect of voice streams. This enables functionality such as the ability to snoop ivrs calls in real time, stream ivrs conversations to a multimedia device and to conference channels to each other. For example, an incoming call in Skype could be conferenced to an incoming call on the Dialogic Diva Server voice card.
  • Voice Logging - Maintain voice records of IVR interactions
    Complete voice logs for any channel can be implemented via the insertion of a single voicelog command into the script. This is useful for maintaining raw voice records of ivrs usage for official purposes or for debugging ivrs problems.
  • Background Threads - Implement additional housekeeping tasks
    Support for general purpose ports to implement additional functionality not directly related to, but playing a supporting role to the IVR. For example, polling a serial device every 10 seconds or for retrieving mail every 3 minutes etc. These general purpose ports run the same scripting language, enabling one to quickly implement background tasks.
  • Multimedia Streams - Stream live audio
    Support for multimedia devices for streaming audio to multiple channels. For example, the input of the sound card mic can be taken and provided to all callers who dial into the system. Such an implementation could be used for providing a real-time radio / music channel service to callers.
  • Support for Fax - Fax HTML documents
    Supports faxing of tiff images or HTML pages. Ability to implement fax-back systems, or dial-back fax systems. Supports color faxing under specific cards. Fax support is available as a separate software pack that must be purchased independently.
  • SMS Support - Send or Receive SMS including long sms and unicode
    Supports the ability to send and receive SMS messages via a standard GSM modem. Comprehensive support for Unicode text, long sms and Flash messages are present. SMS support is available as a separate software pack that must be purchased independently.
  • Call Conferencing - Create party or conference calls
    Has built-in facility to implement multi-party conferences using on-board resources to minimise cpu usage. Call conference support is available as a separate software pack that must be purchased independently.
  • Run-time Customisation - Modify runtime gui to match customer application
    Xtend IVR has the capability to change the logo bitmap and also set the messages that appear in the window title and its about dialog box so as to facilitate developer customisation.
  • Plugin Interfaces - Extend the scripting language using C++
    Xtend IVR supports a plugin interface to enable easy extensions to its scripting language. This permits implementation of additional functionality if such customisation is required. For example, the in-built database functionality and smtp / pop3 access is implemented as plugins.
  • Script Compiler - Protect script from end customer modifications
    Xtend IVR supports compiled scripts, so that end user modification of script files can be prevented. To prevent any sort of tampering, Xtend IVR scripts are tokenised, encrypted and check-summed.
  • Full-fledged Developer Edition - Free download (includes one port runtime)
    Unlike a conventional development environment which requires the use of two phone lines to test and debug the IVR prompts, the Xtend IVR Developer Edition simulates an incoming call in software which allows the IVR development to be done on any multimedia system. In fact the developer edition is completely free for you to try out and can be downloaded from http://www.xtendtech.com/


Xtend IVR types

Developer and Standard Edition

Developer Edition contains the development environment and a single port runtime. The developer edition is used to develop and demo an IVR solution using Xtend IVR. However, the developer edition runtime should not be used in final production implementations of IVR solutions. The runtime is full-fledged, supporting one telephone line and is not technically limited in anyway. However, restrictions on customising the About box information and the main window bitmap are present.

System Requirements
  • Pentium 800 MHz or better
  • 128 MB RAM
  • 80 MB free disk space
  • Speakers and/or Mic
  • Windows 2000/XP/2003

Standard Edition contains the development environment and the runtime capable of supporting the licensed number of ports. The standard edition is used for development and final production implementations of IVR solutions. The standard edition runtime allows complete customisability of the about box information and the main window bitmap as per user requirements. Licensing is enforced via a USB dongle.

System Requirements
  • Pentium 1 GHz or better
  • 256 MB RAM
  • 80 MB free disk space
  • Speakers and/or Mic
  • Any supported voice device
  • Windows 2000/XP/2003
Note: System requirements may vary depending on addition technologies in use on the same system. For example, speech recognition for multiple ports would require a better CPU and more memory.


Supported Voice Devices

Xtend IVR implements a device driver architecture for supporting practically any voice device available in the market. Drivers are constantly updated to support newer voice devices. At present, the following drivers are supported:

  1. Dialogic (SDK 5.1.1)

    All Dialogic Voice Cards supporting Global Call API under 5.1.1 is supported. Extensive testing of Xtend IVR is performed using D/4 PCI UF (for Analog) and D/300 E1 JCT (for Digital) voice cards.

  2. Dialogic (SDK 6.0)

    All Dialogic Voice Cards supporting Global Call API under 6.0 is supported. Extensive testing of Xtend IVR is performed using D/4 PCI UF (for Analog) and D/300 E1 JCT (for Digital) voice cards.

  3. Diva Server (SDK 4.0)

    All Dialogic Diva Server Voice Cards and Soft Device (H323 & SIP) are supported. Extensive testing of Xtend IVR has been performed using Diva Server V-Analog-4P (for Analog) and Diva Server PRI/E1/T1-8 / Diva Server V-PRI/E1 (for Digital).

  4. Ai-Logix (SDK 3.8)

    All E1/T1/Analog Ai-Logix Voice Cards are supported. Extensive testing of Xtend IVR has been performed using Ai-Logix LD409 (for Analog) and Ai-Logix DT3209 (for Digital).

  5. NMS Communications (Natural Access 2005-1 SP3)

    Most NMS cards supporting Natural Access 2005-1 SP3 have been supported. Extensive testing of Xtend IVR has been performed using CG 6000 and AG 4040 (for Digital). AG 2000 and QX 2000 has been verified working (for Analog).

  6. Donjin (NADK 1.8)

    Most Donjin cards supporting NADK 1.8 have been supported. Extensive testing of Xtend IVR has been performed using DN1200 E1 and DN300JCT E1 (for Digital) and DN16AJCT (for Analog).

  7. DonjinCSP (NADK 1.8.1)

    The DonjinCSP driver supports NADK 1.8.1 in Continuous Speech Processing (CSP) mode for all Donjin JCT cards. Extensive testing has been performed using the Donjin DN600JCT-1E1 digital voice card.

  8. Synway (SynCTI 4.7)

    Most Synway cards supporting SynCTI 4.7 have been supported. Extensive testing of Xtend IVR has been performed using SHD-30B-CT/PCI/FAX (for Digital) and SHT-8B/PCI (for Analog).

  9. Opal H323 Driver

    Opal H323 driver supports the H.323 protocol for VoIP. The driver implementation utilises the Opal Libraries available from http://www.voxgratia.org/

  10. Skype Phone (BETA)

    Skype is supported via the Skype API. Extensive testing has been performed only for upto four simultaneous ports.

  11. Telephony API 2.1 [Half-Duplex]

    TAPI 2.1 is supported in half-duplex mode. Extensive testing has been performed using the Dialogic D/4 PCI / Tata PCT An (for Analog) and Dialogic Diva Server PRI/E1/T1-8 (for Digital) voice devices.

  12. Telephony API 2.1

    TAPI 2.1 is supported in this full-duplex tapi driver. Extensive testing has been performed using the Dialogic Diva Server PRI/E1/T1-8 (for Digital) voice devices.

  13. Multimedia Wave Driver

    Multimedia devices are supported via this driver. This enables one to stream voice to the Multimedia Speakers or stream in voice from the Line-In/Mic. Live audio services can be supported via this driver.

  14. Xtend Service Driver

    The service driver is a null device used to create worker threads that can be utilised to perform any background task like reading from the com port or to schedule services for later date.

  15. Generic GSM Modem

    The Generic GSM Modem is a driver that supports the sending and receiving of SMS Messages using standard GSM Modems. Full support for Unicode, Long, Blink and Flash Sms are present. The Generic GSM Modem driver is available along with the Xtend SMS toolkit as a separate purchase and can be integrated into an IVR solution, if required.


FAQs - Answers

Xtend IVR - FAQ
  • What is the difference between the Standard and Developer Editions?

    Standard Edition comprises of the development environment and the runtime capable of supporting the licensed number of ports. The standard edition is used for development and final production implementations of IVR solutions. The standard edition runtime allows complete customisability of the About box information and the main window bitmap as per user requirements. Standard Edition is priced and licensing is enforced via a USB dongle.

    Developer Edition comprises of the development environment and a single port runtime. The developer edition is used to develop and demo an IVR solution using Xtend IVR. However, the developer edition runtime should not be used in final production implementations of IVR solutions. The runtime is full-fledged, supporting one telephone line and is not technically limited in anyway. However restrictions on customising the About box information and the main window bitmap are present. Developer Edition is available as a free download.

  • How do I start Xtend IVR?

    When you install the Xtend IVR toolkit (Standard or Developer) it will add desktop icons named "Xtend IVR 3.0" and "Xtend IVR 3.0 Developer Edition". You can run the Xtend IVR runtime or the Xtend IVR Developer Edition by double clicking on the appropriate desktop icon.

  • Why do I get the error message "HASP not found"?

    You usually get this error message if you try to run the Standard Edition Xtend IVR runtime without plugging in the USB dongle. By default, when you install Xtend IVR Standard Edition, the drivers for the dongle are automatically installed. In case you have re-installed the Operating System, please re-install the Xtend IVR Standard Edition also.

  • How many phone lines does Xtend IVR support?

    At present, Xtend IVR has a maximum supported limit of 512 phone lines on a single machine. This is an artificial limit imposed primarily for ease of testing the database support, language stability and the load factor. This limit will be increased in the future. If more than 512 phone lines are required to be supported, it is recommended that multiple machines be used.

  • Are Text-To-Speech engines supported?

    Xtend IVR supports any telephony compatible Text-to-Speech Engine that supports the Speech API (SAPI 4.x & 5.x) and provides a 16 bit, 8 KHz waveform output. Xtend IVR has been tested with the Microsoft TTS Engines as well as with the TTS Engines available from Lernout & Hauspie (L&H).

  • What Operating Systems does Xtend IVR work under?

    Windows 2000, XP and 2003 are the supported platforms. Xtend IVR will work under Windows 98 & Me with reduced functionality.

  • What kind of user support is provided?

    Technical queries regarding feature implementations or bugs are available at support@xtendtech.com and queries related to sales can be posted to sales@xtendtech.com

  • What are the supported voice devices?

    Drivers are available that support Digital (E1/T1), SS7, H323 & SIP and Analog voice devices from Eicon, Dialogic and Ai-Logix. Drivers for TAPI, Opal H323/SIP and Skype are also available. Additional voice devices are being supported on an on-going basis, depending on customer requests and device availability.

  • Which is the latest version of Xtend IVR?

    Xtend IVR 3.0 is the latest version of Xtend IVR.

  • Is speech recognition possible in Xtend IVR?

    All Speech API 5.x engines are supported for Speech Recognition. The ability to dynamically create and load multiple recognition grammars is supported as is the ability to perform speech cut-through on complete recognition of sentence, on recognition of the first word and in presence of speech.

  • Will Xtend IVR detect pulse and tone keystrokes?

    Xtend IVR accomplishes tone and pulse detection via the telephony voice device API. If the voice device supports this capability, then Xtend IVR will support it. Note: Voice Modems do not support pulse detection capability.

  • Does Xtend IVR support analog and digital lines?

    Xtend IVR supports both analog and digital lines. For digital lines you need a voice card that supports the specific protocol provided in the E1/T1 connection. Note: All digital protocols may not be supported by all voice cards.

  • Is Database Access possible?

    Yes. Database access is supported via the DB plugin which supports ADO or ODBC. Full-fledged examples are provided in the Developer Edition that illustrate how to achieve this.

  • Play command and Record command do not work simultaneously in Xtend IVR?

    If the hardware is half-duplex, then Xtend IVR will not be able to simultaneously play or record wave files. For example, the D/4 PCI UF card from Dialogic is a half-duplex card. In most cases, Xtend IVR automatically determines if the voice card is full-duplex or not and will function correctly.

  • Do you need a Sound card to run Xtend IVR?

    Xtend IVR includes a development environment that utilises the sound card to simulate a voice device. This enables the developer to create and test an IVR using a multimedia capable PC. The runtime does not require the sound card.

  • What is the recommended sampling rate for wav files?

    8 KHz, 16 bit, mono.


Contact Information
Xtend Technologies (P) Ltd.
"Blue Hill",
Kalathiparambil Lane,
Ernakulam South,
Cochin, Kerala
INDIA - 682 016

Phone No.: | +91-484-2378008, 3291008
Fax No.: | 2378008

E-Mail: | info@xtendtech.com
 | support@xtendtech.com
 | sales@xtendtech.com


Main Window

Main Window is the chief user interface provided to manage the Xtend IVR. The function key F9 reloads the application, which is ready to be executed, into the IVR. The major components of the Main Window are distinguished below.

Xtend IVR Icon

Brings about the system menu. You can also right click on the Title bar or press the hotkey Alt + <Space> to generate the same.

Display Area

Shows the list of currently active TAPI devices. This provision in developer edition could be used to monitor each channel and track the call progress by inserting 'display' command at the appropriate places in the script.

Enable/Disable Xtend IVR

Press this button to hang-up the active connecting lines and suspend currently executing script. Xtend IVR won’t accept any new connection in the disabled state as shown below.

IVR is enabled | IVR is disabled

To establish a new connection press the button again. The script execution will resume.

View Log

View LOG file shows the log file for the active application script. If it cannot be loaded, then it shows the system log file. Xtend IVR maintains separate log files to store the history of events occurring during the execution of the script. Each script will have its own log files. This file is kept in the "Logs" folder in script directory. A separate log file viz., the system log file, is kept for noting the activities taking place on each day. The naming convention for this file is yyyymmdd in digits. For example, the log file for 29th June 2000 will be 20000629. The LOG command writes the status of the operation of script into the log file. Hence by examining these logs periodically, we can understand what went wrong & where, during a system failure. When you click this button it will bring forth a window showing the contents of the current application log file. Press Ctrl key and View Log button together to bypass the dialog box and view the system log file directly.

User Button

This is a user-defined button and will execute the program defined by the user in the configuration (xivr.ini) file. For more information, please refer the section Advanced Settings.

About

Displays the About Box of Xtend IVR. For more information, click here.

Note: You can change the appearance of this window by modifying the default settings. For more information, please read the Xtend IVR Configurator (XIVRCFG).


Phone

Simulated Phone

Handset

This is the handset of the phone. Click on the handset or press F3 to lift the receiver. Click once again on the handset or press F4 to terminate the call or to hang-up the receiver. It is possible to refresh the application with a double click on the function key F9.

Source

Show / Hide the source code window.

Variables

Show / Hide the variables window.

Dial Pad

Standard Dial pad.


Source Window

Currently executing script is loaded in the Source window. The components are explained in detail below.

Load Script

Allows the user to load a new script for debugging.

Edit Script

Opens the Xtend IVR editor with the active script opened for editing. Hotkey F2 serves the same purpose in the source window.

Default

Changes the script execution speed to default / normal speed. Press F5 for a keyboard shortcut.

Slow

Slows down the script execution speed. You can also press F6 to implement this command.

Single Step

Changes the script execution mode to single step in order to debug the program. You can use the Step button to execute the script, one line at a time.

Note: For more information, one can always access the Help through the hotkey F1.


Variable Window

Category

Different variable categories available in the software are listed in the Variable window, also known as the Watch window. Currently there are three categories - System, General and Group variable. System contains the system variables or reserved variables, which are declared by the Xtend IVR. General category consists of the user-defined variables in the script whereas Group variable(s) implies the resultant group prefix returned by a database query. Each group comprises of the fieldnames and other relevant information pertaining to the recordset.

Variable

This window displays all variables listed under the selected category.

Value

The contents of the selected variable are displayed in this window. When the script is executed in single step mode, the contents, which is the variable value, can be directly edited. To bring up a separate edit window, double click the variable in the variable window.

You can change the value by typing the new value in the edit box. The new value will be automatically updated by the Xtend IVR when you close the window by pressing the OK button.


Introduction to Xtend IVR Editor

Editor

Introduction

The Xtend IVR Editor is designed and developed exclusively for writing IVR Scripts. The editor is very similar to the Microsoft Wordpad. You can either write scripts from scratch or you can load a script template and modify it.

A window appears with all the available templates; choose from among them and click OK to load a new script. It is possible for you to customise as well as add into this template list. It is as simple as dropping the new template script into your “XIVR\Templates” directory.

Since all editing operations are similar to Wordpad, here we attempt to discuss only the new features that support the IVR scripting.

Play Wave Files

When using the play command, position the cursor on any ".wav" file and press the Play button to play back that file. The play is asynchronous and will continue in the background. You can press <Shift> + ESC key to stop the play.

You can run multiple wave files using a single Play command. If the wave file is missing in the current directory, it will check the script directory also before reporting the error.

Locating Errors from Compile Window

When you submit the script to Xtend IVR daemon, it will compile the script and report the error messages, if any, in a small window with the line number.

You can double click on these lines to force the editor to position the caret exactly on the line where the error has occurred. After correcting all the errors, click OK. Then Xtend IVR recompiles the script and starts execution.

Goto Specified Line

While handling big scripts, you may feel it difficult to go to a particular line by pressing PageUp and PageDown keys. But if you know the line number, you can press CTRL+G.

It will bring a small dialog box in which you can type the line number. If the line number is bigger than the last number, it positions the caret at the bottom of the file.

Note: The line number is given on the status bar.

Bookmark

While handling big scripts, if the developer has to zigzag between 'called functions' and 'calling functions' or refer a statement often, then he can mark that line or statement as Bookmark by positioning the cursor at that line and pressing Ctrl + F2 or 'Bookmark' button in the toolbar.

Bookmark is an Edit option. After reference, press Shift + F2 or click 'Jump to Bookmark' to return to the previous place marked as bookmark. We can remove all bookmarks by pressing Ctrl + shift + F2 or 'Remove all Bookmarks' button in the toolbar.

Goto Bookmark

When Goto Bookmark is enabled it jumps to the bookmarked position. This is used to move from one position to another, i.e. if you are performing a particular task in one position and wish to go to the starting of the script and later return to the original position, then select Bookmark in the current position and move up. Whenever you wish to return to the previously marked location, select Goto Bookmark or use hotkeys Shift+F2.

Compile & Run

The source code developed has to be checked for errors and bugs. It is at this stage, the code is linked with header files in the library. Click the Compile tool in the toolbar to compile the code. During compilation, the compiler looks for syntactic and semantic errors which are listed in the output window. On successful compilation, the code is now ready for execution.

The developer has the facility to execute the program from the editor, immediately after creation, without loading the application or installing HASP. Click the Run tool to execute the program. Thus, the effort the developer has to exert is reduced considerably.


XIVRCFG

Configuring Xtend IVR

Xtend IVR Configurator (XIVRCFG) allows the user to change various configuration options for the Xtend IVR. You can use this program to change options like currently executing script, TAPI device to be used, enable/disable Text-to-speech engine, select voice, logo, About Box settings etc. User can navigate through the window using the Next and Previous buttons. In order to quit without saving the settings, just press the ESC key.

- Next button. Moves to the next option.

– Previous button. Moves to the previous option.

– Save button. Save all modifications and quit.

Select Driver

Xtend IVR requires that you install at least one TAPI Device / Voice Modem / Xtend Voice in your system. But if you are using only the Developer Edition you can ignore this option. If more than one TAPI devices are installed (which is true if you are using a multi-line support Xtend IVR), you must select at least one TAPI Device for the Xtend IVR. Otherwise, Xtend IVR will give you an error message on the startup. If more than one TAPI devices are installed in your computer, but you got only a single line version of Xtend IVR, then Xtend IVR will select the first TAPI device by default. Others will be ignored.

Select Channels

Here, the user can indicate the channels that the Xtend IVR Runtime should use.

Select Text-To-Speech Engine

Text-to-Speech(TTS) engine articulates the written text given with the Speak command inside the script. The above picture represents the selection of the TTS Engine and the default voice to be used by the TTS engine. The TTS engines installed and the voices defined in the Speech Synthesis engine will be appropriately listed in the boxes. If not installed, then the list will be empty.

Select Speech Recognition Engine

The Speech recognition engines, especially SAPI 5.x engines, installed in the PC would be listed by the system. From the recognised list, the user indicates his/her choice of the speech recognition engines for the Xtend IVR.

Script Settings

The user has the privilege to decide the default IVR script to be loaded, during the virgin execution of the Xtend IVR. The window also renders the IVR call counter information, which describes the total number of calls attended by the Xtend IVR. If required, you may reset the counter to zero.

Customize User Button

User Button is the button found in the Xtend IVR main window. This customisable button is enabled in a Standard Edition and hence the above window is available only when you run the Standard Edition. By default the button does nothing. If you want some action to be taken when the user presses this button, enter the complete path to the executable file in the "Executable on user button" field. Xtend IVR will automatically execute this program if the button is pressed. If you wish to pass any command line argument, append the arguments after the file name such as,

C:\myapp.exe –d –e –c c:\sample.txt

You can also give the Tool Tip to be displayed when the mouse is over the button.

Customize Phone

The look 'n feel of the simulated phone displayed along with the Developer Edition Main Window is determined by selecting from a variety of available skins. By default, the window uses a Grey-hued Telephone skin. By selecting the appropriate one from the window, which is visible only in a Developer mode Xtend IVR, you can change the total outlook of the showcased telephone to suit your taste.

Customize Runtime

You can always customize the Xtend IVR Main Window to suit your needs. Xtend IVR allows you to change the Main Window caption, the About box bitmap on the right and the system menu items. The system menu items to be displayed in the Standard Edition are determined here by checking the corresponding boxes in the Show Menu. You can exclude the items by simply unchecking the appropriate options.


Advanced Configuration

Advanced Configuration Settings

Xtend IVR Toolkit stores its configuration information in a file named xivr.ini. Some of these settings can be modified using the Xtend IVR Configurator (XIVRCFG) utility. To modify other settings you will have to directly edit the xivr.ini file. Given below is a detailed explanation of various configuration parameters from the xivr.ini file.

General

 ProgramName : Caption of the Main Window.
 Script : Script to execute.
 UserExe : Program to be executed when User button is clicked.
 UserExeIcon : Icon for the User button.
 UserExeToolTip : Tool tip for the User button.
 RebootOnGPF : Whether to restart the system or Xtend IVR on GPF
 PrefixId : ID prefixed to the log entry.
 TotalCalls : Total number of calls attended by Xtend IVR.
 KeepDmp : Number of days should the system store the dump file.
 MaxDevices : Maximum of channels supported by the Xtend IVR.
 Bitmap : Path defined to the logo bitmap.
 DisableUI : When enabled Xtend IVR runs as a background process with no visible user interface.

Compatibility

LineAnswerTimeout : Maximum delay (in milliseconds) permitted before a call to the TAPI line must be answered.
LineDialTimeout : Maximum delay (in milliseconds) permitted before an event is fired.
ThreadExitTimeout : Delay in milliseconds before Xtend IVR thread exits.
PostInputDelay : Delay between two inputs.

TAPI Devices

Number of TAPI devices installed in the machine.

Speech

SapiVer : SAPI version used.
Speaker : Name of the speaker.
Product : Name of the Speech Engine.

Main Window

X : X coordinate of the Main Window.
Y : Y coordinate of the Main Window.
Width : Width of the Main Window.
Height : Height of the Main Window.

Developer Window

X : X coordinate of the Developer Window.
Y : Y coordinate of the Developer Window.
Width : Width of the Developer Window.
Height : Height of the Developer Window.

Debug

X : X coordinate of the Debug Window.
Y : Y coordinate of the Debug Window.
Width : Width of the Debug Window.
Height : Height of the Debug Window.
Editor : Default editor for Xtend IVR. The default editor is XE. It takes two command line parameters %d and %s. %d and %s will be replaced with the line number and currently executing script name. When line number is given, XE will position the caret at the specified line number.
PhoneModel : The model of the simulated phone to be displayed.

Enable System Menu

EditScript : Setting to enable the menu item in the System Menu.
ChangeScript : Setting to enable the menu item in the System Menu.
Configure : Setting to enable the menu item in the System Menu.
Appwindow : Setting to enable the menu item in the System Menu.

Logs

X : X coordinate of the Log Window.
Y : Y coordinate of the Log Window.
Viewer : Text Editor to display logs.

Variable Window

Contains settings for the Variable Edit Window.

X : X coordinate of the Variable Edit Window.
Y : Y coordinate of the Variable Edit Window.
Width : Width of the Variable Edit Window.
Height : Height of the Variable Edit Window.
Visible : Setting to decide the visibility of the Variable Edit Window.

Source Window

Contains settings for the Source Code Window.

X : X coordinate of the Source Window.
Y : Y coordinate of the Source Window.
Width : Width of the Source Window.
Height : Height of the Source Window.
Visible : Setting to decide the visibility of the Source Window.


XIVR TroubleShooting

Troubleshooting

If your Xtend IVR does not work when connected to the modem, then following can be some of the reasons:

  • Verify that the driver is installed.
  • If driver is already installed, then check whether it is installed properly.
  • Make sure that the connected cable is not damaged.
  • The port to which the cable is connected can be faulty.
  • Defective voice card / voice modem may be the cause of the problem.
  • Dial-Up connection may not have been established properly.

Xtend IVR Developer Edition

  • If the handset is clicked to simulate an incoming call but you get no response, then ensure that your sound card and desktop speakers are OK. Checkup the volume levels of the controls. Enable your wave port and try playing a wave file using media player. If the source window is open, press F5 to ensure that the mode of execution is in default mode.
  • If you are not able to make a call to your IVR, then ensure that you are running Xtend IVR Runtime. The developer mode does not have any telephony capabilities. It works only with your sound card.

    Xtend IVR runtime is named as xivr.exe

    Xtend IVR Developer is named as xivrd.exe

  • If you want to close the talking windows, invoked by Xtend IVR then click on that talking window and press ESCAPE key to close them. Those talking windows are created and updated by a plug-in called FlashBox.exe

For more queries and contact information, please click here.


Getting Started with Xtend IVR

Getting Started

The Xtend IVR Scripting language is simple to learn, flexible to implement and easy to code. The inherent technical complexity of creating an IVRS has been completely eliminated by the introduction of simple high level Telephony commands. Programmers can develop and deploy powerful IVR Solutions in less than a day. This Rapid Application Development capability of Xtend IVR combined with the flexibility of the Scripting language enables fast deployment of IVR solutions.

Program Flow and Structure

The Xtend IVR script revolves around these basic steps:

  • Wait for and Answer call
  • Play voice prompts
  • Accept punched keys as input
  • Process input and respond logically
  • Hang up the call
Data types

All variables in the Xtend IVR scripting language are internally stored as strings. However, when a numeric operation (like addition or subtraction) is performed on a variable the contents of the variable would be taken as a signed integer and the numeric operation is performed.

Variables

All variable names starting with a $ symbol, are not case sensitive and can be of any length. Alphabets, numbers and underscores can be used in a variable name. However, a variable cannot start with a number or underscore. Since variable is not typed, pre-declaration of the variable is not required. A variable can be directly used and would contain an initial value of "".

These are some valid Xtend IVR variable names:

  • $Call_Count
  • $Option
  • $Number1
  • $Student.Mark

These are some invalid Xtend IVR variable names:

  • $3Times (Cannot begin with a digit/number)
  • $try? (only "_" and "." are valid in a variable name)

Operators & Expressions in Xtend IVR

Xtend IVR supports the following operators

Arithmetic Operators:

    + Addition
    - Subtraction
    * Multiplication
    / Division
    = Assignment
    += Additive assignment
    -= Subtractive assignment
Relational Operators:

Relational operators return a boolean value, TRUE or FALSE.
= Equality (same symbol as assignment (above))
== Equality
!= Inequality
<> Inequality
< Lesser than
> Greater than
<= Lesser than or equal to
>= Greater than or equal to
Bitwise Operators:
& AND
| OR
^ XOR
<< Shift bits to left
>> Shift bits to the right
Macro Operator:

"$" can be used as a macro operator to access a variable value inside variable. This can be used to iterate through multiple variables, for example, assume $abc = 5 and $def = "$abc". Then the value of $$def is 5.

Expressions

Expressions are statements containing variables, constants, functions and operators. Xtend IVR allows all standard expressions to be implemented directly in the script. Some of the valid expressions are:

Eg:
$Val = 3
$Result = $Num1 + $Num2
$Per = ($curr/$Max) * 100
$Inc += 1

Labels

Labels are named locations in the script. You can use the Goto command to redirect script execution to a specified label. In Xtend IVR labels must start or end with a colon.

Examples of valid labels are:

:REPEAT_MENU
:TRY3
MAIN:
:GET_ACCOUNT_NUMBER
BEGIN:

Some invalid labels are:

:_thisisaninvalidlabel
:59_Times
:$TryAgain
:$Not_In_Queue*

Event Labels

The labels given below will be executed when specific events (like line disconnect) happen.

:ONSYSTEMERROR

This label is executed when a critical system error occurs. Usually this means that Xtend IVR is unable to continue execution of the script. Examples where this can happen include attempting to play a file that is not present in the system, internal engine errors, attempting to use Speech Recognition or text-to-speech when SAPI is not installed etc.

:ONHANGUP

This label is executed when the remote party disconnects the phone line. This label is not called when the script executes hangup. Useful to determine if the remote party hung-up the call.

:ONTIMEOUT

This label is executed when the Timeout command is in use and the script has exceeded the time allocated for it while in a call. This is quite useful to specify that a user should not exceed an allocated time. The Timeout command can be used as and when needed to increase or decrease the specified time.

:ONRUNTIMEOUT

Legacy plugins executed via the Run command have a RunTimeout command to specify how long the script should wait for the program to exit. If legacy plugins are not being used. This section is not required.

See Also Commands, Functions


Language Features

Basic Features

This section describes the basic features of Xtend IVR script language. For detailed information about the commands and their syntax please refer Commands and Functions. The language consists of Internal Commands, Loop Statements, Conditional Statements, Arithmetic Expressions, Unconditional Jumps, Plugins and External Program Execution.

Internal Commands

Internal Commands are those commands, which are implemented internally by the Xtend IVR engine. To use these commands the user is not required to install any additional Plugins. For more information about the internal command set supported by the Xtend IVR engine, please refer Language Reference. There are some built-in functions available for string manipulation and for character conversion. In addition, the language supports user-defined functions also.(For more information refer Plugins)

Loop Statements

The only loop statement currently supported by the script is the WHILE... ENDWHILE. You can nest any number of WHILE...ENDWHILE inside another WHILE...ENDWHILE statement. You can break out of an infinite loop by calling the BREAK command or by using the GOTO command.

Conditional Statements

Currently the language supports two variants of IF statements.

IF...THEN GOTO
IF…ENDIF, IF...ELSE...ENDIF , IF…ELSEIF...ENDIF.

First one is used to jump directly to a label specified after the THEN clause. Second type is used to execute a block of code inserted inside the IF...ELSE...ENDIF clause.Third one which represents the IF...ELSEIF ladder executes the block which succeeds the IF, ELSEIF or ELSE condition.

Arithmetic Expressions

Language supports any valid arithmetic expressions for Addition, Subtraction, Multiplication and Division such as:

$a = $a + $b
$a = $a+ $b * $c

Arithmetic operations are permitted only on numerical values. For more information please refer Language Reference.

Unconditional Jumps

You can use the GOTO command to unconditionally jump to another statement. GOTO can be used anywhere and at any time. That means you can even use it inside a WHILE...ENDWHILE loop to break from the loop.

Plugins

There are two methods by which we can execute an external application from the Xtend IVR script. First method is to use the RUN command, which is the recommended method and is discussed in more detail at the Executing External Programs. The second method is called the Plugin mechanism.

Commands, which are not documented as an internal command, can be called as Plugins. That means if you mistype an internal command, the script parser will report that the specified Plugin was not found. The engine will search for the Plugins under the Plugins directory and if not found would report an error.

The syntax for a Plugin and a RUN command is different. The difference lies in how the parameters are passed to the external application and how the status values are returned to the script. Under a RUN command it is the responsibility of the developer to pass the $VarFile as one of the parameters. But in the case of Plugins the Xtend IVR Engine will automatically pass $VarFile as the first parameter. This parameter is hidden from the developer. So whatever parameters the user passes, it will all come after the first hidden parameter which is the $VarFile. Hidden in the sense that it is automatically passed by the Xtend IVR Engine. Plugins can also take the syntax of a function call.

Example

Lets see how a Plugin can be used inside a script.

MsgBox(”Hello”)

The above example shows how to use the MsgBox Plugin, which is shipped with the Xtend IVR Toolkit. The first example uses the most common syntax. The second example shows the Plugin as a function call. There are some reserved variables used only by the Plugins. They all start with the $Plugin key word. These variables are

$PluginReturn
$PluginParamCount
$PluginParam1
$PluginParam2
$PluginParam3
…
…
…

If you are using the Plugin on the right side of an assignment expression you should always set the variable $PluginReturn to the value you are returning from the Plugin. Xtend IVR Engine will automatically copy the contents of the $PluginReturn to the variable on the left side of the assignment expression.

Example

$a = SomePlugin $param1 $param2
$a = SomePlugin($Param1,$Param2)

In the above example variable $a is assigned the value found in the variable $PluginReturn after the Plugin, SomePlugin, is executed.

$PluginParamCount contains the number of parameters passed to the Plugin. In the above example $PluginParamCount variable will contain the value two.

Xtend IVR Engine will automatically copy the Plugin parameters to the variables $PluginParam1, $PluginParam2, …, $PluginParamN, where N is the last parameter in the sequence. You can also retrieve these parameter values as run time arguments inside your Plugin module. But the first parameter will always be the value of the $VarFile. In the above example $PluginParam1 will contain the value of $Param1 and $PluginParam2 will contain the value of $Param2.

Executing External Programs

This is the mechanism by which the developers can integrate their module with the Xtend IVR. You invoke an external program by using the RUN command. The RUN command takes multiple parameters. But the first parameter should always be the executable program.

Example

RUN "sample.exe" $VarFile

Where sample.exe is the executable program developed by you. If you don’t give the absolute path, Xtend IVR assumes that the module is residing inside the script directory (Directory where the script (.dt) file was loaded from). If the module is not found in that directory, Xtend IVR engine will report an error. Suppose you wish to execute a Java class, then the command you should give is given below....

RUN "c: \ jdk1.2 \ bin \ java.exe myclass.class" $VarFile

Another variant of the RUN command is available which has got a different syntax. It is given below ...

! "c: \ jdk1.2 \ bin \ java.exe myclass.class" $VarFile

Both mean the same thing. Except that the latter starts with an "!" (For Clipper, dBase and Foxpro programmers, this would not come as a surprise). Now an important question arises as to how does Xtend IVR communicate with the external program? The answer is through the $VarFile. When the Xtend IVR engine finds a RUN command, it will create a temporary file and dump all active variables and their values to this file. The reserved variable $VarFile contains this file name and an external program can open this file and read all the variables and their values. They can change the values within the module and can re-write to the same file before they exit. The Xtend IVR engine will re-read this file and will update the active variables. You can also introduce new variables by appending the variable and its value to this temporary variable file. This temporary variable file is written in a special format and the user has to be careful when modifying the file. The contents of a sample temporary file is are given below.

$VarFile temp\0.var
$ScriptFile test.dt
$DeviceId 0
$RecordFile temp\0.rec
$Ring 1
$ExitCode 0
$Error Unable to open Data File
$RETRY 1000
$Date 02/03/2000
$Time 11:00:40
$Timeout 0
$HallTicketNo 12345
$Sample c: \ ivr \ sample.mdb ; ADDRESS ; ; ; MDB

As you can see every line begins with a "$" sign followed by the actual variable name then a space and finally the value of the variable. Variables and their values are defined in a single line, which means that, there should not be any new line character within the variable definition other than the line separator. There should not be any empty line in between two variables. If there is any empty line then the Xtend IVR engine will take it as the end of the variable list. The Xtend IVR engine will ignore everything below that empty line.

* Every variable should start with a "$" sign.
* Value of the variable should be in a single line. If the value overlaps to the
second line, the Xtend IVR engine will ignore the overlapped value.
* Variable name should not contain any spaces.
* Variable name containing a "." has special meaning and should be avoided.
There are some variables pre-defined (Reserved variables) by the Xtend IVR, which the user should not modify. These variables are modified by the Xtend IVR itself and contain information regarding the origin of the call and the state of execution of the script. These variables are...

$AppPath | : | Gives the path where Xtend IVR is installed.
$CallType | : | Type of call - Normal, Redirect, RedirectBusy, RedirectNoReply or RedirectUncondititional.
$Cli | : | The caller line identification that was received.
$Date | : | The current date expressed as mm/dd/yyyy.
$Debug | : | Will be 1 if running under Developer mode and 0 if running under Standard mode.
$DecimalPrecision | : | Sets the precision for all floating point numbers used by Xtend IVR.
$DeviceId | : | A unique ID for each incoming line.
$DeviceName | : | Name of the currently active channel/port in the voice driver.
$DisplayPrefix | : | The contents of this variable will be automatically added to all the display commands.
$Dli | : | Device Line Identification.
$DriverName | : | Name of the Voice driver used.
$Error | : | Contains the error messages if any from the previous operation.
$ExitCode | : | The exit code of program executed by the last RUN command.
$InputMode | : | Mode of Input - Pulse, Tone or Speech Recognition.
$LastKey | : | The last key pressed by the user.
$LogFile | : | Name of the active Log file.
$PluginParamCount | : | Number of arguments to the Plugin.
$PluginReturn | : | Return value from the Plugin.
$RecordFile | : | Path of the recorded file.
$Ring | : | The number of times the phone has rung.
$Rli | : | Redirect line Identification when the call is diverted.
$ScriptFile | : | The name of the script.
$Time | : | The current time expressed as hh:mm:ss.
$Timeout | : | The amount of time remaining for script termination.
$VarFile | : | The name of parameter file containing the list of variables.
$WavDir | : | Content of variable gives the wav file directory if not found in any of the current directory, ivr directory, wave directory or in the script directory.
$WavPass | : | Password of the encrypted wave file.
$XivrVer | : | Content gives the version of Xtend IVR.

Remarks

Developers are advised to use the RUN command for executing an external module. The Plugin concept is introduced for adding additional functionality like Database Access, Debug Support etc.

If the plugin return value is non zero then the execution will automatically jump to the ONSYSTEMERROR label.


Comments

All lines that begin with a ' ; ', ' ' ', ' / ' or ' * ' are treated as comments. This allows the user to denote a comment using the standard conventions followed by his programming language of choice. Adding a comment after a statement is not supported.

Example

; This line is a comment.
* This line is also a comment.
‘ So is this one.
/ This line is another comment.


Labels

Labels are used to indicate the destination point of a GoTo instruction. All labels in the Xtend IVR scripting language are declared with a starting or ending ‘:’ (colon). The labels are case insensitive; however, the normal convention is to use upper case to denote a label. There are certain pre-defined labels, which are executed under exceptional conditions.

Examples

ONTIMEOUT

This label is called when the time between Answer and Hangup commands exceeds the specified time limit. By default there is no time limit setting; however the limit can be assigned using the Timeout command.

ONRUNTIMEOUT

This label is called when the Run command calls the external application and the application does not exit in the specified time limit. By default there is no time limit setting; however, one can be assigned using the Runtimeout command.

ONHANGUP

This label is called only when the caller hangs up the line. Normally contains any cleanup code that has to be performed at the end of the call. Hangup command does not cause this label to be called.

ONSYSTEMERROR

This label is called when an internal system error occurs. The actual error that occurred is given in the $Error variable. Normally the code given here logs the error, executes Hangup and jumps back into the “Wait for Ring” loop.


Variables

All variables in the Xtend IVR scripting language starts with a ‘$’ sign. Variable names are not case sensitive and should be composed of an initial letter followed by combinations of letters, numbers and underscore. The standard convention is to use a combination of upper and lower case characters for the variable names.

Example

$Login = “Testing”
$MaxTries = 10

Remarks

There are certain pre-defined (reserved) variables, which the user should not modify. The values contained in these variables are changed by Xtend IVR itself and contain information regarding the origin of the call and the state of execution of the script. These variables are:

$AppPath | : | Gives the path where Xtend IVR is installed.
$CallType | : | Type of call - Normal, Redirect, RedirectBusy, RedirectNoReply or RedirectUncondititional.
$Cli | : | The caller line identification that was received.
$Date | : | The current date expressed as dd/mm/yyyy.
$Debug | : | Will be 1 if running under Developer mode and 0 if running under Standard mode.
$DecimalPrecision | : | Sets the precision for all floating point numbers used by Xtend IVR.
$DeviceId | : | A unique ID for each incoming line.
$DeviceName | : | Name of the currently active channel/port in the voice driver.
$DisplayPrefix | : | The contents of this variable will be automatically added to all the display commands.
$Dli | : | Device Line Identification.
$DriverName | : | Name of the Voice driver used.
$Error | : | Contains the error messages if any from the previous operation.
$ExitCode | : | The exit code of program executed by the last RUN command.
$InputMode | : | Mode of Input - Pulse, Tone or Speech Recognition.
$LastKey | : | The last key pressed by the user.
$LogFile | : | Name of the active Log file.
$PluginParamCount | : | Number of arguments to the Plugin.
$PluginReturn | : | Return value from the Plugin.
$RecordFile | : | Path of the recorded file.
$Ring | : | The number of times the phone has rung.
$Rli | : | Redirect line Identification when the call is diverted.
$ScriptFile | : | The name of the script.
$Time | : | The current time expressed as hh:mm:ss.
$Timeout | : | The amount of time remaining for script termination.
$VarFile | : | The name of parameter file containing the list of variables.
$WavDir | : | Content of variable gives the wav file directory if not found in any of the current directory, ivr directory, wave directory or in the script directory.
$WavPass | : | Password of the encrypted wave file.
$XivrVer | : | Content gives the version of Xtend IVR.

Following arithmetic operations are possible. Expression containing more than one arithmetic operator are however not currently supported.

$A += 1
$B -= 1
$C = $A + $B
$C = $A - $B
$C = $A * $B
$C = $A / $B

Following string operations are possible. For detailed information about the built-in functions please refer Functions.

$A = “ABCDEF”
$B = len($A)
$C = mid($A,1,1)
$A = “Try”
$B = “This”
$C = concat($A,$B)

Variables can be used at any point where a string or numeric literal is required. Other than this, variables are also supported by an IF statement which allows branching based on the result of the comparison. All variable values including numbers are internally stored as strings and therefore all string operations can also be implemented on numbers and will have the expected results. When dealing with variables following points should be noted.

  • All variables will have an initial value of 0 for Numeric variables and “ ” ( Empty String) for

    • String variables even if no explicit assignment operation has been performed.
  • If a number is sufficiently large then it is considered as a 64 bit integer.
  • If a number contains a ".", then further operations such as -, +, *, /, += and -= are treated as floating point operations.
  • Attempting bitwise operations on floating point numbers directs the IVR to jump onto ONSYSTEMERROR.
  • Applying arithmetic operators on strings containing initial digits will have the following result.
$A = 650
$B = “200XYZ”
$C = $A + $B will result in $C having the value 850.
  • Performing arithmetic on a pure alphabetic string variable causes the value 0 to be used.
$A = 650
$B = “XYZ200”
$C = $A + $B will result in $C having the value 650.
  • Attempting to perform a division by 0 or a variable containing the value 0 throws a system error.
 Boolean Values

Booleans are used to denote the result of a logical operation. It is the logic that computers use to determine if a statement is true or false. A boolean can be either TRUE or FALSE.

A bool value can be promoted to an integral type. A bool value of TRUE is promoted to the value 1, whereas a boolean value of FALSE is promoted to the value 0.

The result of the equality, relational and logical operators is either of the boolean constants true or false.

Xtend IVR facilitates to check a boolean value in loops and conditional statements as shown below:

while True
    display $time
    sleep 250
    if $deviceId = 4 or $deviceId = 5
        break
    endif
endwhile

if false
    ........
    //This block of code will never execute
    //Can be used as an alternative for commenting code blocks
    ........
endif


Operators

Xtend IVR scripting language supports the following operators.

Assignment Operators

Assigns value to a variable.

Syntax

result = expression

Eg:
$A = 2.56
$A = $B
$A = "This is a test"
$A += 2
$A += $B
$A -= 2
$A -= $B

Arithmetic Operators

Used to perform arithmetic operations.

Syntax

result = operand1 < operator > operand2

Parameters

operand 1 : First operand to perform arithmetic operation.
operand 2 : Second operand to perform arithmetic operation.

Operands can be integer, floating point, constants, or variables. Xtend IVR supports both simple and complex arithmetic operations. Following are the arithmetic operators in Xtend IVR:

1. Addition (+)

Used to find the sum of two numbers.

Eg:
$A = $A + 2
$A = $A + $B

2. Subtraction (-)

Used to find the difference between two numbers or to indicate the negative value of a numeric expression.

Eg:
$A = $A - 2.5
$A = $A - $B

3. Multiplication (*)

Used to multiply two numbers.

Eg:
$A = $A * 2.5
$A = $A * $B

4. Division (/)

Used to divide two numbers.

Eg:
$A = $A / 2
$A = $A / $B

5. Modulus (%)

Used to find the remainder after the division operation and returns an integer result.

Eg:
$A = $A % 2
$A = $A % $B

Comparison Operators

A Comparison/Relational operator compares two operands and returns a boolean value, TRUE or FALSE.

Syntax

operand1 < operator > operand2

Operands can be integer, floating point, constants or variables. Description of the operators and their examples are listed as follows:

    Operator Description Example
    > Greater than $A > $B , 10 > $A , $A > 10
    < Less than $A < $B , 10 < $A , $A < 10
    >= Greater than or equal to $A >= $B , 10 >= $A , $A >=10
    <= Less than or equal to $A <= $B , 10 <= $A , $A <=10
    <> Not equal to $A <> $B , 10 <> $A , $A <> 10
    != Not equal to $A != $B , 10 != $A , $A != 10
    = Equal to $A = $B , 10 = $A , $A = 10
    == Equal to $A == $B , 10 == $A , $A == 10

Remarks

The comparison operator ‘=’ is also used as an assignment operator. This ambiguity is automatically resolved by the parser depending on the context of their use.

Bitwise Operators

The bitwise operators perform bitwise comparisons like bitwise-And (&), bitwise-Or ( | ) etc.

Syntax

operand1 < operator > operand2

Bitwise operators supported by Xtend IVR and their descriptions are:

    Operator Description Example
    & And $A & $B , $A & 20
    ^ Xor $A ^ $B , $A ^ 20
    | Or $A | $B , $A | 10
    >> Shift Right $A >> $B , $A >> 10
    << Shift Left $A << $B , $A << 10

Logical Operators

The Logical/boolean operators perform boolean operations like logical-And (&&), logical-Or ( ||) and logical-Not( ! ).

Syntax

expression1 < operator > expression2

Logical operators supported by Xtend IVR and their descriptions are:

    Operator | Description | Example
    &&/.and./and | Logical And | ($A < $B) .and. ($A < $C)
    ||/.or./or | Logical Or | ($A<$B) or ($A=20)
    !/.not./not | Logical Not | !(5==5)


Quick Start - Commands & Functions

Quick Start

Xtend IVR Script consists mainly of commands and functions manipulated by conditional and looping statements. This section aims at giving a rough idea about the commands, conditional statements, looping statements and functions used in the script. Arguments passed to commands and functions are of two types, mandatory and optional. Mandatory arguments are compulsory, while optional arguments need be used only when necessary. Mandatory arguments are given within <> while optional arguments are given within [] brackets.

Commands

Answer

This is the command used to pickup the incoming telephone call. Most of the time this will be one of the first command to be issued by the script. The system will attend the call after specified number of telephone rings. If not specified, the default value is taken as 1 ring.

Syntax :

Answer [No.of Rings]

Eg:

Answer 3

Beep

The beep command produces a beep sound on the auxiliary multimedia device or on the phone line if connected for a specified duration in milliseconds.

Syntax :

Beep < Frequency > < Duration >

Eg:

Beep 3000 2000

BgPlay

BgPlay command plays the specified .wav file in the background.

Syntax :

BgPlay < Wave File >

Eg:

BgPlay "welcome.wav"

BgVolume

BgVolume command adjusts the background play back volume.

Syntax :

BgVolume < Percent >

Eg:

BgVolume 300

Bp

The Bp command is used to set a break point inside the script. This command is valid only in the Developer edition and the Standard edition will simply ignore it. The Execution will pause when Bp is encountered and the user will have to use the single step option (F7) for further execution. This command is well suited for debugging purpose.

Syntax :

Bp

Break

Break command is used to terminate the currently executing loop.

Syntax :

Break

Eg:

While $Count < 10
    If $status = 1
        Break
    endif
endwhile

Clear

The Clear command immediately clears any pending PLAY, RECORD and SPEAK commands and removes any pending keys from the input queue.

Syntax :

Clear

Display

Display command prints messages in the Display area of the Main window.

Syntax :

Display < string >

Eg:

Display 300

Function

The Function command identifies the start of a user-defined function.

Syntax :

Function Function Name ( Parameters )
<statements>
Return [Expression]

or

Function Function Name
Parameters [$Parameter1][,$Parameter2]...
<statements>
Return [Expression]

Goto

Goto command causes the script to jump to the specified label. If the label is not present then the compiler will generate an error.

Syntax :

Goto <Label>

Eg:

Goto GET_PHONE
Goto ONSYSTEMERROR

Hangup

Hangup is used to terminate or hang-up an active call.

Syntax :

Hangup

Eg:

Hangup

Load

The Load command will load all variables from the given file. It is useful for loading up initial configuration values from a file.

Syntax :

Load <Filename>

Log

The Log command will log the given text into the log file maintained by Xtend IVR. A log file is maintained for each day and the filename is in the yyyymmdd format. One entry is automatically added for each device initialised and terminated. In order to enable the user to track down problems, the time of each log entry as well as the active device identifier is automatically logged along with the text. This is normally used as a logging and debugging aid.

Syntax :

Log <String>

Eg:

Log “The keys entered are” $Keys
Log $Keys

On

On command will cause a jump to the specified <label> if the given <key> has been pressed.

Syntax :

On <key> Goto <label>
Play

Play command will play back the specified wave file through the phone line. The script will not wait for the play to end. The play will happen in the background. All the wave files to be played will queue up. To force the PLAY to complete before proceeding, use the WAIT 0 command. If you have not specified the extension for the file then it will assume that the file is a .WAV file.

The sampling rate for the WAV file must be 8 KHz 16 bit mono.

Syntax :

Play <Wav File>

Eg:

Play welcome.wav
Play thanks

Record

The RECORD command is used to record incoming voice for a specific duration of time. The recorded voice is saved automatically in a file specified in the $RecordFile. When a session starts, Xtend IVR will automatically initialize this variable to a unique temporary filename. The saved file will be in WAV format.

Syntax :

Record <Seconds>

Eg:

Record 5
Wait 0
Record $RecordTime
Wait 0

Run

Run command will execute the specified external program. This command is used to connect Xtend IVR with your program. For transferring data between the called program and Xtend IVR, Xtend IVR uses a common shared file. The shared file is available in the Xtend IVR system variable $varfile.

Normally RUN command is called along with an external program and $varfile as the command line argument for that program. $Varfile is a temporary file shared by both Xtend IVR and called program, which contains the snapshot of the Xtend IVR variables at the time RUN command is interpreted. The called program should manipulate the file for accessing the Xtend IVR variables. Run command will wait until the called program is terminated.

Syntax :

Run <Exe File> <Arguments>

Eg:

Run "myprogram.exe" $varfile
RUN "updatedatabase.exe" $varfile
RUN "reg_user" $varfile

RunTimeout

RunTimeout command sets the timeout value for the RUN command. If the RUN command takes more time than specified by RUNTIMEOUT then it will automatically kill the execution of RUN command and jumps to ONRUNTIMEOUT label. If RunTimeout command is not specified, then the timeout is infinite.

Syntax :

RunTimeout <Seconds>

Eg:

RunTimeout 10
RUN "myexe.exe" $varfile

Save

The Save command will save all variables to the given file.

Syntax :

Save <Filename>

Sleep

The Sleep command suspends the execution of the current script for a specified time interval.

Syntax :

Sleep < Duration >

Eg:

Sleep 5000

Speak

Speak is the command used to speak out a text using the TTS (Text To Speech) engine. We can select the installed TTS using the Xtend IVR Configuration utility. Similar to PLAY command, SPEAK command also executes in the background.

Syntax :

Speak <String>

Eg:

Speak “Thank you”
Speak $Text

Timeout

The Timeout will set the maximum time allotted for the incoming call. If the call takes more than the allotted time then the Xtend IVR engine will hangup the line and jumps to the system label OnTimeout.

If Timeout command is not specified, then the timeout is infinite. Calling HANGUP will clear any previously set timeouts. To enable timeout for every script session, set Timeout in between ANSWER and HANGUP command.

Syntax :

Timeout <Seconds>

Eg:

WAIT_FOR_CALL:
while $Ring < 3
.......
endwhile
answer
TIMEOUT 10
.......
ONTIMEOUT:
HANGUP
goto WAIT_FOR_CALL

VoiceLog

The VoiceLog command will load all variables from the given file.

Syntax :

VoiceLog <FileName>

Eg:

VoiceLog "Sample.wav"

Volume

Volume command will adjust the playback volume of the specified .wav file in software. The default Volume is 100.

Syntax :

Volume <Percent>

Eg:

Volume 300

Wait

The Wait command will wait for the queued play or speak command to end and then wait for a specified number of milliseconds.

Syntax :

Wait <Milliseconds>

Eg:

WAIT 500

Conditional and Looping Statements

Xtend IVR script supports only one conditional statement that is “IF”.

Syntax :

IF <condition>
<statements>
ENDIF
or
IF <condition 1>
<statements>
ELSEIF <condition 2>
<statements>
ENDIF
or
IF <condition>
<statements>
ELSE
<statements>
ENDIF

The first IF statement will check the <condition> condition and if true, will execute the commands inside the <statements> block. The second IF statement will check the <condition> condition and if it’s true, it will execute the first block of statements. If the expression is false, it will execute the second block of statements. You can also use ELIF or ELSE IF.

Eg:

IF $Ring < 2
$A = $A + 2
ELSE
$A = $A - 2
ENDIF

IF $Ring < $Num
$A = $A + 2
$B = $B / 10
ENDIF

IF <condition> THEN GOTO

This IF statement will check the <condition> and if it’s true, it will jump to the specified <label>.

Eg:

IF $Ring < 2 THEN GOTO START_LOOP

Looping Statements

Xtend IVR script supports WHILE statement.

Syntax :

While <condition>
<statements>
endwhile

The ‘WHILE’ command will check the <condition> and if true, will execute the commands inside the <statements> block until the condition becomes false. But you can always break from the loop by giving a BREAK command.

Eg:

WHILE $Ring < 2
$A += 1
ENDWHILE

WHILE $Ring < $Num
$A += 1
if $A>5
break
endif
ENDWHILE

Functions

ActiveCalls()

The activeCalls() function obtains the number of calls active in the dialed line.

Syntax :

ActiveCalls ( <dli> )

Eg:

$calls = ActiveCalls("3011001")

ActivePorts()

The activePorts() function obtains the number of ports being monitored by the Xtend IVR.

Syntax :

ActivePorts ()

Eg:

$ports = ActivePorts()

Alltrim()

Alltrim removes leading and trailing white spaces from a string.

Syntax :

alltrim (<String>)

Eg:

$name =“ram”
alltrim($name)

Alltrim removes white spaces from both sides of the contained in the variable $name.

Ascii()

An ascii() function returns the ASCII code.

Syntax :

ascii ( <Character>)

AtomicAdd()

AtomicAdd() function increments the value of a variable in a particular device.

Syntax :

AtomicAdd( <deviceId>, <$variable>, <value> )

Eg:

AtomicSet(1, "$Count", 10)
AtomicAdd(1, "$Count", 5)

$Count now contains 15.

AtomicGet()

AtomicGet() function gains access to the variables across devices.

Syntax :

AtomicGet( <deviceId>, <$variable> )

Eg:

AtomicGet(1, "$Count")

AtomicSet()

AtomicSet() function sets the value of a variable in a particular device.

Syntax :

AtomicSet( <deviceId>, <$variable>, <value> )

Eg:

AtomicSet(1, "$Count", 5)

The value of $count will now be set to 5.

BlindTransfer()

BlindTransfer() function blindly transfers the call to the particular extension phone.

Syntax :

BlindTransfer( <extensionNumber> )

Eg:

$status = BlindTransfer("24")

$status now contains TRUE.

Calls()

Calls() function obtains the number of calls handled by the current port.

Syntax :

Calls( <deviceId> )

Eg:

$num = Calls(1)

Chr()

Chr () function will return the character, if its ASCII code is given.

Syntax :

chr ( < Number > )

Eg:

$a = 65
$b = chr($a)

$b now contains “A”.

Compare()

A compare() function compares two string parameters and returns 0 if both the strings are equal; 1 if first string is longer than the second string and –1 if first string is smaller than the second string.

Syntax :

Compare (< String1 > , < String2 >)

Eg:

$a = “ABCD”
$b = compare($a,“ABCD”)

$b now contains 0.

Concat()

A concat() function is used to concatenate or append two or more strings.

Syntax :

concat(<String1>,<String2>,……..,<String n>)

Eg:

$a = “ABCD”
$b = concat ($a, “EFGH”, “XYZ”)

$b now contains “ABCDEFGHXYZ”.

DeleteFile()

DeleteFile() function deletes the specified file.

Syntax :

DeleteFile ( < Filename > )

Eg:

DeleteFile("abc.txt")

DeviceSpecific()

DeviceSpecific() executes a function unique to a specific driver.

Syntax :

DeviceSpecific ( < functionName >[, parameters ] )

Escape()

Escape() function converts the binary characters in the string to its percentage(%) hexa form.

Syntax :

Escape ( <string> )

Eg:

$Var = "Thank You.wav"
$file = Escape($Var)

$file now contains "Thank%20You.wav".

Find()

Find() function finds a character or substring inside a larger string.

Syntax :

Find ( "Master string","Sub string" )

Eg:

$Var = "Ivr Solutions"
Find($Var,"Sol")

Function will return 4.

Format()

Format() function writes formatted data to a string according to the format specification types.

Syntax :

$Str = Format (fcString [ ,Arguments ].. )

Eg:

$Var = Format("Cost = %6d %s", 450, "Rs")

GetCallProgress()

GetCallProgress() function obtains the current status of a Dial() or Transfer() operation.

Syntax :

GetCallProgress ( <string> )

Eg:

$status = dial("123456789")
while true
$status = GetCallProgress()
...
endwhile

$status now contains "CONNECTED".

GetInfo()

GetInfo() function retrieves information from the driver DLL.

Syntax :

GetInfo ( <attribute> )

Eg:

$attribute = "CLI"
$id = GetInfo($attribute)

GetMessage()

GetMessage() function fetches a string from the message queue of the specified device.

Syntax :

GetMessage ( <deviceId> )

Eg:

$Msg = GetMessage(10)

GetStartTime()

GetStartTime() function generates the starting date and time of the IVR.

Syntax :

GetStartTime ()

Eg:

$time = GetStartTime()

GetTime()

GetTime() function fetches the local date and time.

Syntax :

GetTime ()

Eg:

$time = GetTime()

Index()

Index() function returns zero based index of a substring or a character inside a larger string. Index function has the same Syntax : as that of Find() function.

Syntax :

$Var = Index("Master string","Sub string")

Input()

Input() function will accept a maximum of <max digits> numbers entered on the dial-pad by the user and will wait for a duration of [wait in seconds] seconds for any further inputs or until the [enter key] is pressed and will store it into the Variable specified by $Variable. Everything from [wait in seconds] onwards is optional.

Syntax :

input (<Max Digits>=2, [Wait in Seconds] , [Enter Key] , [Esc Key])

IsVariable()

IsVariable() function searches for the given variable anywhere inside the script and returns true if it exists, otherwise returns false.

Syntax :

IsVariable ($Variable)

Len()

Len() function will return the length of the string <string> given.

Syntax :

Len (< String >)

Eg:

$a = “ABCD”
$b = len($a)

$b now contains 4.

$a = 365
$b = len($a)

$b now contains 3.

LoadFile()

LoadFile() function loads the specified number of lines of text from the file to a variable.

Syntax :

LoadFile (< filename >, < $variable > , < No:of Lines >)

Eg:

LoadFile("abc.txt", "$Variable", 10)

Loads first 10 lines of text from the file "abc.txt" to the variable "$Variable".

Lock()

Lock() function permits one and only one script to execute inside a block of statements.

Syntax :

Lock ( < LockName >)

Eg:

Lock("db_Insertion")
....
....
Unlock()

Lower()

Lower() function will return a copy of the <string> specified string converted to lowercase.

Syntax :

Lower (< String >)

Eg:

$a = “ABCD”
$b = lower($a)

$b now contains “abcd”.

Ltrim()

Ltrim() function will return a copy of the <string> given string after removing all the leading spaces.

Syntax :

Ltrim ( < String > )

Eg:

$a = “ABCD”
$b = ltrim($a)

$b now contains “ABCD”.

Mid()

Mid() extracts a substring of length [len] characters from the string <string>, starting from the position given in the <start index> (zero-based). The function returns a copy of the extracted substring.

Syntax :

mid (< String > , < Start Index > , [ len ])

Eg:

$a = “ABCD”
$b = mid($a,1,2)

$b now contains “BC”.

PlayTimeLeft()

PlayTimeLeft() function returns the pending play back time in milliseconds.

Syntax :

PlayTimeLeft ( )

Eg:

$b = PlayTimeLeft()

PutMessage()

PutMessage() function places a string into the message queue of the specified device.

Syntax :

PutMessage (< deviceId > , < String >)

Eg:

PutMessage(1,"Hello World")

RecordTimeLeft()

RecordTimeLeft() function returns the remaining time for recording.

Syntax :

RecordTimeLeft ()

Eg:

$b = RecordTimeLeft()

ReverseFind()

ReverseFind() function finds a character or substring inside a larger string starting from the end.

Syntax :

ReverseFind ( < Master string >, < Sub string > )

Rindex()

Rindex() function returns the zero-based index of a substring or a character inside a larger string starting from the end. Rindex() has the same syntax as that of ReverseFind() function.

Syntax :

Rindex ( < Master string >, < Sub string >)

Rtrim()

Rtrim() function will return a copy of the <string> after removing all trailing white spaces.

Syntax :

Rtrim(<String>)

Eg:

$a = “ABCD ”
$b = rtrim($a)

$b now contains “ABCD”.

SaveFile()

SaveFile() function replaces the content from the variable with that of the file by the specified number of lines.

Syntax :

SaveFile (<Filename > , < $Variable > , < No:of Lines >)

Seconds()

Seconds() function gives the time elapsed in seconds after the process has started. This function tells the number of seconds the process has used up.

Syntax :

seconds()

SetInfo()

SetInfo() function sets the attribute of the driver.

Syntax :

SetInfo (< Attribute >, < Value >)

Eg:

SetInfo("DIALCLI","9846036247")

In a dial-out, the driver sets the caller-ID and displays it at the receiving end as "9846036247".

SetInfo("AllowIncoming",false)

The setting will disable / reject the incoming calls on the channel.

SoftDisconnect()

SoftDisconnect() function destroys a softInterconnect with a specified device.

Syntax :

SoftDisconnect ( < DeviceId > )

Eg:

SoftInterConnect(1)
....
....
SoftDisconnect(1)

SoftInterconnect()

SoftInterConnect() function interconnects the current device and the specified device.

Syntax :

SoftInterConnect( < DeviceId > )

Eg:

SoftInterConnect(1)
....
....
SoftDisconnect(1)

SoftListen()

SoftListen() function listens to a particular channel.

Syntax :

SoftListen ( < DeviceId >, < Type > )

Eg:

SoftListen(1,0)
....
....
SoftUnListen(1)

SoftStream()

SoftStream() function streams the Incoming, Outgoing or both audio of the current device to the incoming audio of the specified device.

Syntax :

SoftStream ( < DeviceId >, < Type > )

Eg:

SoftStream(1,0)
....
....
SoftUnstream(1)

SoftUnlisten()

SoftUnlisten() function unlistens from the specified device.

Syntax :

SoftUnlisten ( < deviceId > )

Eg:

SoftListen(1,0)
....
....
SoftUnListen(1)

SoftUnstream()

SoftUnstream() function releases SoftStream() to the specified device.

Syntax :

SoftUnstream ( < deviceId > )>

Eg:

SoftStream(1,0)
....
....
SoftUnstream(1)

srAcceptWords()

srAcceptWords() function defines the grammar for the subsequent Input() operation.

Syntax :

srAcceptWords ( < word 1>, <word 2>, ..., <word N> )

Eg:

srAcceptWords("zero", "one", "two", "three", "four", "five")

srAudio()

srAudio() function specifies when the audio play back has to be stopped.

Syntax :

srAudio ( < type > )

srConfidence()

srConfidence() function determines the level of recognition for the words/grammar defined.

Syntax :

srConfidence ()

srGrammar()

srGrammar() function loads grammar for speech recognition in the script.

Syntax :

srGrammar ( < actualXmlText > )

Eg:

srGrammar("<P>Words</P>")

This loads the grammar provided in the string.

srKeepGrammar()

srKeepGrammar() function sets the grammar for the subsequent Input() operation in the script.

Syntax :

srKeepGrammar (< boolean > )

Eg:

srKeepGrammar(true)

Substr()

Extracts a substring from a larger string and has syntax same as that of mid() functon.

Syntax :

Substr ( < String > , < Start Index > , [ Len ] )

TotalCalls()

TotalCalls() function obtains the total number of calls handled by the IVR so far.

Syntax :

TotalCalls ( )

Eg:

$total = TotalCalls()

Transfer()

Transfer() function transfers the call to an extension phone.

Syntax :

Transfer ( < Extension number >, < Timeout > )

Eg:

$status = Transfer("30",20)

$status now contains “CONNECTED”.

Upper()

Upper() function will return a copy of the <string> converted to uppercase.

Syntax :

Upper ( < String >)

UnEscape()

UnEscape() function reverses the Escape() process.

Syntax :

UnEscape ( < string > )

Eg:

$a = "Thank%20You.wav"
$str = UnEscape($a)

$str now contains “Thank You.wav”.

UnLock()

UnLock() function releases the last Lock() operation.

Syntax :

UnLock ( )

Eg:

Lock("db_Insertion")
....
....
Unlock()

See Also

Commands

Functions


Conditional Statements

If <condition>

<statements>

EndIf

IF statement will check the <condition> and if it’s true will execute the commands inside the <statements> block.

Parameters

    <condition> Numeric or string expression.
    <statements> One or more statements.
Remarks

  • Use an If......Else block to define several blocks of statements, one of which will execute.
    If <condition>

    <statements>

    Else

    <statements>

    EndIf
    • When the If statement evaluates to TRUE, the statement, or block of statements, following the If statement, is executed. Then control jumps to the point after the statement, or block of statements, following the Else statement. When the If statement evaluates to FALSE, the statement, or block of statements, following the If statement is skipped and the statement, or block of statements, following the optional Else statement is executed.
    If <condition1>

    <statements>

    ElseIf <condition2>

    <statements>

    ElseIf <condition3>

    <statements>

    Else

    <statements>

    EndIf
    • If...ElseIf is really just a special case of If....Else. Notice that you can have any number of ElseIf clauses, or none at all. You can include an Else clause regardless of whether you have ElseIf clauses.
    If <condition> [Then] GoTo <label>
    • On true will jump to the label specified by <label>
  • ElseIf can also be written as "Else If" or "Elif"
 Example

1. IF....THEN:

$choice = accept("voicemenu.wav",1)
if $choice = 0 then goto TERMINATE

2. IF...ELSE...ENDIF:

if $Balance < $MinBalance
   ; Insufficient Balance in account
   play "nobalance.wav"
else
   ; Your request will be processed within 1 hour
   play "requestok.wav"
endif

3. IF...ELSE...ENDIF:

if $Balance < $MinBalance OR ( $AccountType = "CA" AND date.cmp($DueDate,$date) > 0 )
   ; Your request has been blocked, please contact the administrative department
   play "blocked.wav"
else
   ; Your request will be processed within 1 hour
   play "requestok.wav"
endif

4. IF...ELSEIF...ENDIF:

if $account_type = "SA"
   ; Not applicable for savings account
   play "notapplicable_SA.wav"
else if $account_type = "CA"
   ; You must have a minimum balance of 100000 in your account
   play "minbal.wav"
elif $account_type = "NRI"
   $sql = format("SELECT * from MASTER where ACCTYPE = 'NRI' AND ACCNO = '%s'",$AccNo)
   $alias = db.RunSQL($db,$sql)
   if $alias.eof
      ; Your account details are not found
      play "invalid.wav"
   endif
endif


While

Loops

While <condition> <statements> EndWhile

    While loop will check the <condition> and if it’s true will execute the commands inside the <statements> block.
Parameters

    <condition> Numeric or string expression.
    <statements> A block of statements that are executed when the condition is True.
 Remarks

  • You can always break from the loop by giving a Break command.
  • Inside the loop, Loop or Continue may be used to bye-pass the remaining statements and move to the next condition in the While loop.
  • The loop is repeated until the condition becomes false. One can have nested While loops also.
Example

1. Simple loop:

:DBUPDATE
    // Oracle OLEDB Connection
    $db = "Provider=MSDAORA.1;User ID=scott;Password=tiger;Data Source=xtendora;Persist Security Info=False"

    // open table EMP (default table in ORACLE)
    $empinfo = db.Open($db,"SELECT * FROM EMP")
    if $empinfo != 1 then goto DBERROR

    // read records one by one using db.Skip
    while not $empinfo.eof
        display $empinfo.ENAME  " " $empinfo.JOB  "  " $empinfo.SAL
        $empinfo = db.Skip()
    endwhile

    // Close Table
    $empinfo = db.Close()
    goto MAIN

:DBERROR
    ;............
    ;............

2. Loop with Break/Exit and Loop/Continue:

:DBUPDATE
    // Oracle OLEDB Connection
    $db = "Provider=MSDAORA.1;User ID=scott;Password=tiger;Data Source=xtendora;Persist Security Info=False"

    // Run query on table EMP (default table in ORACLE)
    $empinfo = db.Open($db,"SELECT * FROM EMP ORDER BY SAL ASC")
    if $empinfo != 1 then goto DBERROR

    // read records one by one using db.Skip
    while not $empinfo.eof
        if compare($empinfo.ENAME,"KING") != 0
            $empinfo = db.Skip()
            continue
        endif
        display $empinfo.ENAME  " " $empinfo.JOB  "  " $empinfo.SAL
        // C,C++ programmers like to use BREAK instead of EXIT
        exit
    endwhile

    // Close Table
    $empinfo = db.Close()

:DBERROR
    ;............
    ;............


Answer

Answer [NoofRings]

    Answers the call after specified number of rings.
Parameters
    <NoofRings> Number of rings after which the call is picked up. If not specified, it defaults to 2 rings.
Remarks
  • Answer 0 will pick up the call immediately without waiting for a ring.
  • To perform processing while waiting for a call, check for $Ring greater than 0 before Answer.
  • Some voice hardwares will not give accurate number of rings. So the parameter NoofRings will not be accurate in all cases. In analog lines, the caller ID is transmitted before the first ring or before the second ring. So it is always better to pickup the call after the third ring in analog environment.
Example

MAIN:
   Answer 3

   Play "Welcome.wav"
   $num = Input(5)

   Play "YouEntered.wav"
   Play Num2Wav($num)

   Hangup
   goto MAIN


BlindTransfer()

 $bool = BlindTransfer ("<ExtensionNum>")
    Blindly transfers the call to the particular extension phone.
Parameters
    <ExtensionNum> The EPABX extension number.
Return Value
    Returns 1 if successfully transferred, else returns 0.
Remarks
  • None.
Example
    $status = BlindTransfer("24")
  • $status will contain 1, if the call is successfully transferred.


Dial()

 $bool = Dial ("<PhoneNumber>")
    Dials the phone number of the user to make an outgoing call.
Parameters
    <PhoneNumber> Specify the phone number of the user to be called.
Return Value
  • If successful returns TRUE, else returns FALSE.
Remarks
  • An outgoing call is made to the phone number given.
  • For IP drivers like Opal H323, Skype etc., IP number is specified instead of destination phone number.
  • Asynchronous dial() only initiates the function before it falls through. To know the status of the dial out function, use GetCallProgress().
Example
(1)

$Status = Dial("1234567890")

while true
    $Status = GetCallProgress()

    if $Status == "CONNECTED"
        Play "Welcome.wav"
        wait 0

        break
    endif

    sleep 250
endwhile
The function dials the number "1234567890". Meanwhile, the call progress is monitored. If $Status shows "CONNECTED" the system welcomes the user and breaks out of the loop.
(2)

     $Status = Dial("196.167.11.1")
IP number is specified in place of phone number for IP drivers.


 Hangup
    Hangs up the call.
Parameters
    None
Remarks
  • If the user hangs up the call, then the script automatically jumps to the ONHANGUP label where Hangup command is called.
Example

MAIN:
   Answer

   Play "Welcome.wav"
   $num = Input(5)

   Play "YouEntered.wav"
   Play Num2Wav($num)
   Hangup
   goto MAIN

ONHANGUP:
   Clear
   Hangup
   goto MAIN


Timeout

 Timeout <NoofSeconds>
    Jumps to ONTIMEOUT label after specified number of seconds.
Parameters
    <NoofSeconds> Number of seconds after which the jump to ONTIMEOUT takes place. If not specified, it defaults to -1 (Do not timeout at all).
Remarks
  • Each time, the Timeout is encountered in the script, the timeout value is reset from that point on.
  • The command is useful when we are doing any lengthy operations in the script where we want to stop it if it exceeds the time limit.
  • Timeout is active only during a call. The last timeout value encountered by the script is used when a call becomes active.
  • If Timeout is not specified in the script, the script does not timeout at all.
Example

:MAIN
    // cancel any previous timeout settings
    timeout

    // waiting for call
    answer 1
    ;.........
    ;.........
    ;.........
    ;Please wait while we connect your call to United States
    play "connect.wav"
    ;.....
    ;.....
    $TalkTime = GetTalkTime()
    ; Your call has been connected to United States
    ; You have a talk time of (n) seconds

    timeout $TalkTime
    SoftInterconnect($sipchannel)

    ; Wait in an idle loop.
    while true
        sleepevent
    endwhile

:ONTIMEOUT
    log "Your talk time has been expired."
    play "expired.wav"
    play "goodbye.wav"
    hangup
    goto MAIN

function GetTalkTime()
    ;......
    ;......
    $talk = $end - $start
    return $talk


Transfer()

 $Status = Transfer ("<ExtensionNum>", <Timeout>)
    Transfers the call to an extension phone.
Parameters
    <ExtensionNum> The EPABX extension number.
    <Timeout> Time in milliseconds waiting for the call to be picked up.
Return Value
    Returns the status of the call transfer.
Remarks
  • On voice cards/drivers where no internal implementation of transfer() is supported, the function will emulate a blindtransfer() instead.
Example

:MAIN
    answer

    $status = Transfer("30",20)

    if $status == "CONNECTED"
        Hangup
    Endif

    Hangup
    goto MAIN

:ONHANGUP
    Hangup
    goto MAIN

:ONTIMEOUT
    Clear
    Play "TimeLimitExpired.wav"
    Hangup
    goto MAIN

Possible values for $Status are:

  • DIALTONE = Line is alive for number dialing in order to make a call.
  • RINGBACK = The telephone corresponding to the dialed number has been found and it is ringing at the receiver's end.
  • CONNECTED = Connection is established. Receiver attended the call.
  • DISCONNECTED = The application initiated the disconnect of the call.
  • DISCONNECTED-BUSY = The remote end is busy and could not take the call. This disconnect reason is only signaled for outgoing calls.
  • DISCONNECTED-REJECT = The call was rejected by the remote peer.
  • DISCONNECTED-NOANSWER = The remote end did not answer the call and the call timed out. This disconnect reason is only signaled for outgoing calls.
  • DISCONNECTED-ALERT_NOANSWER = The remote end did not answer the call even though it sent an alert to keep the call ringing. This disconnect reason is only signaled for outgoing calls.
  • DISCONNECTED-NUMUNKNOWN = The switch responds that the dialed number is not known.
  • DISCONNECTED-NUMINVALID = The switch responds that the dialed number is not in a valid format or not complete.
  • DISCONNECTED-NUMCHANGED = The switch responds that the dialed number is not known because it has changed.
  • DISCONNECTED-NOCHANNEL = All channels on the line device are already in use.
  • DISCONNECTED-CABLEERR = There is no layer 1 connection between the line device and the switch. This is typically a cable error or an un-plugged line device.
  • DISCONNECTED-NETWORKERR = A general network error occurred during call establishment.
  • DISCONNECTED-NUMNOTALLOC = The dialed number is no longer available.
  • UNKNOWN = There is no specific information why the call failed.

    • * The above information is subject to change.


ActiveCalls()

 $num = ActiveCalls ("<dli>")
    Obtains the number of calls active in the device line.
Parameters
    <dli> Device line ID.
Return Value
    Returns the number of active calls.
Example
    $calls = ActiveCalls("3011001")


ActivePorts()

 $num = ActivePorts ()
    Obtains the number of ports being monitored by the IVR.
Parameters
    None.
Return Value
    Returns the total number of ports.
Example
    $ports = ActivePorts()


Calls()

 $num = Calls (<dli>)
    Obtains the number of calls handled by the current port.
Parameters
    <dli> Device line ID.
Return Value
    Returns the total number of calls.
Example
    $num = Calls(2)
  • $num will contain the total number of calls handled by the second device line.


GetCallProgress()

 $Status = GetCallProgress ()
    Obtains the current status of a Dial() or Transfer() operation.
Return Value
    Returns the status of the line.
Remarks
  • None.
Example

$phoneno = "1234567890"

MAIN:

    display $deviceid " Dialing " $phoneno
    $stat = dial($phoneno)

    while true
        $stat = GetCallProgress()
        if $stat <> ""
            display $stat
    endif

        if $stat == "CONNECTED"
            display $deviceid "Call connected.."
            Play "welcome.wav"
            break
        else if find($stat,"DISCONNECTED") >= 0)
            break
        endif

        sleep 250
    endwhile

    hangup
    goto MAIN

* User has hung up
ONHANGUP:
    hangup
    goto MAIN

* An error has occurred
ONSYSTEMERROR:
    log $error
    display $error
    if $debug
        msgbox $error
    endif
    hangup
    goto MAIN

Possible values for $Status are :

  • DIALTONE = Line is alive for number dialing in order to make a call.
  • RINGBACK = The telephone corresponding to the dialed number has been found and it is ringing at the receiver's end.
  • CONNECTED = Connection is established. Receiver attended the call.
  • DISCONNECTED = The application initiated the disconnect of the call.
  • DISCONNECTED-BUSY = The remote end is busy and could not take the call. This disconnect reason is only signaled for outgoing calls.
  • DISCONNECTED-REJECT = The call was rejected by the remote peer.
  • DISCONNECTED-NOANSWER = The remote end did not answer the call and the call timed out. This disconnect reason is only signaled for outgoing calls.
  • DISCONNECTED-ALERT_NOANSWER = The remote end did not answer the call even though it sent an alert to keep the call ringing. This disconnect reason is only signaled for outgoing calls.
  • DISCONNECTED-NUMUNKNOWN = The switch responds that the dialed number is not known.
  • DISCONNECTED-NUMINVALID = The switch responds that the dialed number is not in a valid format or not complete.
  • DISCONNECTED-NUMCHANGED = The switch responds that the dialed number is not known because it has changed.
  • DISCONNECTED-NOCHANNEL = All channels on the line device are already in use.
  • DISCONNECTED-CABLEERR = There is no layer 1 connection between the line device and the switch. This is typically a cable error or an un-plugged line device.
  • DISCONNECTED-NETWORKERR = A general network error occurred during call establishment.
  • DISCONNECTED-NUMNOTALLOC = The dialed number is no longer available.
  • UNKNOWN = There is no specific information why the call failed.

    • * The above information is subject to change.


PlayTimeLeft

 $time = PlayTimeLeft ()
    Returns the pending play back time.
Return Value
    The remaining play back time in milliseconds.
Example

answer 1
Play "Music.wav"

while true
    $pending = PlayTimeLeft()
    display int($pending/1000) " seconds more.."
    if $pending <= 0
        break
    Endif
    sleep 100
EndWhile


RecordTimeLeft()

 $time = RecordTimeLeft ()
    Returns the remaining time for recording.
Return Value
    Returns the remaining time in milliseconds.
Example

$RecordFile = "c:\xivr\Samples\Sample.wav"
....
record 5
....
while RecordTimeLeft() > 0
    ....
    ***Database operations***
    ....
EndWhile
....
....


TotalCalls()

 $num = TotalCalls ()
    Obtains the total number of calls handled by all the ports of IVR so far.
Parameters
    None.
Return Value
    Returns the number of calls.
Example
    $total = TotalCalls()


ComOpen()

 ComOpen ("<CommunicationPort>" , "<BaudRate> <Parity, DataBits, StopBits> <FlowControl>")
    Function establishes a connection with the serial port.
Parameters
    <CommunicationPort> COM port to which the device is connected for communication.
    <BaudRate> Number of bits passed per second.
    <Parity, DataBits, StopBits> Parity describes the type of parity used to check the datastream passed. The values can be 'N' for none, 'E' for even or 'O' for odd Parity check. DataBits value describes the number of bits used to form a byte. It can be 7, 8 or 9. StopBits value explains the value used to terminate the datastream. Either 1 or 2 is used as stop bits. All the three values are concatenated into a single string and the appended string is passed as an argument.
    <FlowControl> Values the variable can take are:
    • 'hardware' or 'hard'
    • 'software' or 'soft'
    • 'none'
      •
Return Value
    Returns a boolean value saying TRUE or FALSE.
Remarks
  • Xtend IVR supports only one COM port per thread/channel. To support more COM port operations, use Service Threads.
See for Example


ComClose()

 ComClose( )
    Closes the serial port communication connection.
See for Example


ComRead()

 $buffer = ComRead( <Size> , <Timeout> )
    Reads data from the serial port.
Parameters
    <Size> Number of bytes to read.
    <TimeOut> Milliseconds to wait for specified number of bytes to become available.
Return Value
    Returns actual bytes read from the port and is stored in $buffer.
Remarks
  • The function will either read the specified size of data from the port or wait to read the data till the system times out.
Example

    ; Query modem parameter using the AT commands
:MAIN
   answer

   ; Opens COM1 where the voice modem is expected
   ; Baud rate is set as 9600
   ; N81 - No Parity, 8 data bits, 1 Stop bit
   if ComOpen("COM1", "9600 N81 none")

     ; Issue the AT&V command to modem
     ComWriteLine("at&v")

     ; Get the size of data returned by modem
     $size = ComReadSize()

     ; Read the data streamed by the modem
     while $size > 0
         ; Modem is a slow device.
         ; So wait for 2000 seconds for the data to arrive in the port
         $buffer = ComRead($size,2000)

         display $buffer
         log $buffer

         Sleep 1000
         ; See for pending data size to be read
         $size = ComReadSize()
     endwhile

     ; Done. Close the port and quit
     ComClose()
   endif

   hangup

   goto MAIN

:ONSYSTEMERROR
   log $error
   hangup
   goto MAIN
  • Given above is a script for querying the modem parameters by issuing at&v command through the serial port. After connecting the voice modem, AT command is given to get the modem parameters. Before reading the data, the size of the data stream is determined using the ComReadSize(). If $size is not empty, then the specified size of data is read from the serial port, setting system timeout to 2 seconds. Then the content is displayed and we log the buffer. This process iterates, until the size of the data to be read falls to zero. Then we disconnect the connection. On occurrence of a system error, the system will jump on to ONSYSTEMERROR label. The system will note down the error in the log file.


ComReadLine()

 $buffer = ComReadLine( <Timeout> )
    Reads a line of data from the serial port. The system will read data until it encounters a carriage return or a newline character.
Parameters
    <TimeOut> Milliseconds to wait for a complete line of data to become available.
Return Value
    Returns a complete line of data from the port. CR or LF will not be included.
See for Example


ComReadSize()

 $size = ComReadSize ( )
    Ready to read size of the data is found out.
Return Value
    Returns the number of bytes that are ready to be read from the port.
See for Example


ComWrite()

 ComWrite ( <buffer> )
    Writes data to the serial port.
Parameters
    <buffer> Data to be written
See for Example


ComWriteLine()

 ComWriteLine ( <buffer> )
    Writes a line of data to the serial port.
Parameters
    <buffer> Data to be written.
See for Example


Sample -COM Port Communication

*------------------------------------------------------------
* Script : Sample-Serial Port Communication
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*------------------------------------------------------------
; Query modem parameter using the AT commands
:MAIN
    answer

    ; each AT command is terminated by <CRLF><LINE FEED>
    $CR = chr(13)
    $NL = chr(10)

    ; Opens COM1 where the voice modem is expected
    ; Baud rate is set as 9600
    ; N81 - No Parity, 8 data bits, 1 Stop bit
    if ComOpen("COM1", "9600 N81 none")

    ; Issue the AT&V command to modem
    ComWrite("at&v")
    ComWrite($CR)
    ComWrite($NL)

    ; Get the size of data returned by modem
     $size = ComReadSize()

    ; Read the data streamed by the modem
    while $size > 0
        ; Modem is a slow device.
        ; So wait for 2000 milliseconds for the data to arrive in the port
        $buffer = ComReadLine(2000)

        display $buffer
        log $buffer

        Sleep 1000
        ;See for pending data size to be read
        $size = ComReadSize()
    endwhile

    ; Done. Close the port and quit
    ComClose()
  endif

  hangup
  goto MAIN

:ONSYSTEMERROR
  log $error
  hangup
  goto MAIN
  • A connection is established with the serial port, COM1, where the voice modem (here) is connected. Port settings include a baudrate of 9600 bits per second having 'N' (ie., no) parity check, 8 bits constituting a byte, 1 set as the stop bit with no flow control. If the voice modem (here) is connected, then write the AT command to get the modem parameters. The size of the data to be read is found out. If the variable $size is not empty, then read each line of the data with a timeout of 2 seconds. The read data is then displayed. Then we log the read data. The serial port is checked for remaining data. If any, they are read. Then connection with the serial port is closed and control will return to the MAIN function.

    • See also ComOpen(),
  ComReadSize()
  ComReadLine(),
  ComWrite(),
  ComClose().


srAcceptWords()

 srAcceptWords ( " <Word 1>" , "<Word 2>" , ... "<Word N>" )
    Defines the grammar for the subsequent Input() operation.
Parameters
    <Word 1>,<Word 2>,...<Word N> Expected words in the grammar defined as an array.
Return Value
    None.
See for Example


srAudio()

 srAudio ( <type> )
    Specifies when the audio play back has to be stopped.
Parameters
    <type> Input value to end the audio play.
Return Value
    None.
Remarks
  • Function ends the play back when any sound is heard(type=0); audio play back ceases when the initial phrase is recognized(type=1); discontinue playing back when recognition is complete(type=2).
  • Default value is 2, i.e., when recognition is complete.
 Example
    srAudio(0)
  • Stops the audio play back when any sound is heard.


srConfidence()

 $intLevel = srConfidence ()
    Determines the level of recognition for the words/grammar defined.
Parameters
    None.
 Return Value
    Returns an integer value between 1 and 100 which is the percentage of accuracy of the recognized word.
Remarks
  • For return value 100, the speech recognition engine is 100% sure about the recognized word.

    The level of accuracy completely depends upon the Microsoft Speech Recognition engine. The XML grammar you provide can also improve the output. See SAPI documentation for more details.

See for Example


srGrammar()

 srGrammar ( "<FileName>" )
or
srGrammar ( "<ActualXmlText>" )
    Loads grammar for speech recognition in the script.
Parameters
    <FileName> The file containing the grammar.
    <ActualXmlText> Raw XML grammar defined.
Return Value
    None.
Remarks
  • This requires SAPI 5.0 SDK to function properly.
  • Speech recognition engine is automatically initialized when srGrammar() is called for the first time. The maiden initialization is always slow. To get around this, it is better to call srGrammar("") at the beginning of the script so that the engine will be initialized even before the first call is picked up.
Example
    srGrammar("abc.xml")
  • This loads the grammar from the file "abc.xml".
    srGrammar("<P>Words</P>")
  • This loads the grammar provided in the string.
    srGrammar("")
  • This unloads any existing grammar.
    srGrammar("<GRAMMAR LANGID="409"> <DEFINE> <ID NAME="RID_Language" VAL="409"/> </DEFINE>
  <RULE ID="RID_Language" TOPLEVEL="ACTIVE"> <LIST PROPID="RID_Language"> <P>zero</P>
  <P>one</P>  <P>two</P>  <P>three</P>  <P>four</P>  <P>five</P>  <P>six</P>
  <P>seven</P>  <P>eight</P>  <P>nine</P>  </LIST> </RULE> </GRAMMAR>")
  • This loads the grammar for recognizing digits.


srKeepGrammar()

 srKeepGrammar ( <Boolean> )
    Sets the grammar for the subsequent Input() operation in the script.
Parameters
    <Boolean> If true, the rest of the inputs in the script will accept the grammar following this statement. If false, the grammar defined will be considered only for the next input.
Return Value
    None.
See for Example


Sample - Speech Recognition

*---------------------------------------------------------------
* Script : Sample - Speech Recognition
* Date   : 1st Feb 2006
* Notes  : Example Speech Recognition Script for Audio Juke Box
*---------------------------------------------------------------

MAIN:

    srKeepGrammar(true)
    srAcceptWords("zero","one","two","three","four","five","six","seven","eight","nine")

    answer
    play "welcome.wav"

    $retry = 3
    while $retry > 1

    * Accept a number
    play "song.wav"
    while true
        $Key = input(1,7)
        if $InputMode == "S"
            if srConfidence() >= 100
                break
            endif
        else
            break
        endif
    endwhile

    if $InputMode == "S"
        * Perform a translation to the appropriate keypress
        if $Key == "zero"
            $Key = 0
        endif
        if $Key == "one"
            $Key = 1
        endif
        if $Key == "two"
            $Key = 2
        endif
        if $Key == "three"
            $Key = 3
        endif
        if $Key == "four"
            $Key = 4
        endif
        if $Key == "five"
            $Key = 5
        endif
        if $Key == "six"
            $Key = 6
        endif
        if $Key == "seven"
            $Key = 7
        endif
        if $Key == "eight"
            $Key = 8
        endif
        if $Key == "nine"
            $Key = 9
        endif
    endif

    if $Key = 0
        break
    endif

    if $Key <> ""
        play Format("Music%d.wav",$Key)
        $retry = 3
    endif
    $retry -= 1
    endwhile

    play "thank.wav"
    hangup
    goto MAIN

* User has hung up
ONHANGUP:
    hangup
    goto MAIN

* An error has occurred
ONSYSTEMERROR:
    log $error
    display $error
    if $debug
        msgbox $error
    endif

    hangup
    goto MAIN


SoftDisconnect()

 SoftDisconnect ( <DeviceId>)
    Destroys a SoftInterconnect() with a specified device.
Parameters
    <DeviceId> Channel to be disconnected.
Return Value
    None.
Remarks
    Disconnection closes all Interconnects with the device.
Example
    Refer samples provided with the Xtend IVR.


SoftInterConnect()

 SoftInterConnect ( <DeviceId>)
    Interconnects the voice channels of the current device and the specified device.
Parameters
    <DeviceId> Channel to be connected.
Return Value
    None.
Remarks
  • Interconnects current device to the specified device so that the outgoing audio of the current device is passed on to the incoming audio of the specified device and the outgoing audio of the specified device is passed on to the incoming audio of the current device. In effect, the two devices do a SoftListen() on each other's incoming channels.
  • Any number of interconnects may be performed with any number of devices simultaneously, with processor capability being the only limit. Technically it is possible to do a SoftConference by performing multiple SoftInterconnect() with all the participating devices. In practice, the load on the processor may be too high.
  • The more channels are added, the more would be the resulting volume and the noise accompanying it. This is because no automatic gain control is incorporated into this function. Hence, software interconnect is recommended to club two channels together.
 Example
    Refer samples provided with the Xtend IVR.


SoftListen()

 SoftListen( <DeviceId>[, Type])
    Listens to a particular channel.
Parameters
    <DeviceId> Channel to be listened.
    [Type] Listens to the Incoming(Type=1), Outgoing(Type=2), or both incoming and outgoing audio(Type=0, default) of the specified device.
Return Value
    None.
Remark
  • According to the <Type> indicated, the Incoming, the Outgoing audio or both of the specified device is taken and given out as the outgoing audio of the current device.
Example
    Refer samples provided with the Xtend IVR.


SoftStream()

 SoftStream( <DeviceId>,<Type>)
    Streams the Incoming, Outgoing or both audio of the current device to the incoming audio of the specified device.
Parameters
    <DeviceId> Channel to be listened.
    <Type> Type of streaming to be done.
Return Value
    None.
Remarks
  • Types of streaming are the Incoming(Type=1),
Outgoing(Type=2), or both incoming
and outgoing audio(Type=0) of the specified device.
  • It is the same as a SoftListen() executed by the specified device on the current device.
  • HANGUP will automatically disconnect the streaming channels.
Example
    Refer samples provided with the Xtend IVR.


SoftUnlisten()

 SoftUnlisten ( <deviceId>)
    Unlisten from the specified device.
Parameters
    <DeviceId> Channel to be unlistened.
Return Value
    None.
Example
    Refer samples provided with the Xtend IVR.


SoftUnstream()

 SoftUnstream( <deviceId>)
    Releases SoftStream() to the specified device.
Parameters
    <DeviceId> Channel to be released.
Return Value
    None.
Example
    Refer samples provided with the Xtend IVR.


AtomicAdd()

 $sum = AtomicAdd (<DeviceId>, "<$Variable>", <Value>)
    Increments/decrements the value of a variable in a particular device.
Parameters
    <DeviceId> The device where the variable is declared.
    <$Variable> The variable whose value is to be modified.
    <Value> The value to be incremented/decremented.
Return Value
    Returns an integer value.
Remarks
  • The function performs only integer addition/subtraction.
  • While executing this statement, the system would perform a Lock on the variable to prevent any external manipulation on its value.
Example
    $ret = AtomicAdd(1, "$Count", 5)
  • if prior to addition $Count = 5, then after this both $Count and $ret will contain 10.
    $ret = AtomicAdd(1, "$Count", -1)
  • if $Count = 5, then after this operation, both $Count and $ret will contain 4.


AtomicGet()

 $Value = AtomicGet(<DeviceId>, "<$Variable>")
    To access variables across devices.
Parameters
    <DeviceId> The device to access the variable value.
    <$Variable> The name of the variable.
Return Value
    Returns the variable value.
Remarks
  • This is an atomic function using which we can specify as well as access the variables of another thread.
Example
    $Value = AtomicGet(1,"$Ring")
  • Here, the function obtains the value of the variable $Ring from the first device.
    $Value = AtomicGet(2,"$Ring")
  • Here, the function obtains the value of the variable $Ring of the second device.


AtomicSet()

 AtomicSet (<DeviceId>, "<$Variable>", <Value>)
    Sets the value of a variable in a particular device.
Parameters
    <DeviceId> The device where the variable is declared.
    <$Variable> The variable whose value has to be changed.
    <Value> The value of the variable.
Remarks
  • During this operation, the variable is automatically locked from external manipulations.
    •
Example
    AtomicSet(1, "$Count", 10)
  • Sets the value of variable $Count to 10 in the first device.


GetMessage()

 $Msg = GetMessage([DeviceId])
    Fetches a string from the message queue of the specified device.
Parameters
    [DeviceId] The device from which the message is extracted.
Return Value
    Returns a null string if message queue is empty, or returns the next available string.
Remarks
  • Every thread maintains a message queue, into which we can put or get message from, for the purpose of inter-thread communication.
  • If no device is specified, then the current device is assumed.
  • If the specified device does not exist, the system would jump onto ONSYSTEMERROR.
Example
    $Msg = GetMessage()
  • $Msg will contain a string from the message queue of the current device, if any.
    $Msg = GetMessage(10)
  • $Msg will contain a string from the message queue of device 10, if any.


PutMessage()

 PutMessage (<DeviceId>, "<String>")
    Places a string into the message queue of the specified device.
Parameters
    <DeviceId> The device into which the message has to be given.
    <String> The message given to the device.
Return Value
  • None.
Remarks
  • None.
Example
    PutMessage("Hello World")
  • Places "Hello world" into the message queue of the current device.
    PutMessage(10,"Hello World")
  • Puts "Hello World" into the message queue of device 10. In the absence of such a device, the script jumps on to ONSYSTEMERROR.


CountMessage()

 $TotalMsg = CountMessage([DeviceId])
    Returns the total number of messages present in the message queue of the specified device.
Parameters
    [DeviceId] The device from which the total count of messages is retrieved.
Return Value
    Returns a number.
Remarks
  • Every thread maintains a message queue, into which we can put or get message for the purpose of inter-thread communication.The total number of messages present in the message queue of the specified device is the return value of CountMessage().
  • If deviceid is not specified, then the total number of messages in the current device is returned.
  • If an invalid deviceid is specified, then the return value will be zero.
Example
  1) PutMessage ("Welcome all")
    $TotalMsg = CountMessage()
  • Places "Welcome all" into the message queue of current device. $TotalMsg will contain 1.
  2) PutMessage (5,"Welcome all")
    $TotalMsg = CountMessage(5)

  • Places "Welcome all" into the message queue of device 5. $TotalMsg will contain 1.


Beep

 Beep <frequency> <duration>
    Produces a beep sound.
Parameters
    <frequency> Frequency of the sound produced in hertz.
    <duration> Duration of the sound produced in milliseconds.
Remarks
  • Beep command can accurately produce frequency of up to 4KHz only.
Example

MAIN:
   Answer

   Play "Welcome.wav"

   //Please dial your account number after the beep
   Play "Accno.wav"
   beep 800 250
   $accno = Input(5)

   ;.....
   ;.....

   Hangup
   goto MAIN


BgPlay

 BgPlay <wave file>
    Plays the specified ".wav" file in the background. If no extension is provided, .wav is assumed automatically.
Parameters
    <wave file> Wave file to be played in the background.
Remarks
  • Unlike Play command, only one file maybe given as a parameter.
  • BgPlay by itself without any parameters, stops the background playback.
  • Useful if a theme music has to be played continuously in the background.
  • To play back a prompt, it is coupled with the background music and both are played simultaneously. Even after completing the prompt, the music will loop itself in the background.
  • This feature may not available on every voice hardware and we recommend Eicon Diva Server card.
  • Bgplay, once begun will continue playing till the end of the call. On reaching the end of file, it resumes the play.
  • Giving too big a wave file for bgplay is not recommended. A size of 100k is enough and sufficient.
    •
Example

MAIN:

   Answer

   BgPlay "bgmusic.wav"

   //play welcome message
   play "welcome.wav"

   //accept user ID
   play "userid.wav"
   $uid = input(5,4)
   ;.......
   ;.......

   hangup
   goto MAIN


BgVolume

 BgVolume <percent>
    Adjusts the background playback volume.
Parameters
    <percent> Percentage corresponding to which the Background Volume has to be increased or decreased.
Remarks
  • Default volume percentage is 100. In such circumstances, the wavefile will be played without any modification.
  • Values below the default volume will decrease the volume and values above the default will increase the background sound. Suppose the command is BgVolume 50; the played back volume will be just half the original sound.
  • BgVolume resets to 100% on every call.
Example

:MAIN

   Answer

   BgPlay "bgmusic.wav"

   //play welcome message
   play "welcome.wav"

   //accept user ID
   BgVolume 50
   play "userid.wav"
   $uid = input(5,4)
   Bgvolume 100

   ;......
   ;......

   hangup
   goto MAIN


 Clear
    The Clear command immediately clears any pending Play, Record and Speak commands and removes any pending keys from the input queue.
Parameters
    None.
Remarks
  • None.
Example

:MAIN
    answer 1
    ;...........
    ;...........
    ;...........
    ; Getting data from the live web site will take some time.
    ; So keep the caller busy with this music
    play "music.wav"

    //Connecting web site
    $status = http("http://www.kitco.com/market/")

    // stop the music and continue IVR
    clear

    if $status != 1
        ; Error connecting to website
        play "weberror.wav"
        goto QUIT
    endif
    ;...........
    ;...........


Input()

 $number = Input ( <max digits>, [wait in seconds], [enter key], [esc key], [mask] )
    Accepts input from the telephone keypad and through speech recognition.
Parameters
    <max digits> Maximum number of digits allowed to enter by the user.
    [wait in seconds] Duration in seconds to wait for input. If this parameter is 2, the IVR will wait for any play or speak to complete followed by a wait of upto 2 seconds to receive any input from the user.
    [enter key] The key to be pressed by the user on completing the input.
    [esc key] Key pressed by the user for canceling the previous value entered.
    [mask] This optional argument is used for filtering the input. The default mask is "0123456789".

Return Value

    Returns the entered value/recognized word.

Remarks

  • The input() will accept a maximum of <max digits> numbers entered through the telephone keypad or when recognized through speech with the Xtend IVR waiting for a duration of [wait in seconds] between two consecutive inputs or until the [enter key] is pressed. The function returns the entered value/recognized word.
  • The pre-defined variable $InputMode recognizes the mode of Input() operation. The mode of input operation can be classified into pulse (P), tone (T) and speech recognition (S).
Example

1) When mode of input() is through telephone keypad:

  MAIN:
    answer
    Play "Welcome.wav"

    $num = Input(2,3,#,*,"02468")
    Play "YouEntered.wav"
    Play Num2Wav($num)

    Hangup
    goto MAIN
  • Here Input() waits for 2 digits to be entered for upto the duration of play followed by 3 seconds. Pressing # acts as the <Enter> key and pressing * will erase the previously pressed keystrokes, allowing re-entry. Input() will accept only even numbers, since it is masked with "02468".

2) When mode of input() is through speech recognition:

  MAIN:
    answer
    //Enable grammar and set the words to be recognized
    .....
    $retry = 3
    while $retry > 1
      $retry -= 1
      //Accept a number between 0 - 9
      play "song.wav"
        while true
            $Key = input(1,7)
            if $InputMode == "S"
                if srConfidence() >= 100
                    break
                endif
            else
                break
            endif
        endwhile

        if $InputMode == "S"
            //Perform a translation to the appropriate keypress
            .....
        endif
        .....
    endwhile

    play "thank.wav"
    hangup
    goto MAIN
  • Here Input() waits till a word is recognized or a 7-second delay after the play is complete, which ever is earlier. If mode of input is through speech recognition then compare the recognized word with the defined words and play the corresponding wave file.
See also Accept()


Play

 Play "<wave file>"
    Play command plays back the specified .wav file on the phone line.
Parameters
    <wave file 1> [<wave file 2> <wave file 3> ... <wave file N>] The wave file to be played.
Remarks
  • If no extension is provided, “.wav” is assumed. A string variable can be used in place of the wave filename. Play begins immediately and happens in the background. The script continues execution. Any subsequent play or speak commands are queued and played back. To force the Play to complete before proceeding, use the "wait 0" command.
  • It is recommended that a wave file be in 8 KHz 16 bit mono PCM format. An internal conversion will be attempted by the engine for other wave formats.
  • Silence may be imposed using Play command. In order to play silence for 1 second, use Play \Pau=n\, where n is the no:of milliseconds. For instance, a pause of 1 second can be given as
      play "welcome.wav"
play "\Pau=1000\"
play "menu.wav"
  • Whenever a play command is encountered in the script, the IVR engine initiates the search for the wave file in the path specified by $wavDir, moving on to the script directory and then to the 'wave' directory. Following an unsuccessful search, it jumps to ONSYSTEMERROR label with $error containing an error message reporting a missing wave file.
  • To support wave files with long names, call Escape() as shown below.
      play Escape("Very Good Morning World.wav")
  • A hangup command waits for the play or record command to complete. But a user hangup will terminate the play/record and jump to ONHANGUP.
  • A wait command starts its count down only after completing the play/record. For example,
      play "welcome.wav"
wait 1000
    implies that the IVR wait for 1 second after completing the play. On the other hand,
      play "welcome.wav"
sleep 1000
    suggests that the IVR wait for 1 second which includes the play time too.
Example

$filename = "YouEntered.wav"

MAIN:
   Answer

   Play "Welcome.wav"
   $num = Input(5)
   Play $filename
   Play Num2Wav($num)
   Hangup
   goto MAIN

ONHANGUP:
   Hangup
   goto MAIN


Record

 Record <seconds>
    Records the incoming voice.
Parameters
    <seconds> Record duration in seconds.
Remarks
  • The recorded voice is saved automatically in a file specified in the variable $RecordFile. This variable is automatically initialized to a unique temporary filename by IVR when a session is started, or to a user defined one.
  • Both Record and Play back will work simultaneously only on full-duplex voice cards. But when using half-duplex cards, play automatically stops when record begins and vice versa.
Example
    ....
    ....
    //The sample works only on full-duplex voice cards
    $Recordfile = "Sample.wav"
    Record 30

    while int(RecordTimeLeft()/1000) > 10
        sleep 100
    endwhile

    //10 more seconds to stop recording
    //play beep to conclude the talk
    beep
    wait 0
    ....
    ....


Speak

 Speak <message>
    Speak command speaks out the given text if a suitable 'Text To Speech'(TTS) Engine has been installed on that system.
Parameters
    <message> The text to be voiced.
Remarks
  • Similar to Play command, Speak command also executes in the background. Due to heavy CPU usage, the command is not recommended in higher deployments.
  • The quality and accent of the spoken sound completely depends upon the TTS engine. User has to buy a SAPI compatible TTS engine.
  • TTS engine to be used can be specified in the configurations or if using SAPI 5.x, the appropriate XML command can be passed to SAPI using speak. For instance, you can specify:
    • the type of voice required by giving the following XML command along with the text.
      speak '<voice required="gender=male;age!=child">Welcome to Xtend IVR</voice>'
    • symbolic phonetic representation(SYM) to create the English pronunciation using the XML PRON tag. Each phoneme entry should be space limited. Let us see how to represent hello in phonemes:
      speak '<PRON SYM = "h eh l ow"/>'
    For more information on XML grammar, please refer Microsoft Speech SDK 5.x Help.
Example

MAIN:

   Answer

   speak "Welcome to Xtend IVR"

   hangup
   goto MAIN

ONHANGUP:
   goto MAIN


VoiceLog

 VoiceLog <wave file>
    Logs the telephony audio to a specified file.
Parameters
    <wave file> Wave file to log the voice.
Remarks
  • If the file already exists and is in the correct format, the data is appended to the file.
  • VoiceLog without any filename parameter will stop any existing logging.
  • Creates a PCM 16-bit stereo file with one sound track containing the IVR voice and the other having caller's voice.
    •
Example
    :MAIN
    answer

    voicelog "c:\vlogs.wav"

    //play welcome message
    play "welcome.wav"

    //accept user ID
    play "userid.wav"
    $uid = input(5,4)
    .....
    .....

    hangup
    goto MAIN

:ONSYSTEMERROR
    log $Error
    clear
    hangup
    goto MAIN

:ONHANGUP
    hangup
    goto MAIN


Volume

 Volume <percent>
    Adjusts the playback volume.
Parameters
    <percent> Percentage corresponding to which the Volume has to be increased or decreased.
Remarks
  • Default volume percentage is 100. In such circumstances, the wavefile will be played without any modification.
  • Values below the default volume will decrease the sound and values above the default will increase it. Suppose the command is Volume 50; the played back volume will be just half the original volume.
  • Volume command affects all the Beep, Play and Speak commands.
  • It is recommended that for the best voice quality the volume be set properly prior to the recording process.
Example

MAIN:

   Answer

   Volume 50

   speak "Welcome to Xtend IVR"
   wait 0

   Volume 200

   speak "Welcome to Xtend IVR"
   wait 0

   hangup
   goto MAIN

ONHANGUP:
   goto MAIN


 Wait
    Waits for a specified number of milliseconds after completion of any queued Play or Record commands.
Parameters
    Number of milliseconds the system should wait before moving to the next executable statement.
Remarks
  • If Play/Speak/Record commands are executing, Wait will pause for these commands to complete before starting the countdown. In other words, wait starts its count down after the completion of play/speak/record.
  • Commands such as Play, Speak, Record etc. are asynchronous, in the sense that the script will not wait for the execution of these commands to complete to move to the next executable statement. Instead, the script continues by executing the succeeding statements even if the commands like Play or Speak or Record have not yet executed completely. In order to make the execution synchronous (i.e. further statements are not executed till the completion of any pending executions) Wait command can be made use of. For example, if we put 'Wait 5' as the very next executable statement after a Play command which plays a ".wav" file with duration, say 10 seconds, then the script waits for the completion of the Play statement plus an additional 5 milliseconds before the next statement is executed. Key presses, if any, will be flushed during this session.
Example

MAIN:

   Answer

   // wait 5 second to continue after the speak command
   speak "Welcome to Xtend IVR. Please wait 5 seconds."
   wait 5000

   hangup
   goto MAIN

ONHANGUP:
   goto MAIN


DeleteFile()

 $bool = DeleteFile ( <file name> )
    Deletes the specified file.
Parameters
    < file name > Name of the file to delete.
Return Value
    Returns boolean value true if file is deleted, false otherwise.
Example
    $status = DeleteFile("abc.txt")


Load

 Load < file name >
    Loads all variables from the given file. It is useful for loading up initial configuration values from a file.
Parameters
    < file name > File from which the variables are loaded.
Remarks
  • Each line in the file represents a complete record and is defined as: $variable value.
Example
    :MAIN
    // setup default values
    $RingsBeforeAnswer = 4
    $MaxTimeAllowed = 120

    // load user settings from file config.txt
    load "config.txt"

:WAIT_FOR_CALL
    answer $RingsBeforeAnswer
    timeout $MaxTimeAllowed
    ;-----------------
    ;-----------------
where "config.txt" file contains the following data with space as the delimiter between variable and value.
    $RingsBeforeAnswer 1
$MaxTimeAllowed 240


LoadFile()

 $bool = LoadFile ( <file name>, <$variable>, [nooflines] )
    Loads the specified number of lines of text from the file to a group variable.
Parameters
    < file name > File from which the number of lines of text is loaded.
    < $variable > Variable to load the text into.
    [ nooflines ] Number of lines of text to be loaded.
Return Value
    LoadFile function returns a boolean value indicating success or failure; 1 for success or 0 for failure.
Remarks
  • If the optional parameter [ nooflines ] is not specified, then the entire content of the file is assumed and is loaded to the variable.
  • This is applicable only for text files. In addition to the specified number of lines, the following details are also populated.
    • $variable.FileDate
    • $variable.FileLines
    • $variable.FileName
    • $variable.FileSize
      •
Example
    $Status = LoadFile("abc.txt", "$Variable", 10)
  • Loads first 10 lines of text from the file "abc.txt" to the variable "$Variable.Line1", "$Variable.Line2", ....... "$Variable.Line10".


Log

 Log <string>
    Logs the given text.
Parameters
    < string > The text to be logged.
Remarks
  • A new log file is created in the Logs folder of the running script, for each day and the filename is in the yyyymmdd format. The user logs using the LOG command will appear under the script folder. To enable the user to track down problems, the time of each log entry as well as the active device identifier is automatically logged along with the text.
  • A separate system log also is maintained by Xtend IVR under the folder XIVR\logs. These log files too use the same naming conventions that of user logs like yyyymmdd. But these logs are automatically created and the developer has no control over it.
  • Normally used as a call usage logging and debugging aid.
Example

LOG "Date : " $Date
LOG $Date


save

 Save < file name >
    Saves all variables to the given file.
Parameters
    < file name > File to which the variables are stored.
Remarks
  • This is useful when you are not using the Developer Edition. Under Developer Edition you can watch and change the variables and their values from within the IDE. But under Standard Edition there is no other way to examine variables. So Save command will be very helpful under these circumstances.
Example

:MAIN
    answer 1

    // write all active IVR variables into a text file
    save "call.txt"

    // Call my application to parse this file for getting information like caller id, date and time of call etc.
    run sample.exe "call.txt"
    ;.......
    ;.......
    hangup
    goto MAIN


SaveFile()

$bool = SaveFile ( <file name>, <$variable>, [nooflines] )

    Writes data into a file.
Parameters
    < file name > File to write.
    < $variable > Variable containing the text to write.
    [ nooflines ] Number of lines of text to be written.
Return Value
    SaveFile function returns a boolean value indicating success or failure; 1 for success and 0 for failure.
Remarks
    After saving the file, it updates the date/time, filesize information in the group variable.
Example
    $Variable.Line1 = "hello"
$Variable.Line2 = "world"
$Status = SaveFile("abc.txt", "Variable")
  • Replaces the first 2 lines of text in file "abc.txt" if it already exists, else, a file is created by the name and the content is written from the variables $Variable.Line1 and $Variable.Line2.


Alltrim()

 $strTrim = Alltrim (<String>)
    Removes all the leading and trailing white-space characters from the specified string.
Parameters
    <String> The string for which the leading and trailing white spaces, tabs, carriage return and line feeds are to be removed.
Return Value
    The string with the leading and trailing white spaces removed.
Remarks
  • This has the same effect as Ltrim(Rtrim(<String>))
Example
    $Str = "    Hello, World    "
$NewStr = Alltrim($Str)
  • $NewStr now contains "Hello, World".


Ascii()

 $intCode = Ascii ( <character> )
    Returns the ASCII code of specified character.
Parameters
    <character> The character for which the ascii value to be returned.
Return Value
    Returns the ASCII code of the character.
Remarks
  • If a string is given as the parameter of the ascii () function then it will return the ascii value of the first character of the string.
Example

$a = "A"
$b = ascii($a)
  • $b has the value 65.


Chr()

 $strChar = Chr ( <number> )
    Returns the character, if given its ASCII code.
Parameters
    <number> The ASCII code for which the corresponding character to be returned.
Return Value
    Returns the character for the ASCII code.
Remarks
  • In ASCII code, numbers from 1 to 255 represent letters, numbers, punctuation marks, and symbols. Any number outside this range will make the function to return null.
Example

$a = 65
$b = chr($a)
  • $b now contains "A".


Compare()

 $intCompare = Compare ( < string1 > , < string2 > )
    Compares two strings.
Parameters
    < string1 > , < string2 > Any two string expressions.
Return Values
  • -1 if string1 is less than string2
  • 0 if string1 is equal to string2
  • 1 if string1 is greater than string2
Remarks
  • Compare() performs case-sensitive comparisons.
Example

$a = "ABCD"
$b = compare($a,"ABCD")
  • $b now contains 0.


Concat()

 $strConcat = Concat (<String1>,<String2>, ...)
    Appends all given strings together. Multiple strings can be specified.
Parameters
    <String1>,<String2>, ... The strings which are to be appended.
Return Value
    The appended string.
Remarks
  • At least two strings should be specified.
Example
    $Str = "Hello"
$NewStr = Concat($Str, ", World")
  • $NewStr now contains "Hello, World".


ExtractXmlTag()

 $xmltext = ExtractXmlTag ( <xmldata>,<starting tag>,<ending tag>,[offset] )
    Used to retrieve the text in which the tag should be searched for.
Parameters
    <xmldata> Text to be retrieved along with starting and ending tags.
    <starting tag> Signifies the beginning tag after which the text is defined.
    <ending tag> Signifies the closing tag at the end of the text.
    [offset] Designs the position of the xmldata from which the search should begin. Default value of offset is 0.
Return Value
    Returns the text as per the specified offset value.
Example

    MAIN:
      $xmltext = ExtractXmlTag("<b>Welcome to Xtend!!</b><b>Hello</b>","<b>","</b>",0)
    display $xmltext
    hangup
    goto MAIN
    .
    .
    .
  • $xmltext will contain "Welcome to Xtend!!".
  • If offset is given as 1 then $xmltext will contain "Hello".


Find()

 $intIndex = Find ( <Target string>,<Search string>, [Offset] )
    Finds a character or substring inside a larger string.
Parameters
    <Target string> The main string where the searching has to be done.
    <Search string> The string or the character to be searched.
    [Offset] The zero based index value of the character in the main string where the search for the substr should begin. Offset starts from the value 0.
Return Value
    Returns the zero based index of the first character in the "Target string" that matches the requested substring or character, returns -1 if the substring or character is not found.
Example
    $a="ABCDEFGABCD"
$b=Find($a,"CD",4)
display $b
  • Here search for the substring "CD" starts from offset value 4. Thus, $b will contain 9.

  • If the offset value is given as 1 then $b will contain 2.


Format()

 $strFormat = Format ( <fcstring> , [Arguments]... )
    Writes formatted data to a string according to the format specification types.
Parameters
    <fcstring> Format control string that has the Format Specification Types as given below.
    [Arguments]... Optional arguments.
Return Value
    Returns the formatted string.
Remarks
  • Format specification types, preceded by a percent (%) sign, are replaced by the corresponding argument components. Other characters in the formatting string are copied unchanged and returned to the string.
  • This is similar to sprintf() in C++ and PHP.
Format specification types
    Character | Output format
%% | A percent(%) symbol.
%c | Single-byte character.
%d | Decimal integer.
%i | Decimal integer.
%o | Octal integer.
%u | Decimal integer.
%x | Hexadecimal integer, using “abcdef”.
%X | Hexadecimal integer, using “ABCDEF”.
%e | Signed value having the form [ – ]d.dddd e [sign]ddd, where d is a single decimal digit, is one or more decimal digits, ddd is exactly three decimal digits, and sign is + or –.
%E | Identical to the exponent format except that E rather than e introduces the exponent.
%f | Signed value having the form [ – ]dddd.dddd, where dddd is one or more decimal digits. The number of digits before the decimal point depends on the magnitude of the number, and the number of digits after the decimal point depends on the requested precision.
%g | Signed value printed in f or e format. The e format is used only when the exponent of the value is less than –4 or greater than or equal to the precision argument. Trailing zeros are truncated, and the decimal point appears only if one or more digits follow it.
%G | Identical to the g format, except that E, rather than e, introduces the exponent (where appropriate).
%s | Specifies a single-byte character string.
Example

a) $Var1 = Format ( "Cost = %6d %s " , 450 , "Rs" )

   value : " Cost = 450 Rs "

b) $Var2 = Format ( "%s = %d " , " The value is " , 123 )

   value : " The value is = 123 "

c) $Var3 = Format ( "Hex value of 123 is %x " , 123 )

   value : " Hex value of 123 is 7b "

d) $Var4 = Format (" Hex value of 123 is %X " , 123)

   value : " Hex value of 123 is 7B "

e) $Var5 = Format ( "%e%d ", 2 , 2 )

   value : " 2.000000e+0002 "


Index()

 $intIndex = Index ( <Target string>, <Search string> )
    Finds a character or substring inside a larger string.
Parameters
    <Target string> The main string which has to be searched for the existence of a substring.
    <Search string> The string or the character to be searched for.
Return Value
    Returns the zero based index of the first character in the "Target string" that matches the requested substring or character, returns -1 if the substring or character is not found.
Remarks
  • Find () function is similar to Index () function and has the same syntax.
Example

$Var = "Ivr Solutions"
$result = Index($Var,"Sol")
  • will return 4.


Left()

 $strLeft = Left ( <string>, [size] )
    Extracts a substring from the leftmost end of the string.
Parameters
    <string> Main string parameter.
    [size] Number of characters to be extracted.
Return Value
    Returns n characters from the left side of the string.
Remarks
  • Extracts a substring of length [size] characters starting from the beginning of the string. The function returns a copy of the extracted substring.
Example
    $a = "ABCD"
$b = left($a,2)

  • $b now contains "AB".


Len()

 $intLen = Len ( <string> )
    Finds out the length of the <string>.
Parameters
    <string> String parameter whose length has to be found out.
Return Value
    Returns the length of the string.
Remarks
    None.
Example
    $a = "ABCD"
$b = len($a)

  • $b contains 4.

    $a = 365
$b = len($a)

  • $b contains 3.


Lower()

 $strLower = Lower ( <string> )
    Returns a copy of the <string> converted to lowercase.
Parameters
    <string> String to be converted.
Return Value
    Returns the converted string in lower case.
Remarks
    None.
Example

$a = "ABCD"
$b = Lower($a)

  • $b now contains "abcd".


Ltrim()

 $strTrim = Ltrim (<String>)
    Removes all leading white space characters, tabs and line feed from the specified string.
Parameters
    <String> The string from which the leading white spaces and tabs are to be removed.
Return Value
    The string with the leading white spaces removed.
Remarks
    None.
Example
    $Str = "    Hello, World"
$NewStr = Ltrim($Str)
  • $NewStr now contains "Hello, World".


Mid()

 $strMid = Mid ( <string>, <start index>, [len] )
    Extracts a substring from <string>.
Parameters
    <string> Main string parameter.
    <start index> Start position.
    [len] Number of characters to be extracted.
Return Value
    Returns the extracted substring.
Remarks
  • Extracts a substring of length [len] characters from the string, starting at position given in the (zero-based index). The function returns a copy of the extracted substring.
  • If length is not given, the function assumes to extract the string from index till end.
Example
    $a = "ABCDEFG"
$b = mid($a,1,2)
  • $b now contains "BC".
    $a = "ABCDEFG"
$b = mid($a,3)
  • $b now contains "DEFG".
    $a = "ABCDEFGH"
$b = mid($a,3)
  • $b now contains "DEFGH".


Reverse()

 $strRev = Reverse ( <String> )
    Reverses a given string.
Parameters
    <String> The string to be reversed.
Return Value
    Returns the reversed string.
Remarks
  • Reverse() examines the string and reverses it.
Example
    $str = "ABCDEF"
$strRev = Reverse($str)

 $strRev now contains  "FEDCBA".


ReverseFind()

 $intIndex = ReverseFind ( <Target string>,<Search string> )
    Finds a character inside a larger string starting the search from the end.
Parameters
    <Target string> This main string is examined for the existence of a character.
    <Search string> The character to be searched.
Return Value
    Returns the zero based index of the last character in the "Target string" that matches the requested character, -1 if the character is not found.
Remarks
  • Rindex() function is similar to ReverseFind() and has the same syntax.
    •
Example
    $Var = "abdcf"
$index = ReverseFind($Var,"f")

  •  will return the index 4, starting the search from the end.


Right()

 $strRight = Right ( <string>, [size] )
    Extracts a substring from the rightmost end of the string.
Parameters
    <string> Main string parameter.
    [size] Number of characters to be extracted.
Return Value
    Returns n characters from the right side of the string.
Remarks
  • Extracts a substring of length [size] characters from the rightmost end of the string <string>. The function returns a copy of the extracted substring.
Example
    $a = "ABCD"
$b = Right($a,2)

  • $b now contains "CD".


Rindex()

 $intIndex = Rindex ( <Target string>,<Search string> )
    Finds a character inside a larger string starting the search from the end.
Parameters
    <Target string> This main string is examined for the existence of a character.
    <Search string> The character to be searched.
Return Value
    Returns the zero-based index of the last character in the "Target string" that matches the requested character, -1 if the character is not found.
Remarks
  • ReverseFind() function is similar to Rindex() and has the same syntax.
    •
Example
    $Var = "abdca"
$reverseindex = Rindex($Var,"a")

  • Function will return the index 4, starting the search from the end .


Rtrim()

 $strTrim = Rtrim (<String>)
    Removes all the trailing white space characters, tabs, carriage return and line feeds from the specified string.
Parameters
    <String> The string from which trailing white spaces, tabs, carriage return and line feeds are to be removed.
Return Value
    The string with the trailing white spaces, tabs, carriage return and line feeds removed.
Remarks
    None.
Example
    $Str = "Hello, World   "
$NewStr = Rtrim($Str)
  • $NewStr now contains "Hello, World".


Substr()

 $strExtract = Substr ( <string>, <start index>, [len] )
    Extracts a substring from <string>.
Parameters
    <string> Main string parameter.
    <start index> Start position.
    [len] Number of characters to be extracted.
Return Value
    Returns the extracted substring.
Remarks
  • Extracts a substring of length [len] characters from the string <string>, counting from the position <start index> which is a zero-based index. The function returns a copy of the extracted substring.
Example
    $a = "ABCD"
$b = Substr($a,1,2)

  •  $b now contains "BC".

    $a = "ABCDEFG"
$b = Substr($a,3)

  •  $b now contains "DEFG".

    $a = "ABCDEFGH"
$b = Substr($a,3)

  •  $b now contains "DEFGH".


Upper()

 $strUpper = Upper ( <string> )
    Returns a copy of the <string> converted to uppercase.
Parameters
    <string> String parameter to be converted.
Return Value
    Returns the converted string in upper case.
Remarks
    None.
Example
    $a = "abcd"
$b = Upper($a)
  • $b now contains "ABCD".


 Bp
    Sets a break point inside the script.
Parameters
    None.
Remarks
  • BP can be used for debugging purpose in the Developer Edition. When execution of the script reaches BP, it switches to single step mode.
  • This command is active only if executed under the Developer Edition. Under the Standard Edition XIVR engine will simply ignore the Bp command.
Example
    $A = 0
while $A < 10
    speak $A
    BP
    $A = $A + 1
endwhile


 Break
Breaks out of the current loop.
Parameters
None.
Remarks
  • Break or Exit command will cause the execution of the script to break out of the current While loop. The statements after the EndWhile are then executed.

Example

:DBUPDATE
    $db = "Provider=MSDAORA.1;User ID=scott;Password=tiger;Data Source=xtendora;Persist Security Info=False"

    $empinfo = db.Open($db,"SELECT * FROM EMP ORDER BY SAL ASC")
    if $empinfo != 1 then goto DBERROR

    while not $empinfo.eof
        if compare($empinfo.ENAME,"KING") != 0
            $empinfo = db.Skip()
            continue
        endif
        display $empinfo.ENAME  " " $empinfo.JOB  "  " $empinfo.SAL
        break
    endwhile
    $empinfo = db.Close()

:DBERROR
    display "Error in database connection"


 Continue
Jumps to the while statement in a while - endwhile loop.
Parameters
None.
Remarks
  • Continue or Loop command will cause the execution of the script to check the next condition of the current While loop.

Example

while true
    $msg = GetMessage()
    if $msg = ""
        sleepevent
        Continue
    endif
    ;......
    ;......
endwhile


DeviceSpecific()

 DeviceSpecific ("<FunctionName>", [ Parameters ] )
    Calls a specific function directly from the voice hardware driver.
Parameters
    <FunctionName> Specifies the name of the function to be called directly from the driver.
    [ Parameters ] Parameters passed to the function. This varies with the function you call and can be avoided if no arguments are passed.
Return Value
    Returns the result of the called function.
Remarks
  • The function passes the string parameters directly to the DeviceSpecific() function of the driver DLL.
  • Recommended only for advanced users who require special functionalities that are not probable from the IVR script like Conferencing, Faxing etc.


Display

 Display <string>
    Prints messages in the Display Window.

Parameters
    < string > String or variable which contains the text to be displayed.
Remarks
  • Use this command to print any useful messages for the administrator. For example, you can print information like caller id and connection time for every incoming connection.
Example

:MAIN
    display "Waiting for call..."
    answer

    display "Call from: " $cli
    ;........
    ;........

    hangup
    goto MAIN

:ONHANGUP
    hangup
    goto MAIN


Escape()

 $strEscape = Escape ("<string>")
    Converts the binary characters in the string to its percentage(%) hexa form.
Parameters
    <string> The string to be converted.
Return Value
    Returns the converted string.
Remarks
  • Escape() is useful when passing binary values as arguments to an external plugin. Xtend IVR calls an external plugin with a text file as its command line argument containing all active variables and its values. If you are passing binary values into a plugin, it is not possible to write binary values into this text file. So before you call the plugin, convert the binary values into hexa values by calling the escape(). The plugin has to convert them again back to binary before applying the actual value. Subsequently, the plugin must again replace the non-readable values with their equivalent hex figures and return the values to be further processed by Xtend IVR.
Example

$var = Escape("Hello World")
  • $var will contain "Hello%20World".


 Exit
Breaks out of the current loop.
Parameters
None.
Remarks
  • Break or Exit command will cause the execution of the script to break out of the current While loop. The statements after the EndWhile are then executed.

Example

  :DBUPDATE
    $db = "Provider=MSDAORA.1;User ID=scott;Password=tiger;Data Source=xtendora;Persist Security Info=False"

    $empinfo = db.Open($db,"SELECT * FROM EMP ORDER BY SAL ASC")
    if $empinfo != 1 then goto DBERROR

    while not $empinfo.eof
        if compare($empinfo.ENAME,"KING") != 0
            $empinfo = db.Skip()
            continue
        endif
        display $empinfo.ENAME  " " $empinfo.JOB  "  " $empinfo.SAL
        // C,C++ programmers like to use BREAK instead of EXIT
        exit
    endwhile
    $empinfo = db.Close()

:DBERROR
    display "Error in database connection"


Fraction()

 $intNum = Fraction ( <number> )
or
 $intNum = Frac ( <number> )
    Retrieves the fractional portion of the given number.
Parameters
    <number> Any numeric value.
Return Value
    Returns an integer.
Example
    $a = 4.1915
$b = fraction($a)

  • $b contains 1915.


Function

 Function <Function Name> ( Param1, Param2, ... )
<statements>
Return <Value>
Identifies the start of a user-defined function.
Parameters
<Function Name> Name of the function.

Param1, Param2, ... Parameters passed to the function and should be separated by commas.

<statements> One or more executable statements inside the function definition.

<expression> Expression which supports variables or value.

Return Value
    Returns the value of an expression, a constant or a variable.
Remarks
  • Another method of calling a function is:

    • Function <FunctionName>
    Parameters <$Param1><,$Param2>...
    <statements>
    Return [Expression]
  • Function can also be abbreviated as ' FUNC ' or ' FN '.
  • Functions must be defined towards the end of the script, i.e, after they are called from the main function. If they are defined at the beginning of the script, the IVR will straightaway execute them.
  • Either Param or Parameters keyword can be used.
  • All variables (including parameters) inside a function are local to that function.
  • All functions are local to the script file in which they are declared.
  • If a default label like ONHANGUP, ONSYSTEMERROR is not present inside a plugin script, then it will automatically jump to the parent scripts ONHANGUP / ONSYSTEMERROR.
  • You can call another .dt or .dtx file just like a plugin and it will follow the precedence order given below.
  • The precedence of a function call is:
    • Function in current script.
    • .dtx file in current directory.
    • .dt file in current directory.
    • .exe file in current directory.
    • .dtx file in plugins directory.
    • .dt file in plugins directory.
    • .exe file in plugins directory.
  • Functions can be called recursively.
  • You can declare a function in an IVR file and call that function like ivrfile.func().
  • A "goto" from a function than "return", may cause problems in long time execution. A function definition should end up with a return statement.
  • If you miss a return in a function, the control will carry on the execution of subsequent statements in the next function declared below that.
  • An external function can be called with a fully qualified filename like d:\Bank\Accounts($acno,$pin).
  • Defining a function with reserved function name will blindly be ignored. For example, a FN Mid($param) will not get called.

Example
1. Calling a function within the same script:

    Function AddNum ($Num1, $Num2)
    $Num3 = $Num1 + $Num2
    Return $Num3

The above function AddNum adds up the variables $Num1 and $Num2 and the resulting value $Num3 is returned.

AddNum can be beckoned in the script as:

$Num4 = AddNum ($Num1, $Num2)

* In the later case the returned value is assigned to the variable $Num4.
* By giving values 2, 4 respectively to $Num1 and $Num2, the value of $Num3 or $Num4 would be 6.

If this function is not found in the script file then ivr searches for it in the precedence order as given in the remarks section.

2. Calling another .dt or .dtx file just like a plugin: Content of script file "MathOperation.dt":

    MAIN:
    answer 1

    $a = 10
    $b = 20

    $c = Addition($a,$b)

    hangup
    goto MAIN

    ONHANGUP:
    hangup
    goto MAIN
Content of file "Addition.dt"
    param $num1, $num2
    $num3 = $num1 + $num2
    return $num3

3. Recursive functions
    :MAIN
    answer
    $num = 8
    $result = abs(fact($num) - sqr($num))
    display $result
    hangup
    goto MAIN

    function abs($param)
    if $param < 0
    return ($param * -1)
    else
    return $param
    endif

    func fact($param)
    if $param > 0
    return ($param * fact($param - 1))
    endif
    return 1

    fn sqr
    parameter $num
    return ($num * $num)


GetInfo()

 $Info = GetInfo("<attribute>")
    Retrieves information from the driver DLL.
Parameters
    <attribute> Attribute of the driver DLL.
Return Value
    Returns the information corresponding to the id.
Remarks
  • The function maps directly to the GetInfo() function of the driver DLL.
Example
    $id = GetInfo("CLI")
  • $id contains the caller ID.
    • $id = GetInfo("DLI")
  • $id contains the dialed ID.
    • $id = GetInfo("RLI")
  • $id contains the Redirected Line ID.
    • $id = GetInfo("CALLTYPE")
  • $id contains the type of call like voice call, fax call, digital data call etc.
    • $id = GetInfo("INPUTTYPE")
  • $id contains the type of input - pulse or tone.
    • $id = GetInfo("OPENTYPE")
  • $id contains whether the call is in PCM8, PCM16, alaw or mulaw format.


GetLicense()

 $totalPorts = GetLicense ( )
    Returns the number of ports allowed as per the current HASP license.
Parameters
    None.
Return Value
    Returns an integer equivalent to the total number of ports allowed.
Remarks
  • The value returned is same as the number of lines displayed in the Copyright line of the About box of Standard Edition.
Example
    $Ports = GetLicense()


GetSerialNo()

 $srNum = GetSerialNo ( )
    Returns the unique serial number of HASP.
Parameters
    None.
Return Value
    Returns a number.
Remarks
  • The number returned is the same as the one appearing in the Copyright line of the About box of Standard Edition.
  • This function is not valid for Developer Editon as HASP is not required.
Example
    $Srno = GetSerialNo()


GetStartTime()

 $dateTime = GetStartTime ( )
    Returns the starting date and time of the IVR.
Parameters
    None.
Return Value
    Returns date and time in ISO Standard format i.e. YYYY-MM-DD HH:MM:SS.
Example
    $time = GetStartTime()


GetTickCount()

 $intCount = GetTickCount( )
    Retreives the number of milliseconds that have elapsed since the system had started.
Parameters
    None.
Return Value
    An integer giving the number of milliseconds.
Example
    $status = GetTickCount()


GetTime()

 $time = GetTime ( )
    Fetches the local date & time.
Parameters
    None.
Return Value
    Date and time in ISO standard format i.e. YYYY-MM-DD HH:MM:SS.
Example
    $status = GetTime()


GoTo

 GoTo <label>
    Causes the script to jump to the specified label and start execution from that position.
Parameters
    <label> Label to which the script should jump.
Example

$retry = 0
:GET_AC_CODE
    $retry += 1
    if $retry >= 3 then goto GOODBYE
    // Please enter your account number
    play "getacc.wav"
    $AccNo = input(5,4)
    if $AccNo = "" then goto GET_AC_CODE
    //......
    //......
    //......

:GOODBYE
    hangup
    goto WAIT_FOR_CALL


Integer()

 $intNum = Integer ( <number> )
or
 $intNum = Int ( <number> )
    Fetches the integer portion of the given number.
Parameters
    <number> Any valid numeric datatype.
Return Value
    Returns an integer.
Remarks
  • Returns an integral value up to a maximum limit of sixteen numerical places.
Example
    $a = 4.1915
$b = integer($a)

  • $b contains 4.


IsVariable()

 $bool = IsVariable ( "$variable" )
    Searches for the given variable anywhere inside the script.
Parameters
    <$variable> The variable which is to be searched for its existence.
Return Value
    Returns 1 if it exists, otherwise 0.
Example
    $Status = IsVariable("$Acno")


Lock()

 Lock ("[name]")
    Permits one and only one thread/channel/device to execute inside a block of statements.
Parameters
    [name] Name of the lock created.
Remarks
  • By executing the operation, shared resources ensure that only atomic manipulation is performed on their values.
  • Lock() creates a mutex by this name and locks it.
  • Caveat against misuse of this function:
    1. Minimise the lines of code in the Lock()-Unlock() block.
    2. Built-in Expressions, String & Number manipulation functions, Database access and the atomic functions can be used in the block.
    3. Other plugins, sub-functions and voice device dependant commands like Play, Record, Input etc. *SHOULD NOT* be used in code between Lock() and Unlock().
    4. ONSYSTEMERROR and ONRUNTIMEOUT will result in an immediate jump to these labels. Thus all locks of that port will be automatically released and the entire Lock()-Unlock() block *MAY NOT* execute properly. Hence, no function that may result in an ONSYSTEMERROR jump should be used between Lock() and Unlock().
    5. ONHANGUP and ONTIMEOUT labels *DO NOT* take effect when locked.
    6. Coding GOTO or IF THEN GOTO commands after a Lock() will cause an Unlock() of all locks to happen.
    7. All locks are automatically released when HANGUP command is executed.
    •
Example

:MAIN
    .......
    .......
    // The database operation is done inside a lock - unlock block
    // so that only one thread will access it and all other threads
    // will wait in Lock() to get its turn.
    Lock()
    $sql = "select * from EMP where status = 'Q'"
    $result = db.RunSQL($db,$sql)
    if $result = 0
        // query failed.
        Unlock()
        goto MAIN
    endif
    // The field status is modified to 'X' so that this record will not be
    // taken by any other threads.
    $sql = format("update EMP set status = 'X' where AUTOID = %d",$result.AUTOID)
    $stat = db.RunSQL($db,$sql)
    Unlock()
    ........
    ........


 Loop
Jumps to the while statement in a while - endwhile loop.
Parameters
None.
Remarks
  • Continue or Loop command will cause the execution of the script to check the next condition of the current While loop.

Example

while true
    $msg = GetMessage()
    if $msg = ""
        sleepevent
        // C,C++ programmers like the keyword "continue" here
        loop
    endif
    ;......
    ;......
endwhile


Random()

 $intNum = Random ( <number> )
    Returns a random number less than the given number.
Parameters
    <number> Any numeric value.
Return Value
    Returns an integer.
Example

$b = random(100)

  • $b will contain a number greater than or equal to 0 and less than or equal to 99.


 Reject
    Rejects incoming calls.
Parameters
    None
Remarks
  • Reject command normally works in digital telephone lines.
  • This command is useful for rejecting calls without attending them.
Example

MAIN:
    while $ring <= 0
    sleepevent 1000
    endwhile

    if $dli <> "3011000"
    reject
    goto MAIN

    endif
    answer 1
    play "welcome.wav"


Restart

    Restarts Xtend IVR from script.
Parameters
    None.
Remarks
  • None.
Example

MAIN:
    Answer 1

    if compare($time,"11:00:00") == 0
        display "Restart the system...."
        Restart
    endif

    Hangup
    Goto MAIN


Run

 Run < exe file >
or
 ! < exe file >
    The Run command executes the specified program.
Parameters
    <exe file> The name of the file to be executed.
Remarks
  • Run command can spawn only windows executable programs (EXE) files. You can pass command line arguments to these EXE programs. This EXE program can communicate with Xtend IVR script using the $varfile variable. Xtend IVR keeps all active variables in a text file and the name of the text file is available in variable $varfile. You can call the EXE program with this $varfile as its command line parameter like:
      RUN "myprogram.exe" $varfile
  • It is the programmer's responsibility to parse the variable file passed as a command line argument to his program. The modified variables are written back to the same file which will be loaded into the script after the termination of the program. Some of the system variables like $date, $time etc. are also available in the file in read-only mode. The programmer can also add new variables.
  • Normally, the $VarFile is added to the Run command so that the file containing the script variables is passed on to the program and the modified values can be reloaded. The program has to read in the script variables from the file, perform any processing and write the new values for the variables back to the file. After the program has been executed, the IVR will read in the lines from the $VarFile and update the values for the variables which can then be accessed in the script.
  • This is not normally recommended in large deployments due to heavy CPU usage. A medium configuration system of upto 8 channels is considerable.
  • The window of the child application may or may not appear depending upon the INI settings. The IVR script will wait for the child program to terminate. The termination code will be available from the variable $ExitCode. The script will stop its execution if the child program hangs up. In such a situation, a RUNTIMEOUT can be used to timeout the child program which will forcefully kill the child program and jump to ONRUNTIMEOUT label. But this is not recommended normally.
Example

:MAIN
    answer
    // external application timeout is set as 5 seconds
    runtimeout 5

    // calls windows notepad application
    // please ensure that the AppWindow option is enabled in xivr configuration (xivrcfg.exe)
    // If AppWindow option is disabled, you will not see the window of the application.
    $cmdline = format("%s\notepad.exe",fs.GetEnv("SystemRoot"))

    // start notepad and wait for 5 seconds.
    // You will see notepad terminating within 5 seconds
    run $cmdline $varfile
    MsgBox("Application closed by user")
    hangup
    goto MAIN

:ONRUNTIMEOUT
    MsgBox("Time expired. Application terminated.")
    hangup
    goto MAIN


RunTimeout

 RunTimeout( < seconds >)
    The RunTimeout command sets the timeout in seconds for any subsequent Run commands.
Parameters
    < seconds > Number of seconds allotted for the Run command to execute.
Remarks
  • If the external program takes up more time than allotted, then the program is terminated and an implicit GOTO command is executed to the label ONRUNTIMEOUT. If no such label exists, the IVR reports that the End of Script has reached and turns the LED red.
Example

:MAIN
    answer
    // external application timeout is set as 5 seconds
    runtimeout 5

    // calls windows notepad application
    // please ensure that the AppWindow option is enabled in xivr configuration (xivrcfg.exe)
    // If AppWindow option is disabled, you will not see the window of the application.
    $cmdline = format("%s\notepad.exe",fs.GetEnv("SystemRoot"))

    // start notepad and wait for 5 seconds.
    // You will see notepad terminating within 5 seconds
    run $cmdline $varfile
    MsgBox("Application closed by user")
    hangup
    goto MAIN

:ONRUNTIMEOUT
    MsgBox("Time expired. Application terminated.")
    hangup
    goto MAIN


Seconds()

 $sec = Seconds ( )
    Gives the time elapsed in seconds after the process has started.
Parameters
    None.
Return Value
    Returns time in seconds.
Remarks
  • This function tells the number of seconds the process has used up.
  • Seconds() function can be used to find the elapsed time at different locations in the script. For example, one can find the duration of a .wav file by calling the seconds() function before and after playing the file and their difference gives the value.
Example

:MAIN
    answer 1

    $start = seconds()
    play "bgmusic.wav"
    wait 0
    $stop = seconds()

    display "Duration " ($stop - $start)
    ;......
    ;......

    hangup
    goto MAIN


SetInfo()

 SetInfo ("<attribute>", <value>)
    Passes the value directly to the driver DLL to set the driver information.
Parameters

    <attribute> Attribute of the driver DLL.

    <value> Value of the attribute.

Example
    SetInfo("DIALCLI","1234567890")
  • Here, in a dial-out, the driver sets the caller-Id and displays it at the receiving end as "1234567890".
    SetInfo("AllowIncoming", false)
  • This setting will disable the incoming calls on that channel. All calls that arrive on that channel will be rejected. By Default, its true.

* In case of E1 card, channels in which "AllowIncoming" is set to false are not considered for accepting an incoming call. This is useful if you use, say 4 of the 30 channels, purely for dialing out or sending out faxes.


SetVariable()

 SetVariable ( <$variable>,<value> )
    Changes the scope of the variable from local to global and assigns value to all instances of the variable.
Parameters

    <$variable> The variable for which the value has to be assigned.

    <value> The value to assign.

Remarks
  • After declaration, you can access the value of anywhere from the script, using the variable <$variable>.
  • Useful in creating a variable and assigning values from inside a function.
Example
    SetVariable("$Acno",$AcNum)
  • Here, the scope of $AcNum is inside a function. Setting the value of $AcNum to $Acno will make $Acno accessible from anywhere inside the script.


Sleep

 Sleep <duration>
    Suspends the execution of the current script for a specified interval.
Parameters
    <duration> Sleep time in milliseconds for which the execution is suspended.
Example

//sleeps 5 seconds
Sleep 5000


SleepEvent

 SleepEvent [duration]
    Suspends the execution of the current script for a specified interval of time or until an event occurs.
Parameters
    [duration] Time in milliseconds for which the execution is suspended [optional].
Remarks
  • Similar to Sleep command except for the fact that any event causes the sleep to complete.
  • If the number of milliseconds is not specified, then the timeout is INFINITE and the waiting is suspended on firing an event.
  • Command works with all device notifications(ring, attend call, hangup call, keypress, call progress etc.) and also with putmessage, getmessage functions.
Example

Sleepevent 5000


UnEscape()

 $strUnescaped = UnEscape (<string>)
    Reverses the Escape() process, i.e., converts the string back from its percentage hexa form.
Parameters
    <string> The string to be unescaped.
Return Value
    Returns the converted string.
Remarks
  • None.
Example

$var = Escape("Hello World")
....
$result = UnEscape($var)


UnLock()

 UnLock ()
    Releases the last Lock().
Parameters
    None.
Return Value
    None.
Remarks
    Click here
See for Example


Integrate Plugins

Integrating Plugins

Xtend IVR facilitates to integrate other programs into it. Like all other scripting language, Xtend IVR also
uses variables to hold data. Unlike others, here the variables do not require a type declaration, as they are of
variant type in this scripting language. All variables start with a '$' character. For more information on variables,
click here.

In order to integrate with your application:

  1. Write a program that accepts a "filename" as command line argument.

  2. Prepare a text file in the following format to retrieve variable values:

$VarName value_of_the_variable

For example,
$EmployeeName William Smith
$EmployeeCode E3019

Here $EmployeeName, $EmployeeCode are all valid active Xtend IVR variables in the IVR script. The file
name would be given to your prepared application as the command line argument.

  3. You can parse, modify these variables, write back to the same text file and terminate your application.

  4. Xtend IVR will reload these updated variables from the text file to continue the execution of the
 script with the new values.

We will consider a sample instance to get a more detailed view of how your application works with the
Xtend IVR.

Assume that you have an application called ChkBal.exe written in any language. In Xtend IVR script, you
may call this (the script and the plugin names should not conflict at any rate), as a function:

$Balance = ChkBal ($account, $password)

Xtend IVR will invoke your application ChkBal.exe creating a temporary variable file c:\temp\0.var. The file
name c:\temp\0.var is automatically created by Xtend IVR to keep all the variables in ASCII format.

Your application gets this filename as a command line argument. It must open this file, parse it and identify
all active variables and their values. In the list of variables, your application will have $Balance, $account
and $password and numerous other active variables also.

Now in your application, please take note to include the following sections:

    1.  Open the database.

    2.  Check the account number (i.e., the value taken from variable $account).

    3.  Check the password (i.e., the value taken from variable $password).

    4.  If valid, take the balance of the account.

    5.  Modify the variable $balance with the actual balance.

    6.  Overwrite the temporary file with the new set of variables (c:\temp\0.var).

    7.  Close the database and terminate the application.

At this point, Xtend IVR will be waiting for your application to terminate. The moment it terminates,
Xtend IVR reloads the file c:\temp\0.var, updates its active variables with the new set of values and
resumes the execution of the script.

The above method is recommended only if you are doing very complicated operations on database such as
involving many tables and complicated queries.

Plugins using Scripting Languages

Once you evoke a _VBScript, _JavaScript or _PerlScript plugin from the IVR, the plugin variables maintain
their state through out that particular IVR script execution. Since they are cached in the buffer and are not
reloaded, an external modification of these plugin files in the middle of an IVR execution, will automatically
tamper the variable values with the effect of reloading the plugin script in each and every executing thread
wherever they are invoked.

In an IVR like balance enquiry, you can avoid writing an application to fetch data from the database. Instead you
can make use of the built-in _VBScript plug-ins shipped with Xtend IVR. This plug-in is invoked as:

FileName.FunctionName ()

For example to execute a query, you can call db.RunSQL() where db is a file called db.vbs and RunSQL() is function
defined in this file. You can also write your own plug-ins in _VBScript, _JavaScript, Perl Script, or in any
programming language.

DLLs in Visual Basic

In case of calling a function defined inside a classname of a DLL, say a DLL created in Visual Basic, the syntax
followed to invoke is:

DllName.ClassName.FunctionName ()

.Net Plugins

Similarly, to evoke a function described in a .Net language, the method of calling would be:

DotNetAssemblyName.ClassName.FunctionName ()

Given below is sample code to access database using built-in plug-ins:

//The ADO connect string for the database
$db = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=bankacc.mdb;User Id=admin; Password=;"

//Construct the SQL statement
$sql = format ("SELECT * FROM BANK WHERE AccNo = '%s'",$account)

//Invoke the query
$dbalias = db.RunSQL ($db, $sql)

If the above query execution is successful, it will create new variables as follows:
$dbalias.AccNo      23456
$dbalias.Password  1234556787453
$dbalias.Name       William Smith
$dbalias.Balance    25000

On successful query execution, the password is checked as shown below:
If compare ($dbalias.Password, $password) == 0
        // Yes. Password OK
Else
        // Sorry. Not a valid user
Endif

Thus Xtend IVR scripting language is flexible enough to support application in any language.


db.Open()

 $alias = db.Open ( "<connectionString>", "<query>")
    Establishes connection with the database and executes the query with the values populated into the dynamic variables.
Parameters
    <connectionString> ADO connection string or ODBC DSN
    <query> A valid SELECT query only

Return Value

    Returns a group variable.

Remarks

  • If your database connection insists on USERNAME and PASSWORD, then you have to mention "User Id=...;Password=...;" in the Connection string; no matter whatever connection you have, let it be ADO/ODBC.
  • Open() triggers the following actions:
    • Opens the database.
    • Executes the query.
    • Creates dynamic variables, if required.
    • Control returns to the main function.
  • The recordset object is a forwardOnlyCursor.
  • Open() is often clubbed with and followed by Skip().
  • It is recommended that each Open() returns the recordset to a separate alias name. For instance, let us consider the following statements:
      ............
............
$ret = db.Open($ConnStr,$sql1)
$ret = db.Open($ConnStr,$sql2)
............
............
    Here, the recordset returned by $sql1 will close itself when it comes across the second Open() returned by $sql2, because the recordset returned by $sql2 is stored in the same $ret group variable.
  • LHS variable is necessary and compulsory for the proper functioning of all database functions. Hence, the following loop statement will generate $error variable:
      while db.RunSQL($ConnStr,$sql)
...........
endwhile
  • It is recommended that you keep the connection string in a global variable at the beginning of the script to improve efficiency. Xtend IVR keeps a pool of connection objects and recordset objects to minimize resource usage.
Example
    :MAIN
    display "Waiting for call"
    answer

    $Provider= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Product.mdb;Persist Security Info=False"

    display "Displaying records from the table"
    $alias = db.Open($Provider,"SELECT * FROM Product")

    while $alias.eof = FALSE
        display $alias.id $alias.product $alias.productName
        sleep 1000
        $alias = db.Skip()
    endwhile

    Display "End of the table"

    $alias = db.Close()
    hangup
    goto MAIN

    :ONSYSTEMERROR
        hangup
        MsgBox($error)
        log $error
        $alias = db.close()
        goto MAIN
  • In the script, an ADO connection is established with the database "Product.mdb". The records are displayed by executing the Select query in Open(). The first record appropriate for the query given, is returned and stored in dynamic variables through $alias. Values in the record are accessed as $alias.id, $alias.product and $alias.productName where id, product and productName are the fields in the table "Product". To move forward and populate the next record, we use Skip(). This continues until End of file is reached.


db.Close ()

 $alias = db.Close ()
    Closes the active database connection.
Parameters
    None.

Return Value

    Returns 1 if successful, else returns 0.

Remarks

  • The operation of the plugin solely depends on the LHS variable which should be the same as that in Open(). The plugin ends up that particular database connection which populated the records into the group variable. Hence each Open() should be followed by a Close().
    •
  • LHS variable is necessary and compulsory for the proper functioning of all database functions. Hence, the following loop statement will generate $error variable:
      while db.RunSQL($ConnStr,$sql)
...........
endwhile

See for Example


db.RunSQL ()

 $intNum = db.RunSQL ( "<connectionString>","<query>")
    Establishes connection with the database and executes the query.
Parameters
    <connectionString> ADO connection string or ODBC DSN.
    <query> Any standard SQL query.
Return Value
    Returns 1 if successful, else 0.
Remarks
  • If your database connection insists on USERNAME and PASSWORD, then you have to mention "User Id=...;Password=...;" in the Connection string; no matter whatever connection you have, let it be ADO/ODBC.
  • RunSQL() is a stand-alone function that triggers the following actions:
    • Opens the database.
    • Executes the query.
    • Creates dynamic variables, if required.
    • Closes the recordset.
    • Control returns to the main function.
  • To traverse through the recordset, use db.Skip() along with db.Open() instead of db.Runsql().
  • It is recommended that each RunSQL() returns the recordset to a separate alias name. If you are using the same variable for two different database operations, then the former one will be automatically closed for the latter. For instance, let us consider the following statements:
      ............
............
$db= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Student.mdb;Persist Security Info=False"
$alias = db.RunSQL($db,"Select * from EMP")
MsgBox($alias)
//$alias, at this point, forms a group variable for EMP and returns 1
$alias = db.RunSQL($db,"Select * from PAYROLL")
MsgBox($alias)
//$alias, at this point, forms a group variable for PAYROLL and returns 1 (EMP is closed and the variables will be blank)
............
............
  • LHS variable is necessary and compulsory for the proper functioning of all database functions. Hence the following loop statement will generate $error variable:
      while db.RunSQL($ConnStr,$sql)
...........
endwhile
  • It is recommended that you keep the connection string in a global variable at the beginning of the script to improve efficiency. Xtend IVR keeps a pool of connection objects and recordset objects to minimize resource usage.
Example
    :MAIN
    display "Waiting for call"
    answer

    $Provider= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Student.mdb;Persist Security Info=False"
    $sql = "INSERT INTO Mark(Rollno, Name, Mark) VALUES (105,'Raj',89)"

    $num = db.RunSQL($Provider,$sql)
    MsgBox(concat($num," Records added"))

    hangup
    goto MAIN

:ONSYSTEMERROR
    hangup
    MsgBox($error)
    log $error
    goto MAIN
  • In the script, an ADO connection is established with the database "Student.mdb". Using RunSQL(), one record is inserted in to the table "Mark", which returns 1 into $num.


db.Skip ()

 $alias = db.Skip ()
    Populates the values of the succeeding record into dynamic variables after advancing the record pointer.
Parameters
    None.

Return Value

    Returns 1 if successful, else 0.

Remarks

  • Skip() functions in the following manner:
    • Skips to the next record in the previously populated recordset object created by db.Open.
    • Creates dynamic variables, if required.
    • Control returns to the main function.
  • The plugin should be preceeded by an Open().
  • Operation of the plugin solely depends on the LHS variable which should be the same as that in Open().
  • Only the errors pertaining to the syntax will be directed to the ONSYSTEMERROR. All other errors will return FALSE by setting the $error variable.
    •
  • LHS variable is necessary and compulsory for the proper functioning of all database functions. Hence the following loop statement will generate $error variable:
      while db.RunSQL($ConnStr,$sql)
...........
endwhile
Example
    :MAIN
    display "Waiting for call"
    answer

    $Provider= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Product.mdb;Persist Security Info=False"

    display "Displaying records from the table"
    $alias = db.Open($Provider,"SELECT * FROM Product")

    while $alias.eof = FALSE
        display $alias.id $alias.product $alias.productName
        sleep 1000
        $alias = db.Skip()
    endwhile

    Display "End of the table"

    $alias = db.Close()
    hangup
    goto MAIN

    :ONSYSTEMERROR
        hangup
        MsgBox($error)
        log $error
        $alias = db.close()
        goto MAIN
  • In the script, an ADO connection is established with the database "Product.mdb". The records are displayed by executing the Select query in Open(). The first record appropriate for the query given, is returned and stored in dynamic variables through $alias. Values in the record are accessed as $alias.id, $alias.product and $alias.productName where id, product and productName are the fields in the table "Product". To move forward and populate the next record, we use Skip(). This continues until End of file is reached.


AddDay()

 $newDt = Date.AddDay ("<date>", <n>)
    Adds or subtracts n days to the specified date.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
    <n> Number of days as a positive or negative integer.
Return Value
    New date is returned.
Example

$sdate = "20/11/2005"
$ret = date.AddDay ($sdate, 5)
  • $ret contains 25/11/2005.


AddMonth()

 $newDt = Date.AddMonth ("<date>", <n>)
    Adds or subtracts n months to the given date.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
    <n> Number of months as a positive or negative integer.
Return Value
    New date is returned.
Example

$sdate = "20/11/2005"
$ret = date.AddMonth ($sdate, 5)
  • $ret contains 20/4/2006.


AddYear()

 $newDt = Date.AddYear ("<date>", <n>)
    Adds or subtracts n years to the given date.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
    <n> Number of years as a positive or negative integer.
Return Value
    New date is returned.
Example

$sdate = "20/11/2005"
$ret = date.AddYear ($sdate, -5)
  • $ret contains 20/11/2000.


Cmp()

 $Diff = Date.Cmp ("<date1>", "<date2>")
    Returns the number of days between 2 dates.
Parameters
    <date1> Any valid date expression in dd/mm/yyyy format.
    <date2> Any valid date expression in dd/mm/yyyy format.
Return Value
    Returns
    • 0, if both the dates are equal.
    • Negative integer, if the first date is greater than the second date.
    • Positive integer, if the first date is lesser than the second date.
    • An <Empty string> "" in case of error and sets $error.
Remarks
  • Similar to DateDiff function in VB Script.
Example

$sdate = "12/07/2004"
$edate = "16/07/2004"
$ret = date.Cmp($sdate, $edate)
  • $ret contains 4.


Convert()

 $strFormat = Date.Convert ("<date>", "<source format>", "<target format>")
    Formats the given date expression according to the specified format.
Parameters
    <date> Any valid date expression.
    <source format> The format of the given date. Separators are optional. Valid separators are ".", "/", " " and "-".
    <target format> The format into which the given date is to be converted.
Return Value
    Returns the formatted date.
Remarks
    None.
Example

//Japan style
$today = Date.Convert($date, "DDMMYYYY", "YYYYMMDD")


GetCDay()

 $strDay = Date.GetCDay ("<date>")
    Fetches the real name of the day in the given date expression.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
Return Value
    Returns a string representing the day of the week such as Sunday, Monday etc.
Example

$ret = date.GetCDay ("17/10/2005")
  • $ret contains Monday.


GetCMonth()

 $strMonth = Date.GetCMonth ("<date>")
    Returns the name of the month in the given date expression.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
Return Value
    Returns a string representing the name of the month.
Example

$ret = date.GetCMonth ("17/10/2005")
  • $ret contains October.


GetDay()

 $intDay = Date.GetDay ("<date>")
    Returns an integer representing the day in the given date expression.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
Return Value
    Returns an integer between 1 and 31.
Remarks
  • Similar to Day function in VB Script.
Example

$ret = date.GetDay ("17/10/2005")
  • $ret contains 17.


GetMonth()

 $intMonth = Date.GetMonth ("<date>")
    Returns the month of the year in the given date expression.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
Return Value
    Returns an integer between 1 and 12.
Remarks
    Similar to Month function in VB Script.
Example

$ret = date.GetMonth ("17/10/2005")

  • $ret contains 10.


GetSystemFormat()

 $strFormat = Date.GetSystemFormat ( )
    Retrieves the system date format.
Parameters
    None.
Return Value
    Returns the system date format as DDMMYYYY, MMDDYYYY or YYYYMMDD.
Remarks
    None.
Example

$today = Date.GetSystemFormat()


GetYear()

 $intYear = Date.GetYear ("<date>")
    Returns the year from the given date expression.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
Return Value
    Returns an integer representing the year.
Remarks
  • Similar to Year function in VB Script.
Example

$ret = date.GetYear ("17/10/2005")

  • $ret contains 2005.


IsLeapYear()

 $bool = Date.IsLeapYear ("<date>")
    Checks whether a given year is leap year or not.
Parameters
    <date> The date to be checked.
Return Value
    Returns 1 if it is a leap year, else returns 0.
Example

$sdate = "20/11/2000"
$ret = date.IsLeapYear($sdate)
  • $ret contains 1.


IsValid()

 $bool = Date.IsValid ("<date>")
    Checks the validity of a given date.
Parameters
    <date> Any valid date expression in dd/mm/yyyy format.
Return Value
    Returns 1 if date is valid, else returns 0.
Example

$sdate = "35/16/2000"
$ret = date.IsValid($sdate)
  • $ret contains 0.


Copy()

 $bool = Fs.Copy ("<source>", "<destination>")
    Copies a file to another location.
Parameters
    <source> Relative or absolute path of the original file.
    <destination> Relative or absolute path or filename of the target file.
Return Value
    Returns 1 if successfully copied, else returns 0.
Remarks
  • Only a copy is passed to the destination, the original file remains in the source location.
  • If the full path of either the source file or the destination file is not specified, it searches or copies to the location containing the script.
Example

$src = "C:\Plugins\Source.doc"
$dest = "Destination.doc"
$ret = fs.Copy ($src, $dest)
  • $ret contains 1.


CreateFolder()

 $bool = Fs.CreateFolder ("<path>")
    Creates a folder and returns a new Folder object representing that folder.
Parameters
    <path> Path and name of the folder to be created.
Return Value
    Returns 2 if created successfully, 1 if folder already exists, or 0 if failed to create.
Remarks
  • If folder name is specified in the format ".\foldername", without giving the full path, it creates the folder in the current location of the script.
  • If folder name is specified in the format "\foldername", it creates the folder in the drive where the script is running.
Example

$src = "C:\Plugins\Time"
$ret = fs.CreateFolder ($src)
  • $ret contains 1.


CreateUnique()

 $strPath = Fs.CreateUnique ("<path>")
    Dynamically creates and returns a system-generated temporary filename in the specified path.
Parameters
    <path> The path where the temporary file should be created.
Return Value
    If successful, returns a string representing the newly created temporary filename along with the path, else returns an empty string.
Remarks
  • If no path is specified then the .tmp file is created in the active IVR script folder.
  • Folders with relative or absolute paths are also acceptable.
Example

$s = "C:\Plugins\fs\"
$ret = fs.CreateUnique ($s)
  • $ret contains C:\Plugins\fs\radF6D89.tmp.


Delete()

 $bool = Fs.Delete ("<filename>")
    Permanently deletes an existing file.
Parameters
    <filename> The file to be deleted.
Return Value
    Returns 1 if successfully deleted, else returns 0.
Remarks
  • It deletes the file completely and permanently from the system. It cannot be retrieved even from the recycle bin.
Example

$src = "C:\Plugins\Delete.doc"
$ret = fs.Delete ($src)
  • $ret contains 1.


GetEnv()

 $strValue = Fs.GetEnv ("<envVar>")
    Retrieves the value of the given environment variable.
Parameters
    <envVar> The system environment variable.
Return Value
    Returns a string.
Example

$ret = fs.GetEnv ("windir")
  • $ret contains C:\Windows.


GetFileInfo()

 $variable = Fs.GetFileInfo ("<fileName>")
    Provides information about all the properties and attributes of the file.
Parameters
    <fileName> The file from which the details have to be obtained.
Return Value
    Returns 1 if successful, else returns 0 and sets $error.
Remarks
  • A value of 0 for a particular attribute indicates that no flag is set.
  • The file attributes include:
    • attrib.archive: Returns 1 if the file is set as archive.
    • attrib.compressed: Returns 1 if the file is compressed.
    • attrib.hidden: Returns 1 if the file is hidden.
    • attrib.readonly: Returns 1 if the file is set as read only.
    • attrib.shortcut: Returns 1 if the file is set as shortcut.
    • attrib.path: The full path of the file.
    • attrib.size: The size of the file in Bytes.
    • attrib.system: Returns 1 if the system attribute is set.
    • date.created: The date on which the file was created.
    • date.modified: The date on which the file was last modified.
    • time.created: The time in which the file was created.
    • time.modified: The time in which the file was last manipulated.
    •
Example

$src = "C:\Plugins\fs\GetFileInfo.htm"
$ret = fs.GetFileInfo ($src)
Some of the values contained in the $ret group variable are:
    $ret.attrib.path		C:\Plugins\fs\GetFileInfo.htm
$ret.attrib.size		2312
$ret.attrib.readonly	1
$ret.attrib.hidden	0
$ret.date.created	10/26/2005
$ret.date.modified	10/21/2005


IsFile()

 $bool = Fs.IsFile ("<filename>")
    Checks the existence of a particular file.
Parameters
    <filename> The file to be checked.
Return Value
    Returns 1 if the file exists, else returns 0.
Remarks
  • If full path of the file is specified then it checks for the file in that location.
  • If only the filename is specified then the plugin searches for it in the folder of the currently running script.
Example
    $file = "C:\Plugins\IsFile.htm"
$ret = fs.IsFile ($file)
  • $ret contains 1.


IsFolder()

 $bool = Fs.IsFolder ("<folderName>")
    Checks for the existence of a particular folder.
Parameters
    <folderName> The name of the folder to be checked.
Return Value
    Returns 1 if the folder exists, else returns 0.
Remarks
  • If full path is indicated, then it checks for the folder in that location.
  • If only the folder name is mentioned then it checks for it in the current location containing the script.
Example

$src = "C:\Plugins\Time"
$ret = fs.IsFolder ($src)
  • $ret contains 1.


Move()

 $bool = Fs.Move ("<source>", "<destination>")
    Moves the file from its current location.
Parameters
    <source> The file to be moved.
    <destination> Path to which the file should be moved.
Return Value
    Returns 1 if successfully moved, else returns 0.
Remarks
  • The file or data gets transferred to the destination stipulated without leaving a copy in the source file.
  • If full path of either the source file or the destination file is not given, it searches only in the location of the current script.
Example

$src = "C:\Plugins\Source.htm"
$dest = "Destination.htm"
$ret = fs.Move ($src, $dest)
  • $ret contains 1.


SetAttrib ()

 $bool = Fs.SetAttrib ("<fileName>", "<attribute>")
    Sets or returns the file's attribute.
Parameters
    <fileName> Path of the file.
    <attribute> Attribute of the file.
Return Value
    Returns 1 if the attribute is successfully set, else returns 0.
Remarks
  • Expected parameters to set the particular attribute are:
    • N+, +N, N- or -N for Normal
    • R+, +R, R- or -R for Read-only
    • H+, +H, H- or -H for Hidden
    • S+, +S, S- or -S for System
    • A+, +A, A- or -A for Archive
Example

$src = "C:\Plugins\fs\file.txt"
$stat = fs.SetAttrib ($src,"R+")
  • $stat contains 1.


ShortName()

 $strName = Fs.ShortName ("<path>")
    Returns a unique shortname of the given file/folder used by programs that require 8.3 naming convention.
Parameters
    <path> The path of the file/folder.
Return Value
    If successful, returns a string, else returns an empty string.
Remarks
  • The property is read-only.
  • Folders with relative or absolute paths are also acceptable.
Example

$s = "C:\Interactive Voice Response System\IVRS file 34\"
$ret = fs.ShortName($s)
  • $ret contains C:\INTERA~1\IVRSFI~1.


Start()

 $bool = Fs.Start ("<appName>", "<modeSync>")
    Spawns an application from the IVR script.
Parameters
    <appName> Application name.
    <modeSync> Mode of synchronization: blocking (modeSync=TRUE) and non-blocking (modeSync=FALSE).
Return Value
    Returns TRUE if successful, else returns FALSE.
Remarks
  • For modeSync TRUE, the IVR script gets blocked; the function waits for the application to complete before it proceeds further. On the other hand, when modeSync is FALSE the function returns immediately and resumes the script execution on initiating the application; the function is not blocked by any other program execution.
Example

$src = "C:\ivr\File.txt"
$status = fs.Start ($src,TRUE)
  • $status contains 1. Here, the function calls notepad.exe with "c:\ivr\File.txt" as its argument and waits for the notepad to exit.


GetMail ()

 $bool = GetMail ( [ "$email" ] )
    To fetch an email from the POP3 server.
Parameters
    [ "$email" ] This user specified optional argument is the name of the "Group Variable", if not, "$email" is assumed.
Return Value
  • 1, if the mail is fetched successfully, else 0.
Remarks
  • Another method of executing this plugin is "GetMail()", then the variable $email is assumed to be the default "Group variable" argument.
  • $email.count gives the total number of mails in the email account provided the value of $email.msgno is zero.
  • Mail can be deleted by calling GetMail() after setting the value of $email.delete to any of the values 1,Y,YES or TRUE. The message specified by $email.msgno will be deleted from the email account.
  • All mails are fetched from the POP server.
  • Default Port Address of the POP server (Default :110) is automatically taken if $email.port is not specified by the user.
  • Since Mails are fetched from POP server, IP address should be precisely stated.
  • [ "$email" ] is of user defined type. Say, if it is given as $Variable, then the Group Variables will be $Variable.to, $Variable.body, $Variable.from etc.
  • $email.errno is the Error no. returned by the POP3 server.
    Group variables are:
    Variable | Description
    $email.pop | IP Address of the POP server. E.g. "192.168.1.1".
    $email.port | (Optional )Default (i.e. "110") Port Address of the POP server.
    $email.user | User name for authentication.
    $email.pass | User password for authentication.
    $email.msgno | Message number to be retrieved from the account. Given "$email.msgno = 3" would fetch the third message.
    $email.nooflines | Number of lines in a message.
    $email.delete | If this variable is set to any of the values 1,Y,YES or TRUE, the message specified by $email.msgno will be deleted from the email account.
    $email.count | Total number of messages in the email account.
    $email.raw | Contains the raw data of the mail specified by $email.msgno.
    $email.size | Size of the mail in bytes.
    $email.headers | Header of the mail.
    $email.subject | Subject of the mail, if any.
    $email.from Sender's address. This variable contains the name and email-ID of the person sending the mail.
    E.g. ""Allen Samuel"<Allensam@hotmail.com""
    $email.mailfrom | Contains only the mail-ID of the sender. E.g. Allensam@hotmail.com
    $email.to Email-ID of the user or the recipient. This variable contains the name and email-ID of the person who receives the mail.
    E.g. ""Neil Jacobsonl"<jacobsonneil@hotmail.com""
    $email.mailto | Contains only the Email-ID of the recipient. E.g: jacobsonneil@hotmail.com
    $email.cc | Names, if any, and Email addresses to which " Carbon Copies " of the mail has been sent. That is, the recipient has a provision to know to who all the mail has been sent.
    $email.mailcc | Contains only the Email addresses to which "Carbon Copies" of the mail has been sent.
    $email.bcc | Names, if any, and Email addresses to which "Blind Carbon Copies" of the mail has been sent, provided it is given in the raw data by the POP server.
    $email.mailbcc | Email addresses to which "Blind Carbon Copies" of the mail has been sent, provided it is there in the raw data.
    $email.date | Contains the date and time with the standard deviation from GMT.
    email.maildate | Contains the date in ddmmyyyy format. E.g. 05 Feb 2003.
    $email.mailtime | Contains only the time.
    $email.gmtdiff | Contains the difference in time with the GMT.
    $email.body | Content of the mail.
    $email.errno | Returns the Error no. if the mail could not be fetched.
    $email.error | Specifies the error when GetMail() fails. Its content will be same as that of $Error.
Example
    $Variable = GetMail()

or

$Variable = GetMail ( " $email" )


http

 $bool = Http ( < URL >, [PostData] )
    Downloads resources from the internet.
Parameters
    < URL > Address of the specified resource in the internet.
    < PostData > If specified, http() performs a POST operation, else it performs a GET.
Return Value
  • If operation is successful, it returns 1. The resulting page is available in $http.Page. It returns 0, if operation fails and the actual error is listed in $Error.
Remarks
  • The resource downloaded is always saved to the $http variable.
  • For advanced settings check the following:
      $http.SSL | Default is 0. If 1, then SSL mode is enabled.
      $http.Port | Default is 80. If set, then use that port.
      $http.Timeout | Default is 20 sec. If set, then use this timeout.
      $http.Headers | Default is "". Send these http headers also.
Example
    :MAIN
    answer 3

    .............
    .............
    $URL = concat("http://202.54.16.146/servlet/olsBookingStatusServlet?txtPNR=",$PNRNo)
    $stat = Http($URL)
    ..............
    ..............

:ONSYSTEMERROR
    log $Error
    wait 0
    Hangup
    goto MAIN

:ONHANGUP
    goto MAIN


Pipe()

 $bool = Pipe ( <path>, "<$variable>" )
    Invokes console based application and populates the result into a variable array.
Parameters
    <path> Path of the console based application.
    <$variable> Variable array into which the outcome is populated.
Return Value
    Returns 1 if successful, else returns 0.
Example

:MAIN
    answer 1

    ;........
    ;........

    $stat = Pipe("c:\Windows\system32\ipconfig.exe","$file")
    if $stat == 1
        $index = reversefind($file.line.8," ")
        if $index != -1
            $localip = mid($file.line.8,$index)
            display $localip
        endif
    endif

    ;........
    ;........

    hangup
    goto MAIN
  • Here, ipconfig.exe is invoked to retrieve the local IP address. The outcome written into the console is directed to a variable array viz., $file.


SMTP

 smtp.xp
Xtend IVR includes a flexible SMTP plugin (smtp.xp) that enables the user to send e-mails / attachments via Gmail or other SSL / authenticated servers.
  • Supports SMTP protocol
  • Supports SSL / TLS security
  • Supports POP3, PLAIN, LOGIN and CRAM-MD5 authentication standards for smtp
  • High level functions to send raw, text or html e-mail
  • Low level functions to construct an e-mail with multiple attachments / raw content
  • Ability to send attachments
  • On error, $error contains error string
The list of supported functions include:
  1. smtp.SetSSL()
  2. smtp.SetHeloId()
  3. smtp.Connect()
  4. smtp.Login()
  5. smtp.SendTextMail()
  6. smtp.SendHtmlMail()
  7. smtp.SendRawMail()
  8. smtp.Close()

Low level functions to construct an e-mail:

Using this approach, the different aspects of an e-mail like 'To', 'From', 'Body', 'Attachment', etc. are set separately using the individual 'Set' functions and the e-mail is send using Sendmail(). The low level functions include:
  1. smtp.SendMailFrom()
  2. smtp.SendRcptTo()
  3. smtp.SetTextMail()
  4. smtp.SetHtmlMail()
  5. smtp.SetRawMail()
  6. smtp.AddHeader()
  7. smtp.AddAttachment()
  8. smtp.SendMail()
    9.


smtp.SetSSL()

 smtp.SetSSL (<Type>)
    This function is used to set the type of connection.
Parameters
    <Type> The type of connection.

    • 0 - None
    • 1 - Use TLS on Connect
    • 2 - Use StartTLS
Return Value
    None.


smtp.SetHeloId()

 smtp.SetHeloId (<String>)
    This function is to set a Hello Id to identify the client.
Parameters
    <String> The value of the string.
Return Value
    None.


smtp.Connect()

 $Status = smtp.Connect (<Server>,<Port>)
    This function is used to connect to SMTP Server.
Parameters
    <Server> Specifies the address of SMTP Server.

    <Port> Specifies the port number. The default port for connection is 25.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.Login()

 $Status = smtp.Login (<User>, <Pass>, <Method>)
    This function provides login information of the user.
Parameters
    <User> Represents the Username.

    <Pass> Represents the Password.

    <Method> POP3, PLAIN, LOGIN and CRAM-MD5 authentication standards.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.SendTextMail()

 $Status= smtp.SendTextMail (<From>, <To>, <Subject>, <Text>)
    This is a high level function which allows to set From, To, Subject, Text and also allows to send text mail in a single function.
Parameters
    <From> Denotes the address of the sender.

    <To> Denotes the address of the recipient.

    <Subject> Denotes the subject of the e-mail.

    <Text> Denotes the content of the e-mail in text format.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.SendHtmlMail()

 $Status= smtp.SendHtmlMail (<From>, <To>, <Subject>, <Html>)
    This is a high level function which allows to set From, To, Subject, HTML mail and also allows to send the HTML mail in a single function.
Parameters
    <From> Denotes the address of the sender.

    <To> Denotes the address of the recipient.

    <Subject> Denotes the subject line of the message being sent.

    <Html> Denotes the content of the e-mail in Html format.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.SendRawMail()

 $Status= smtp.SendRawMail (<From>, <To>, <RawData>)
    This is a high level function which allows to set From, To, raw message and also allows to send raw e-mail in a single function.
Parameters
    <From> Denotes the address of the sender.

    <To> Denotes the address of the recipient.

    <RawData> Denotes the raw data to be sent.

Return Value
    Function returns 1 on success, 0 on failure.


 smtp.Close()
    This function is used to close the connection and terminate the smtp session.
Return Value
    None.


smtp.SendMailFrom()

 $Status = smtp.SendMailFrom (<From>)
    This function allows to set the "From" address.
Parameters
    <From> Denotes the address of the sender.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.SendRcptTo()

 $Status = smtp.SendRcptTo (<To>)
    This function allows to set the recipient address. To include more recipients call the function multiple times.
Parameters
    <To> Denotes the address of the recipient.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.SetTextMail()

 $Status= smtp.SetTextMail (<From>, <To>, <Subject>, <Text>)
    This function is used to set text messages in e-mail.
Parameters
    <From> Denotes the sender's address.

    <To> Denotes the recipient's address.

    <Subject> Denotes the subject line of the e-mail message.

    <Text> Denotes the content of the e-mail in text format.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.SetHtmlMail()

 $Status= smtp.SetHtmlMail (<From>, <To>, <Subject>, <Html>)
    This function is used to set Html messages in e-mail.
Parameters
    <From> Denotes the sender's address.

    <To> Denotes the recipient's address.

    <Subject> Denotes the subject line of the e-mail message.

    <Html> Denotes the content of the e-mail in Html format.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.SetRawMail()

 $Status= smtp.SetRawMail (<RawData>)
    This function is used to set an e-mail message with raw content.
Parameters
    <RawData> Denotes the raw data to be sent.

Return Value
    Function returns 1 on success, 0 on failure.


smtp.AddHeader()

 $Status = smtp.AddHeader (<Tag>, <Value>)
    This function allows to add a header to the e-mail body.
Parameters
    <Tag> Denotes the different parameters that can be set as header.

    <Value> Denotes the parameter's value of the tag.
Return Value
    Function returns 1 on success, 0 on failure.


smtp.AddAttachment()

 $Status= smtp.AddAttachment (<File>, <Name>, [MimeType])
    This function allows to add an attachment to the e-mail body.
Parameters
    <File> Specifies the exact path of the file.

    <Name> Specifies the file name.

    [MimeType] Represents the mime type on the basis of provided file. This is an optional parameter.

    To include more attachments, call the function multiple times.

Return Value
    Function returns 1 on success, 0 on failure.


smtp.SendMail()

 $Status = smtp.SendMail ()
    This function is used to send an e-mail.
Return Value
    Function returns 1 on success, 0 on failure.


 Sample Script

    The sample given below is an example to send an e-mail using 'smtp.SendTextMail' functionality:

    ;SMTP Account Details
    $ServerName = "smtp.gmail.com"
    $Port = "465"

    ;Login Details
    $Username = "abc@gmail.com"
    $Password = "12345"
    $Method = "LOGIN"

    ;Mail contents
    $To = "xyz@gmail.com"
    $From = "abc@gmail.com"
    $Subject = "Testing SendTextMail"
    $Body = "This is a Sample Text"

    MAIN:
    Display "Waiting to send mail..."
    Answer 1

    ;1=Use TLS on SMTP Connect
    smtp.SetSSL(1)

    ;Connecting to Server
    Display "Connecting server..."
    $Status = smtp.Connect($ServerName,$Port)
    if $Status <> 1
    Display "Connection Failed.."
    log "Connection Failed " $error
    hangup
    Goto Main
    endif

    ;Login to Server
    Display "Login to server..."
    $Status = smtp.Login($Username,$Password,$Method)
    if $Status <> 1
    Display "Login Failed.."
    log "Login Failed " $error
    hangup
    Goto Main
    endif

    ; Sending Mail
    Display "Sending Mail..."
    $StatusSendText = smtp.SendTextMail($From,$To,$Subject,$Body)
    if $StatusSendText <> 1
    Display "Sending Failed.."
    log "Sending Failed " $error
    endif

    ;Closing Connection
    Display "Closing connection..."
    smtp.close()

    hangup
    Goto MAIN

    * User has hung up
    ONHANGUP:
    hangup
    goto MAIN

    * Time allowed for user is over
    ONTIMEOUT:
    ONRUNTIMEOUT:
    hangup
    goto MAIN

    * An error has occurred
    ONSYSTEMERROR:
    log $error
    display $error
    if $debug
    msgbox($error)
    endif
    hangup
    goto MAIN


POP3

 pop3.xp
Xtend IVR includes a flexible pop3 plugin (pop3.xp) that enables the user to retrieve e-mails / attachments via Gmail or other SSL / authenticated servers.
  • Supports pop3 protocol.
  • Default port address of the pop3 server is 110.
  • If any error occurs, then the $error contains the error string.
  • It supports StartTLS command and pop3 to switch to secure socket.
The list of supported functions include:
  1. pop3.SetSSL()
  2. pop3.Connect()
  3. pop3.Login()
  4. pop3.GetCount()
  5. pop3.GetTotalSize()
  6. pop3.FetchMail()
  7. pop3.GetAttachmentCount()
  8. pop3.FetchAttachment()
  9. pop3.GetAttachmentType()
  10. pop3.GetAttachmentName()
  11. pop3.GetAttachmentSize()
  12. pop3.SaveAttachment()
  13. pop3.GetBody()
  14. pop3.GetMail()
  15. pop3.GetMailSize()
  16. pop3.FetchHeader()
  17. pop3.GetHeader()
  18. pop3.GetField()
  19. pop3.DeleteMail()
  20. pop3.Close()


pop3.SetSSL()

 pop3.SetSSL (<Type>)
    This function is used to set the type of connection.
Parameters
    <Type> The type of connection.

    • 0 - None
    • 1 - Use TLS on Connect
    • 2 - Use StartTLS
Return Value
    None.


pop3.Connect()

 $Status = pop3.Connect (<Server>,<Port>)
    This function is to establish a connection to pop3 Server.
Parameters
    <Server> Specifies the address of pop3 Server.

    <Port> Specifies the port number. The default port for pop3 server is 110.
Return Value
    Function returns 1 on success, 0 on failure.


pop3.Login()

 $Status = pop3.Login (<User>,<Pass>)
    This function provides login information of the user.
Parameters
    <User> Represents the Username.

    <Pass> Represents the Password.

Return Value
    Function returns 1 on success, 0 on failure.


pop3.GetCount()

 $Count = pop3.GetCount()
    This function is used to get the count of e-mails to be fetched from the server.
Return Value
    Function returns an integer value.


pop3.GetTotalSize()

 $Size = pop3.GetTotalSize()
    This function is used to get the overall size of the e-mails which has to be fetched from the server.
Return Value
    Function returns an integer value.


pop3.FetchMail()()

 $Status = pop3.FetchMail (<MailNo>)
    This function is used to fetch an e-mail based on e-mail number.
Parameters
    <MailNo> Specifies the e-mail number.
Return Value
    Function returns 1 on success, 0 on failure.


pop3.GetAttachmentCount()

 $Count = pop3.GetAttachmentCount()
    This function is used to get the number of attachments in the last fetched e-mail.
Return Value
    Function returns an integer value.


pop3.FetchAttachment()

 $Status = pop3.FetchAttachment (<AttachmentNo>)
    This function is used to fetch the attachment from the server on the basis of attachment number.
Parameters
    <AttachmentNo> Specifies the serial number of the attachment.
Return Value
    Function returns 1 on success, 0 on failure.


pop3.GetAttachmentType()

 $Type = pop3.GetAttachmentType()
    This function is used to get the type of the last fetched attachment.
Return Value
    Function returns a string.


pop3.GetAttachmentName()

 $Name = pop3.GetAttachmentName()
    This function is used to get the name of the last fetched attachment.
Return Value
    Function returns a string.


pop3.GetAttachmentSize()

 $Size = pop3.GetAttachmentSize()
    This function is used to get the size of the last fetched attachment.
Return Value
    Function returns an integer.


pop3.SaveAttachment()

 $Status = pop3.SaveAttachment (<Name>)
    This function is used to save an attachment.
Parameters
    <Name> Specifies the name by which the attachment is saved at the time of download.
Return Value
    Function returns 1 on success, 0 on failure.


 pop3.GetBody()
    This function is used to get the e-mail body of the last fetched e-mail from the pop3 server.
Return Value
    Function returns raw data.


 pop3.GetMail()
    This function is used to get the last fetched e-mail from the pop3 server.
Return Value
    Function returns raw data.


pop3.GetMailSize()

 $Status = pop3.GetMailSize (<MailNo>)
    This function is to get the size of the specific e-mail.
Parameters
    <MailNo> Specifies the e-mail number.
Return Value
    Function returns an integer value.


pop3.FetchHeader()

 $Status = pop3.FetchHeader (<MailNo>)
    This function is used to fetch the header of an e-mail based on the e-mail number.
Parameters
    <MailNo> Specifies the e-mail number.
Return Value
    Function returns 1 on success, 0 on failure.


 pop3.GetHeader()
    This function is used to get the header part of the last fetched e-mail from the pop3 server.
Return Value
    Function returns raw data.


pop3.GetField()

 $Status = pop3.GetField (<HeaderField>)
    This function is used to get the header fields of the last fetched e-mail.
Parameters
    <HeaderField> Specifies the header field.
Return Value
    Function returns a string.


pop3.DeleteMail()

 $Status = pop3.DeleteMail (<MailNo>)
    This function is used to delete an e-mail.
Parameters
    <MailNo> Specifies the e-mail number.
Return Value
    Function returns 1 on success, 0 on failure.


 pop3.Close()
    This function is used to close the connection with the server. Once the function is opened, it has to be closed using this function.
Return Value
    None.


 Sample Script

    The sample given below is an example to receive an e-mail using pop3 functionality:

    ;POP Account Details
    $ServerName = "pop.gmail.com"
    $Port = "995"

    ;Login Details
    $Username = "abcde@gmail.com"
    $Password = "123456"

    MAIN:

    Answer 1

    ;1=Use TLS on POP3 Connect
    pop3.SetSSL(1)

    ;Connecting to Server
    $ConnectStatus = pop3.Connect($ServerName, $Port)
    If $ConnectStatus <> 1
    Display "Connection Failed.."
    Log "Connection Failed " $error
    Hangup
    Goto Main
    Endif

    ;Login to Server
    $LoginStatus = pop3.Login($Username,$Password)
    If $LoginStatus <> 1
    Display "Login Failed.."
    Log "Login Failed " $error
    Hangup
    Goto Main
    Endif

    ;Fetch the First mail [ Unread ] Mail from Server
    $FetchMailStatus = pop3.FetchMail(1)
    If $FetchMailStatus <> 1
    Display " Fetch Mail Failed.."
    Log "Fetch Mail Failed " $error
    Hangup
    Goto Main
    Endif

    ;Get data of fetched mail from server
    $GetMaildata = pop3.GetMail()
    If $GetMaildata = ""
    Display "Failed to get mail"
    Log "Failed to get mail"
    Hangup
    Goto Main
    Endif

    ;Raw Data
    Display "Mail Data " $GetMaildata
    Log "Mail Data " $GetMaildata

    ;Delete mail
    $Status = pop3.DeleteMail(1)
    If $Status <> 1
    Display "DeleteMail Failed.."
    Log "DeleteMail Failed " $error
    Hangup
    Goto Main
    Endif

    ;Closing Connection
    Display "Closing connection..."
    pop3.Close()

    Hangup
    Goto MAIN

    * User has hung up
    ONHANGUP:
    Hangup
    Goto MAIN

    * Time allowed for user is over
    ONTIMEOUT:
    ONRUNTIMEOUT:
    Hangup
    Goto MAIN

    * An error has occurred
    ONSYSTEMERROR:
    log $error
    display $error
    if $debug
    msgbox($error)
    endif
    hangup
    goto MAIN


SendMail DEPRECATED ()

 $bool = SendMail ( [ "$email" ] (DEPRECATED FUNCTION) )
    To send an email from the Xtend IVR script.
Parameters
    [ "$email" ] This user specified optional argument is the name of the "Group Variable", if not, "$email" is assumed.
Return Value
  • 1, if the mail is sent successfully, else 0.
Remarks
  • Another method of executing this plugin is "SendMail()", then the variable $email is assumed to be the default "Group variable" argument.
  • All mails are sent through the SMTP server. At first, SendMail() will try to connect directly to the SMTP server. If it fails, it tries to authenticate the connection with the POP server and on failure, returns 0. SendMail() will again try for a connection with the SMTP server. If it establishes connection with the POP server, it will send the mail.
  • Default Port Address of the SMTP server (Default :25) is automatically taken if $email.port is not specified by the user.
  • As Mails are sent through the SMTP server, IP address should be precisely cited.
  • [ "$email" ] is of user defined type. Say, if it is given as $Variable, then the Group Variables will be $Variable.to, $Variable.body, $Variable.from etc.
  • A blank mail is sent, if the variable $email.body does not carry any message.
  • $email.errno is the Error no. returned by the SMTP or the POP server.
    Group variables are:
    variable
    Description
    $email.smtp | IP Address of the SMTP server.(Eg. "192.168.1.1")
    $email.port | (Optional )Default (i.e."25") Port Address of the SMTP server.
    $email.from | From Address of the mail. There can be multiple 'from addresses' separated by commas. In that case, SendMail() subsequently checks the validity of the address from the first one onwards and accepts one and only one address that is valid.
    $email.to | Valid ' To Addresses ' or ' To Address ' of the email. One copy of the mail is sent to each, in the case of multiple email addresses.
    $email.subject | (Optional) Subject of the mail.
    $email.cc | (Optional) Addresses to which " Carbon Copies " of the mail are sent. Each recipient gets the addresses of all others, to whom this mail has been sent.
    $email.bcc | (Optional) Addresses to which " Blind Carbon Copies " of the mail are sent so that you are not revealing someone else's email address to the recipient other than his own.
    $email.body | Content of the mail.
    $email.errno | If the mail was not sent successfully, it would return the error no.
    $email.error | If the mail transfer was not successful, then an error would be reported. Its content would be same as that of $Error.
    $email.pop | IP Address of the POP server.(Eg. "192.168.1.1")
    $email.user | User name for authentication with the POP server.
    $email.password | User password for authentication with the POP server.
Example
    $Variable = SendMail()

or

$Variable = SendMail ( " $email" )


http

 $method = Socket ( <IPAddress>, <PortNumber> , <Data to send>, [TimeOut] )
    A socket is one end of an interprocess communication channel. The function facilitates interprocess communication using a combination of an IP-address and a port-number that uniquely identifies a service on the internet. A pair of sockets, sender and receiver, implements a unique network connection in TCP.
Parameters
    <IPAddress> Address of the specified resource in the internet.
    <PortNumber> Port Number of the specified resource where the service runs.
    <Data to send> Data to be sent.
    [TimeOut] Permitted delay in seconds to wait for data to be retrieved.
Return Value
  • Server returns the service requested by the client.
Remarks
  • Sequence of operations triggered by Socket() are:
    • Establishes connection with the specified port of the server.
    • If successful, sends the specified data into the server.
    • Waits for the response of the server with a timeout check.
    • Reads the response, if any, and returns it into the IVR script.


Absolute()

 $intValue = Math.Absolute ("<num>")
    Determines the absolute value of the number.
Parameters
    <num> The numeric value that is passed.
Return Value
    Returns an integer.
Example

$ret = Math.Absolute ("-10")
  • $ret contains 10.


Evals()

 $floatValue = Math.Evals ("<exp>")
    Evaluates an expression that can be built dynamically and returns the resultant numeric value.
Parameters
    <exp> The expression to be evaluated.
Return Value
    Returns a numeric value.
Remarks
  • It is equivalent to the Eval() function in VB Script.
Example

$ret = Math.Evals ("(2*5)+(3*4)")
  • $ret contains 22.


IntDigit()

 $intValue = Math.IntDigit ("<num>")
    Returns the integer portion of the given floating point number.
Parameters
    <num> The floating point number from which integer part is to be extracted.
Return Value
    Returns an integer.
Remarks
  • Operates in a similar way to the NumberFix function, except that if num is negative, IntDigit returns the first negative number less than or equal to num.
  • Similar to the Int function in VB Script.
Example

$ret = Math.IntDigit ("-10.2")
  • $ret contains -11.


LogN ()

 $floatValue = Math.LogN ("<num>")
    Returns the natural logarithmic value of the given number.
Parameters
    <num> Any valid numeric expression.
Return Value
    A floating point number.
Example

$ret = Math.LogN ("22.2")
  • $ret contains 3.10009228887823.


NumberFix ()

 $intValue = Math.NumberFix ("<num>")
    Removes the fractional part of a number.
Parameters
    <num> Any valid numeric expression.
Return Value
    Integer portion of num.
Remarks
  • Operates in a similar way to the IntDigit function, except that if num is negative, NumberFix returns the first negative number greater than or equal to num.
  • Similar to the Fix function in VB Script.
    •
Example

$ret = Math.NumberFix ("2.345")
  • $ret contains 2.


RoundDigit ()

 $floatValue = Math.RoundDigit ("<num>", <numDecimalPlaces>)
    Approximates and rounds the number to the specified number of decimal places.
Parameters
    <num> Any numeric expression.
    <numDecimalPlaces> The number of places to include after the decimal point.
Return Value
    A floating point number.
Example

$ret = Math.RoundDigit ("10.5678", 1)
  • $ret contains 10.6.


Square ()

 $floatValue = Math.Square ("<num>")
    Calculates the square root of a number.
Parameters
    <num> Any numeric expression greater than or equal to zero.
Return Value
    A floating point number.
Remarks
  • Similar to Sqr function in VB Script.
Example

$ret = Math.Square ("9")
  • $ret contains 3.


Date2Wav ()

 $wave = Date2Wav ( <Date>, [Prefix], [Language], [Accent], [Delay] )
    Date to Wave converter is used to announce the date in human voice.
Parameters
    <Date> Any valid date. Supported formats are dd/mm/yyyy and yyyymmdd.
    [Prefix] Wave file name prefix. This parameter is optional. The default value is "SRE".
    [Language] Language to be used. Default parameter is "ENG_US".
    [Accent] The type of accent - FALSE to cease or TRUE to continue. Default value is FALSE.
    [Delay] Pause in milliseconds between 2 consecutive wave files. Default value is 0.
Return Value
    Converted date in human voice.
Remarks
  • You can use customized wave files with the artist's name as filename prefix. To do customized recording, you have to follow some standard rules.
  • Xtend IVR supports 3 different flavors of English language. Hence the language parameters will change accordingly. To support
    • Indian English, give "ENG_IN"
    • American English, give "ENG_US" or "ENG" or "ENGLISH"
    • British English, give "ENG_UK"
Example
    1)	$wave = Date2Wav ("01/01/2000")
    Play $wave

    $wave now contains SRE_First.wav  SRE_Jan.wav  SRE_2.wav   SREthousand.wav

2)	$x = "2/1/1999"
    $wave = Date2Wav ($x)
    Play $wave

    $wave now contains SRE_2nd.wav  SRE_Jan.wav   SRE_19.wav SRE_99.wav

3)	$wave = Date2Wav ("3/01/2001","SRE","ENG")
    Play $wave

    $wave now contains SRE_3rd.wav SRE_Jan.wav  SRE_2.wav SRE_thousand.wav SRE1.wav

4)	$wave = Date2Wav ("25/12/2000","SRE","ENG",TRUE,3)
    Play $wave

     $wave now contains SRE_25th.wav SRE_Dec.wav SRE_2.wav SREthousand.wav


Digit2Wav ()

 $wave = Digit2Wav ( <Digit>, [Prefix], [Language], [Accent], [Delay] )
    Digit to Wave converter is used to speak the digits in human voice.
Parameters
    <Digit> Digit to be converted and is stored in audio file.
    [Prefix] Wave file name prefix. This parameter is optional. The default value is "SRE".
    [Language] Language to be used. Default parameter is "ENG_US".
    [Accent] The type of accent - FALSE to cease or TRUE to continue. Default value is FALSE.
    [Delay] Pause in milliseconds between 2 consecutive wave files. Default value is 0.
Return Value
    Converted digit in human voice.
Remarks
  • You can use customized wave files with the artist's name as filename prefix. To do customized recording, you have to follow some standard rules.
  • Xtend IVR supports 3 different flavors of English language. Hence the language parameters will change accordingly. To support
    • Indian English, give "ENG_IN"
    • American English, give "ENG_US" or "ENG" or "ENGLISH"
    • British English, give "ENG_UK"
Example

1)	$wave = Digit2Wav ("1234")
    Play $wave

    $wave now contains SRE_1.wav  SRE_2.wav  SRE_3.wav   SRE_4.wav

2)	$wave = Digit2Wav ("315","SRE","ENG")
    Play $wave

    $wave now contains SRE_3.wav SRE_1.wav  SRE_5.wav


Money2Wav ()

 $wave = Money2Wav ( <Number>, [Prefix], [Language], [Accent], [Delay] )
    Money to Wave converter stores currency data in human voice.
Parameters
    <Number> The number to be converted into audio format.

    [Prefix] Wave file name prefix. This parameter is optional. The default value is "SRE".

    [Language] Language to be used. Default parameter is "ENG_US".
    [Accent] The type of accent - FALSE to cease or TRUE to continue. Default value is FALSE.
    [Delay] Pause in milliseconds between 2 consecutive wave files. Default value is 0.
Return Value
    Converted currency in human voice.
Remarks
  • You can use customized wave files with the artist’s name as filename prefix. To do customized recording, you have to follow some standard rules.
  • Xtend IVR supports 3 different flavors of English language. Hence the language parameters will change accordingly. To support
    • Indian English, give "ENG_IN"
    • American English, give "ENG_US" or "ENG" or "ENGLISH"
    • British English, give "ENG_UK"
Example
    1)	$wave = Money2wav (24)
    Play $wave

    $wave now contains "SRE_24.wav SREDollars.wav"

2)	$Price = "54.56"
    $wave = Money2wav ($Price,"SRE","ENG_IN")
    Play $wave

    $wave now contains SRE_54.wav  SRE_Rupees.wav SRE_and.wav   SRE_56.wav SREPais.wav"

3)	$wave = Money2wav ("45.56","SRE","ENG",TRUE,3)
    Play $wave

    $wave now contains SRE_45.wav SRE_Dollars.wav SRE_and.wav SRE _56.wav SRECent.wav"


Num2Wav ()

 $wave = Num2Wav ( <Number>, [Prefix], [Language], [Accent], [Delay] )
    Number to Wave converts and stores the numbers in human voice.
Parameters
    <Number> The number to be converted into audio format.
    [Prefix] Wave file name prefix. This parameter is optional. The default value is "SRE".
    [Language] Language to be used. Default parameter is "ENG_US".
    [Accent] The type of accent - FALSE to cease or TRUE to continue. Default value is FALSE.
    [Delay] Pause in milliseconds between 2 consecutive wave files. Default value is 0.
Return Value
    Converted number in human voice.
Remarks
  • You can use customized wave files with the artist’s name as filename prefix. To do customized recording, you have to follow some standard rules.
  • Xtend IVR supports 3 different flavors of English language. Hence the language parameters will change accordingly. To support
    • Indian English, give "ENG_IN"
    • American English, give "ENG_US" or "ENG" or "ENGLISH"
    • British English, give "ENG_UK"
Example
    1)	$wave = Num2Wav (24)
    Play $wave

    $wave now contains "SRE _24.wav"

2)	$Mark = "154.56"
    $wave = Num2Wav ($Mark)
    Play $wave

     $wave now contains SRE_1.wav  SRE_Hundred.wav SRE_54.wav  SRE_point.wav    SRE_5.wav    SRE6.wav"

    3)	$Mark = "54"
    $wave = Num2Wav ($Mark,"SRE","ENG")
    Play $wave

    $wave now contains SRE_54.wav

4)	$Mark = "54"
    $wave = Num2Wav ($Mark,"SRE","ENG",TRUE,3)
    Play $wave

    $wave now contains SRE_54.wav


Time2Wav ()

 $wave = Time2Wav ( <Time>, [Prefix], [Language], [Accent], [Delay] )
    Time to Wave stores the time in audio format.
Parameters
    <Time> Time as character string. (HH:MM format)
    [Prefix] Wave file name prefix. This parameter is optional. The default value is "SRE".
    [Language] Language to be used. Default parameter is "ENG_US".
    [Accent] The type of accent - FALSE to cease or TRUE to continue. Default value is FALSE.
    [Delay] Pause in milliseconds between 2 consecutive wave files. Default value is 0.
Return Value
    Converted time in human voice.
Remarks
  • You can use customized wave files with the artist’s name as filename prefix. To do customized recording, you have to follow some standard rules.
  • Xtend IVR supports 3 different flavors of English language. Hence the language parameters will change accordingly. To support
    • Indian English, give "ENG_IN"
    • American English, give "ENG_US" or "ENG" or "ENGLISH"
    • British English, give "ENG_UK"
Example
    1)	$wave = Time2Wav ("12:45")
    Play $wave

    $wave now contains "SRE_12.wav   SRE_Hours.wav   SRE_40.wav SRE_5.wav  SREminutes.wav"

2)	$x = "1:1"
    $wave = Time2Wav ($x)
    Play $wave

    $wave now contains SRE_1.wav  SRE_Hour.wav   SRE_1.wav SRE_minute.wav

3)	$x = "01:01"
    $wave = Time2Wav ($x,"SRE","ENG",TRUE)
    Play $wave

    $wave now contains SRE_1.wav SRE_Hour.wav SRE_1.wav SRE_minute.wav


AddHour()

 $newTime = Time.AddHour ("<time>", <n>)
    Adds or subtracts given number of time period in hours to the time mentioned.
Parameters
    <time> Any valid time expression.
    <n> An expression denoting the number of time intervals in hours you want to add or subtract. To subtract, n should be negative.
Return Value
    Returns the new time depending on the control panel settings.
Example

$stime = "10:42:23 PM"
$ret = time.AddHour ($stime, -5)
  • $ret contains 5:42:23 PM.


AddMinute()

 $newTime = Time.AddMinute ("<time>", <n>)
    Adds or subtracts a given number of time period in minutes to the specified time.
Parameters
    <time> Any valid time expression.
    <n> An expression denoting the number of time intervals in minutes you want to add or subtract. To subtract, n should be negative.
Return Value
    Returns the new time depending on the control panel settings.
Example

$stime = "10:42:23 PM"
$ret = time.AddMinute ($stime, 5)
  • $ret contains 10:47:23 PM.


AddSecond()

 $newTime = Time.AddSecond ("<time>", <n>)
    Adds or subtracts a given number of time interval in seconds to the time specified.
Parameters
    <time> Any valid time expression.
    <n> An expression denoting the number of time intervals in seconds you want to add or subtract. To subtract, n should be negative.
Return Value
    Returns the new time depending on the control panel settings.
Example

$stime = "10:42:23 PM"
$ret = time.AddSecond ($stime, 5)
  • $ret contains 10:42:28 PM.


Cmp()

 $intSeconds = Time.Cmp ("<time1>", "<time2>")
    Calculates the number of seconds between 2 instances of time.
Parameters
    <time1> The first time instance.
    <time2> The second time instance.
Return Value
    Returns
    • 0, if both the instances are equal.
    • Negative integer, if time1 > time2.
    • Positive integer, if time1 < time2.
    • An <Empty string> "" in case of error and sets $error.
Remarks
  • Similar to DateDiff function in VB Script.
Example

$stime = "10:42:23"
$etime = "11:42:23"

$ret = time.Cmp($stime, $etime)
$stat = time.Cmp($etime, $stime)
  • $ret contains 3600 and $stat contains -3600.


Get12()

 $newTime = Time.Get12 ("<time>")
    Converts a 24-hour clock into the 12-hour format.
Parameters
    <time> Any valid time expression in hh:mm:ss format.
Return Value
    Returns new time.
Example

$stime = "21:30:00"
$ret = time.Get12($stime)
  • $ret contains 9:30:00 PM.


Get24()

 $newTime = Time.Get24 ("<time>")
    Converts a 12-hour clock into 24-hour format.
Parameters
    <time> Any valid time expression in hh:mm:ss format.
Return Value
    Returns new time.
Remarks
  • The time should be specified in AM or PM. By default, it takes time as AM.
Example

$stime = "9:30:00 PM"
$ret = time.Get24($stime)
  • $ret contains 21:30:00.


GetHour()

 $intHour = Time.GetHour ("<time>")
    Extracts the hour element from the given time expression.
Parameters
    <time> Any valid time expression in hh:mm:ss format.
Return Value
    Returns an integer value between 0 and 23.
Example

$ret = time.GetHour ("10:42:23")

  • $ret contains 10.


GetMinute()

 $intMinute = Time.GetMinute ("<time>")
    Extracts minute element from the given time expression.
Parameters
    <time> Any valid time expression in hh:mm:ss format.
Return Value
    Returns an integer value between 0 and 59.
Example

$ret = time.GetMinute ("10:42:23")

  • $ret contains 42.


GetSecond()

 $intSec = Time.GetSecond ("<time>")
    Extracts seconds from the given time expression.
Parameters
    <time> Any valid time expression in hh:mm:ss format.
Return Value
    Returns an integer value between 0 and 59.
Example

$ret = time.GetSecond ("10:42:23")
  • $ret contains 23.


IsValid()

 $bool = Time.IsValid ("<time>")
    Determines whether the value of a variable can be converted into time format.
Parameters
    <time> Any valid time expression in hh:mm:ss format.
Return Value
    Returns 1 if valid, else returns 0.
Example

$stime = "62:23:72"
$ret = time.IsValid($stime)
  • $ret contains 0.


Convert()

 $status = wave.Convert ("<Source Filename >","<Codec>","[Target Filename]")
    Converts the wave file into the specified wave format and saves it in a separate file. The default wave format is PCM.
    The different wave conversion formats available are:
         MP3, PCM8_8KHz, PCM8_16KHz, PCM8_22KHz,
     PCM8_44KHz, PCM8_48KHz,  PCM16_16KHz,
     PCM16_22KHz, PCM16_44KHz,
     PCM16_48KHz, A-law, μ-law
Parameters
    <Source Filename> Specify the name of the source wave file.
    <Codec> Assign the wave conversion format.
    <Target Filename> Specify the name of the target wave file.
Return Value
    Returns 1 on successful conversion, else 0.
Remark
    If target filename is not specified as parameter, then the converted format is copied to source filename again.
Example
  1. $status = wave.convert("welcome.wav", "MP3", "welcome_mp3.mp3")
    msgbox($status)
  • Welcome.wav is converted into MP3 format and $status returns 1.
2. $status = wave.convert("welcome.wav", "GSM", "welcome_GSM.wav")
msgbox($status)
  • Welcome.wav is converted into GSM format and $status returns 1.


datasize()

 $size = wave.datasize ("<Wavefile>","[Compr]")
    Returns the datasize of the wave file. This function does not perform compression but calculates the space requirement.
Parameters
    <Wavefile> Specify the name of the wave file.
    <Compr> Specify the wave compression format.
Return Value
    On successful execution, it returns the datasize of the wave file in compressed format, otherwise returns 0.
Remark
    If compression format is not specified, it returns datasize of the wave file in current format.
    If $size = 0, $error contains exact error that occurred.
Example
  1. $size = wave.datasize("welcome.wav", "GSM")
    msgbox($size)
  • Returns the size of the wave file if welcome.wav is converted to GSM format.
2. $size = wave.datasize("welcome.wav")
msgbox($size)
  • Returns the size of the wave file in current format.
    The data size can be retrieved quickly if the data type is already known/PCM16.
3. $size = wave.datasize("welcome.wav","PCM16_8KHz")
msgbox($size)
  • Returns size of the wave file if welcome.wav is converted to PCM16 _8Khz format.


Encrypt()

 $bool = wave.Encrypt ("<Wave Filename>","<Password>","<Type>","[Destination File]")
    The wave file is encrypted using the encryption type BLOWFISH or XOR.

Parameters
    <Wave Filename> Specify the name of the wave file which has to be encrypted.
    <Password> Specify the password for encryption.
    <Type> Specify the encryption type as "BLOWFISH or XOR".
    <Destination File> Specify the destination wave file.
Return Value
    Returns 1 on successful encryption and 0 on failure.
Remark
    If destination file is not mentioned as a parameter, then the specified file will be encrypted.
    For decrypting the file in Xtend IVR, use $wavpass = "PASSWORD" and then Play "Encrypted file".
Example
  1. $bool = wave.Encrypt("welcome.wav", "ABCD", "BLOWFISH", "output.wav")
    msgbox($bool)

    • welcome.wav is encrypted and saved as output.wav.

  2. $bool = wave.Encrypt("welcome.wav", "ABCD", "BLOWFISH")
    msgbox($bool)
    • welcome.wav is replaced with the encrypted format.
      The original wave can be played by giving $wavpass="ABCD" and play "welcome.wav"

  3. $bool = wave.Encrypt("engsre13.wav", "ABCD", "BLOWFISH", "D:\myfolder\output.wav")
    msgbox($bool)
    • engsre13.wav is encrypted and saved as output.wav present in the location D:\myfolder.


GetTag()

 $Bool = wave.GetTag ("<Wave Filename>","<Tag>")
    Used to retrieve the remark attached to a tag/label within the wave file.
Parameters
    <Wave Filename> Indicates the name or the path of the wave file.
    <Tag> The name of the label within the wave file.
Return Value
    Retrieves the remark attached with the tag if success, else returns null.
Example
    wave.SetTag("welcome.wav","CALL","Call Accepted")
    $remark = wave.GetTag("welcome.wav","CALL")
    msgbox($remark)
  • The function retrieves the remark "Call Accepted" attached to the tag "CALL" within the welcome.wav file.


Loudness()

 $val = wave.loudness ("<Wave Filename>",[Block Size],"[Freqstoignore]")
    Gives the maximum frequency of the wave within the given block size.
    The wave file is processed in block size portions and the maximum loudness obtained is taken.
Parameters
    <Wave Filename> Specify the name of wave file.
    <Block Size> Specify the size of the block. If block size is not given, 1000 is assumed i.e. (1 second)
    <Freqstoignore> Mention the frequency of the block that has to be ignored. Multiple frequencies can be specified here.
Return Value
    On success it returns the maximum frequency, otherwise returns 0.
Remark
    If freqstoignore parameter is not given, then the complete data is taken for loudness check.
Example
  1. $val = wave.loudness("welcome.wav",1000)
    msgbox($val)
    • Displays the maximum frequency within the block size. None of the frequencies are ignored.
    • $val contains the maximum frequency.

  2. $val = wave.loudness("welcome.wav","100,2200")
    msgbox($val)
    • Displays the maximum frequency within the block size. It ignores blocks containing frequencies 100 and 2200 while checking for loudness.
    • $val contains the maximum frequency.


Merge()

 $stat = wave.merge ("<Wavefile1>","<Wavefile2>","<Destination Filename>")
    Merges two waves and stores it in the specified destination.
Parameters
    <Wavefile1> Specify the name of first wave file.
    <Wavefile2> Specify the name of second wave file.
    <Destination Filename> Specify the name of the merged wave file.
Return Value
    Returns 1 on successful merging, otherwise 0 on failure.
Remark
    Only two files can be merged.
Example
  1. $stat = wave.merge ("engsre13.wav", "engsre14.wav", "dest.wav")
    msgbox($stat)

    2.
    • engsre13.wav and engsre14.wav is merged into dest.wav and $stat returns 1.

  2. $stat = wave.merge ("engsre13.wav", "engsre14.wav", "D:\myfolder\dest.wav")
    msgbox($stat)

    3.
    • engsre13.wav and engsre14.wav is merged and saved to the destination file present in D:\myfolder\dest.wav.


SetTag()

 $Bool = wave.SetTag ("<Wave Filename >","<Tag>","<Remark>")
    Used to add a tag/label within the wave file.
Parameters
    <Wave Filename> Specify the name or the path of the wave file.
    <Tag> Indicates the name of the label. Specify only 4 alphanumeric characters.
    <Remark> Comment to be added along with the tag.
Return Value
    Returns 1 if success, else returns 0.
Example
    $value = wave.SetTag("welcome.wav","CALL","Call Accepted")
    msgbox($value)
  • A tag named CALL is added within the welcome.wav file followed by a remark as "Call Accepted".
  • $value contains 1.


rtrim()

 $stat = wave.rtrim ("<Source Filename>", [Millisec], "[Destination Filename]")
    This function is to trim the audio data from a wave file from its extreme right end.
    The duration or length of the audio can be specified in the function.
Parameters
    <Source Filename> Specify the name of source file.
    <Millisec> Specify the duration or length of audio data to be trimed in milliseconds.
    <Destination Filename> Specify the name of the destination file.
Return Value
    Returns 1 on success and 0 on failure.
Remark
    We cannot use this function in a GSM compressed file. If the file is GSM, then convert this file into PCM, then rtrim it.
    If the destination file is not mentioned as a parameter, then the source file itself is overwritten.
Example
  1. $stat = wave.rtrim ("bgplay.wav", 1000, "out.wav")
  • The source wavefile is trimed 1000 millisec from the right end and wrote to destination file.
    On successful excecution of the function $stat returns the value 1.


Type()

 $val = wave.type ("<wavefile>")
    Returns the type of wave file.
Parameters
    <wavefile> Specify the name of the wave file.
Return Value
    On success it returns the type of wave file, otherwise returns 0.
Remark
    It returns UNKNOWN or 0, when the wave file format does not belong to the following types:

    PCM16_8KHz_stereo, PCM16_8KHz, A-law, μ-law, GSM
Example
  1. $val = wave.type("welcome.wav")
    msgbox($val)

    • The format of welcome.wav is GSM.
      $val contains GSM.


Get2File()

 $Status = http.Get2File("<URL>","<Filename>")
    To get the specific web page into a file.

Parameters
    <URL> Address of the specified resource in the internet.
    <Filename> The file to which the web page has to be loaded.
Return Value
    On success returns the value 1, otherwise 0.
Example
  1. $Status = http.Get2File("http://www.google.com", "data.htm")
  • The web page for Google is saved in the HTML format with file name as data.htm.


Get()

 $Page = http.Get("<URL>")
    To get the specified web page.

Parameters
    <URL> Address of the specified resource in the internet
Return Value
    On success the specified URL page is obtained, otherwise returns 0.
Example
  1. $page = http.Get("http://www.google.com")
  • The variable $page displays the HTML source code of the respective page.


Hashoffile()

 $hash = md5.hashoffile("<filename>")
    Gives the hash value for any type of file.

Parameters
    <filename> Specify the name of the file.
Return Value
    Returns the hash value of the specified file on successful execution, otherwise null value is obtained.
Example
  1. $hash = md5.hashoffile("Test.txt")
    msgbox($hash)
  • Creates a md5 hash value of the specified text file.
    The resulting hash value might resemble the following string 9A4C61850FC0677B9F08E348F614701A.


Hashofstring()

 $hash = md5.hashofstring ("<String>")
    Gives the hash value of the specified string.

Parameters
    <String> Specify the string.
Return Value
    Returns the hash value of the string.
Example
  1. $hash = md5.hashofstring("This is a Test")
    msgbox($hash)
  • Creates a md5 hash value of the given string.
    The resulting hash value might resemble the following string CE114E4501D2F4E2DCEA3E17B546F339.


hashofwavedata()

 $hash = md5.hashofwavedata("<Wavefile>")
    Gives the hash value of the wave file.

Parameters
    <Wavefile> Specify the name of the wave file.
Return Value
    Returns the hash value of the specific wave file on successful execution, otherwise null value is obtained.
Example
  1. $hash = md5.hashofwavedata("welcome.wav")
    msgbox($hash)
  • Creates a md5 hash value of the wave data within the specified file.
    The resulting hash value might resemble the following string 1E96D78FD54E1C4DDAA3C84CE4767Fdf.


init()

 udp.init("<Port>")
    Used to initialize the specified port in order to send and receive UDP data.

Parameters
    <Port> Specify the port for initialization.
Return Value
    On successful execution the specified port is initialized, otherwise an error message is returned in $error.
Remark
    Init() should be called only once.
Example
  1. udp.init(3500)
    2.
  • Initializes the port 3500.


Receive()

 udp.receive("<Timeout>")
    Used to receive UDP data from a specific UDP port.
Parameters
    <Timeout> Permitted delay in milliseconds to wait for data to be retrieved.
Return Value
    Returns the data within the timeout value.
Example

     ......
     ............
     udp.init(3501)
     While true
        $data1 = udp.receive(100)
        display $data1
        sleep 100
     endwhile
     .......
     ..........
  • The port gets intialized first and then the data is retrieved.
    The data is stored into $data1.


send()

 udp.send("<IP>",<Port>,"<Data>")
    Sends data to the UDP port of the specified IP address.

Parameters
    <IP> Specify the IP address of the client system.
    <Port> Specify the UDP Port of the client system in which the data has to be send.
    <Data> Specify the data to be send.
Return Value
    Returns 1 if the data is send to the port of the specified IP, on failure it returns 0.
Example
        .......
     ..........
        udp.init(3501)
        $data = udp.send("192.168.14.2",3501,"Testing.....1")
        msgbox($data)
        sleep 100
    ...........
    .........
  • Sends the data "Testing...1" to the specified IP Address i.e., 192.168.14.2, port 3501.


Accept()

 $number = Accept ( [prompt], [count], [retry], [delay], [mask] )
    Accepts input from the telephone keypad.
Parameters
    <prompt> The wave file to be played as a prompt.
    [count] Maximum number of digits the user can enter through the dial-pad. By default, it is one digit.
    [retry] The number of retries allowed for inputs. Default value is 3.
    [delay] The duration of seconds to wait for further inputs. By default, it allows 4 seconds delay.
    [mask] This filters the input. The default mask is "0123456789".

Return Value

    The entered value.

Remarks

  • All are optional parameters.
  • The Accept() function will accept a maximum of [count] digits entered on the telephone keypad by the user by waiting for a duration of [delay] seconds in between the inputs. The entered value is stored into the specified variable, $number.
Example

MAIN:
    Answer
    Play "Welcome.wav"

    //Please enter your user ID
    $uid = Accept("UserId.wav",5,4)

    //Please enter your account number
    $accno = Accept("AccountNum.wav",5,4)

    ;......
    ;......

    Hangup
    goto MAIN


Flashox ()

 FlashBox ( "<Window Position>" , "<Formatted text>" )
    Displays a secondary window to furnish the user with some program specific information or about definite conditions in the Developer Edition.
Parameters
    <Window Position> Position of the child window on the screen. Window positions are given in the Remarks section.
Remarks
  • FlashBox does not return any value.
  • Formatting characters are ' \n ', and SPACE.
  • FlashBox can be closed using the command FlashBox("Close") or FlashBox().
  • Call to the FlashBox plugin closes if any left without closing.
  • Manually you can close the FlashBox by focusing the cursor on it and then pressing the ESC key.
  • FlashBox is significant only in the Developer Edition.
  • Window positions are:
    Window Position | Description
    TopLeft | Displays a window at the TopLeft position on the screen
    TopRight | Displays a window at the TopRight position on the screen
    Center | Displays a window at the Center position on the screen
    BottomLeft | Displays a window at the BottomLeft position on the screen
    BottomRight | Displays a window at the BottomRight position on the screen
Example

:MAIN
    * Accept account code from the customer
    * -------------------------------------

    Speak "Please punch in your account number after pressing the star key."
    wait 0
    if $Debug == 1
        //introducing new line character, \n
        $st = format("%c Valid Account Numbers:%c%c Account Pin Code%c  1111    1234%c  2222    2345%c  %c",chr(10),chr(10),chr(10),chr(10),chr(10),chr(10),chr(10))
        FlashBox("TopRight",$st)
     endif
     .........
     .........


MsgBox ()

 MsgBox ( "<Message>", "<Command Button>" )
    MsgBox plugin displays a message in a dialog box, waits for the user to click a button, and returns.
Parameters
    <Message> The message to be displayed in the dialog box.
    <Command Button> The command buttons to be displayed in the dialog box. Possible values are "OK"(Default), "OKCANCEL", "YESNO" or "YESNOCANCEL".
Return Value
  • Returns the value of the button clicked.
Remarks
  • Valid Syntax for Msgbox:
      MsgBox ($string)
      or
      MsgBox ( " message " )
      or
      MsgBox ( "message", "OKCANCEL" )
Example

:MAIN
   answer 3

   $ret = msgbox ("The value returned is","OKCANCEL")
   msgbox($ret)
   msgbox(msgbox ("You have chosen: ","YESNO"))
   MsgBox (concat("Are you sure",chr(10),"Do you want to continue"),"YESNOCANCEL")

   Hangup
   goto MAIN

:ONHANGUP
   hangup
   goto MAIN


Command-line Utilities

Xtend IVR supports certain utility programs. These programs are used to operate Xtend IVR from the Command Prompt. These are as follows:

  1. xivrcmd.exe: This utility program is used to operate Xtend IVR Standard Edition from the Command Prompt.

    Syntax: xivrcmd [/option] <Parameters>

    [/option] is an optional argument with the following parameters:

    /devices driver.dev | /isloaded | /restart | /enable | /disable | /shutdown | /startup
    This argument displays all the channels of the specified driver. | Tells whether Xtend IVR is working or not. | Restarts the Xtend IVR toolkit. | Enables the Xtend IVR toolkit. | Disables the Xtend IVR toolkit. | Exits from the Xtend IVR toolkit. | Starts the Xtend IVR toolkit.

    <Parameters> refers to the device driver installed in Xtend IVR runtime.

  2. xic.exe: This utility program compiles the Script files present in Xtend IVR Script Editor from the Command Prompt.

    Syntax: xic <filename.dt>

    Example: xic code.dt
    This command debugs the script file "code.dt" for errors, if any and generates the compiled file as "code.dtx".

  3. xivrcfg.exe: This utility program is used to invoke the Xtend IVR Configuration Window from the Command Prompt.

  4. xivrd.exe: This utility program is used to invoke the Xtend IVR Developer Edition from the Command Prompt.

  5. xe.exe: This utility program is used to invoke the Xtend IVR Script Editor from the Command Prompt.

  6. xivr.exe: This utility program is used to invoke the Xtend IVR Standard Edition from the Command Prompt.

  7. encwav.exe: This utility program is used for the encryption of wave files using password.

    Syntax: encwav <Type> <Password> <Filename>
      where:
        Type  			= 	xor / blowfish [default = blowfish]
        Password   		= 	Encryption password
        Filename   		= 	Wave filename or wildcards
  8. xivrwizard.exe: This utility program is used to invoke the Xtend IVR New Project Window from the Command Prompt.

  9. xivrsvc.exe:This utility program allows Xtend IVR to run as a service.

    Syntax: xivrsvc[/option]

    [/option] is an optional argument with the following parameters:

    /install | This argument helps to install the service.
    /remove | This argument helps to remove the service.


IVR Reporting Tool

Xtend IVR Reporting Tool implements an easy-to-use remotely accessible browser interface with full-fledged reporting features. This displays the complete call information with Caller/Called Number, Device ID, Duration etc. It is possible to access the user-friendly interface from a remote location.

Program Shortcut

Click on Start --> All Programs --> Xtend IVR 3.0 --> Xtend IVR to enable the Xtend IVR runtime.

Xtend IVR is now ready to receive the calls. As soon as an incoming call arrives on the telephone line, Xtend IVR accepts the call and this can be checked from the line status present in the display area as shown below. The enabled connection line indicates that all the steps have been correctly carried out and the Xtend IVR is properly configured with the driver.

Enable/Disable Xtend IVR: Press this button to hang-up the active connecting lines and suspend currently executing script. Xtend IVR will not accept any new connection in the disabled state.

User Button: This is a user-defined button that executes the program defined by the user in the configuration (xivr.ini) file.

View Log: This button goes to the Login page of browser interface. The detailed explanation about the browser interface is given below.


Login

Click on the View Log button in order to open the Login Page. Enter the Name and Password as “Admin” and then click on Login.

The Home Page will get displayed as shown below.


Live Calls

Menu and Submenu Paradigm

The Left Pane comprises of the menus and submenus. The menus include Live Calls, Call Logs, Logs and Administration.


Live Calls

This submenu shows the real time call details of the current call. The call details include “Device ID”, “Channel No”, “Caller No”, “Called No”, “Call Time”, “Call Type” and “Call Status”.

A Help button is present on the right side of the window which will help the developer to show live calls in the IVR Call Report by modifying the IVR script with Xtend Script Editor.

Important: To enable live calls, download and install 'SQLite ODBC Driver' from "http://www.ch-werner.de/sqliteodbc/".

If the IVR script is based on "Answer" script, to enable and view the live calls in the IVR Call Report, the running IVR script has to be modified with the following three functions:

  1. IVRReport.ClearAll(): This function initially deletes all the existing live call entries from the live table.
  2. IVRReport.CallDisconnected(): This function clears the call details of current channel from the live report. The developer should always call this function before “Answer” command.
  3. IVRReport.CallConnected(): This function inserts the call details of current channel into live report. The developer should always call this function after “Answer” command.

If the IVR script is based on "Dial" script, to enable and view the live calls in the IVR Call Report, the running IVR script has to be modified with the following three functions:

  1. IVRReport.ClearAll(): This function initially deletes all the existing live call entries from the live table.
  2. IVRReport.CallDisconnected(): This function clears the call details of current channel from the live report. The developer should always call this function before “Dial” command.
  3. IVRReport.CallConnected(): This function inserts the call details of current channel into live report. The developer should always call this function after “Dial” command.

After modifying the IVR function in the Script Editor, the user can view the real time call details within the submenu named “Live Calls” in the display area of Xtend IVR interface.


All Calls

This submenu gives the report of all the calls. The details include “Device ID”, “Call Start Time”, “Call End Time”, “Type”, “Caller No”, “Called No” and “Duration”.


Incoming Calls

This submenu shows the report of all the incoming calls with details like “Device ID”, “Call Start Time”, “Call End Time”, “Type”, “Caller No”, “Called No” and “Duration”.


Outgoing Calls

This submenu shows the report of all the outgoing calls with details like “Device ID”, “Call Start Time”, “Call End Time”, “Type”, “Caller No”, “Called No” and “Duration”.


Call Logs

This submenu helps to search the calls with respect to certain aspects like “Device ID”, “Call Start Time From”, “Call Start Time To”, “Caller Type”, “Caller Number”, “Called Number” and “Call Duration”. The user can enter the details and click on the option Search to view the reports.

A window as shown below with the report of call logs will get displayed.


Call Summary

This submenu gives the overall Call Summary. Enter the “Device ID”, “Call Time From” and “Call Time To” and then click on Search.

A window as shown below with graphical representation of the calls will get displayed.


Error Logs

Enter the “Device Id”, “Time” and “Error” and then click on Search.

A window as shown below with the error information will get displayed.


IVR Service Report

The start time and end time of the IVR System is displayed in this submenu. The report also includes the “Service Port”, “Call Port” and “Total Call”.

Click on the link "Call Statistics" present on the right side of the report to view the information about 'Channel Utilization'.

A table and graphical representation regarding the channel utilization will appear. The details include "CallTime" and "No. of Calls",

Click on the icon present on the right side of each report in order to view the call details.

A search window with default “Call Start Time From” and “Call Start Time To” will get displayed as shown below. Enter the search details and click on Search.

The Call Logs corresponding to the Search with details “Device ID”, “Call Start Time”, “Call End Time”, “Type”, “Caller No”, “Called No” and “Duration” will get displayed as below.


IVR Service Summary

This submenu gives the call details of the user-specified date and time. Enter the “Date From” and “Date To”, then click on Search.

A window with “Total Calls”, “Incoming Calls”, “Outgoing Calls” and “No. of Restart” will get displayed” as given below.


Memory Statistics

This submenu shows the graphical representation of the memory utilisation. Enter the date and then click on Search.

A window as shown below with a table and graphical representation of the memory statistics will get displayed. The details include “Date”, “Physical Memory”, “Xivr Memory” and “System Memory”.


Syslog Report

The Syslog command helps to add custom logs and create Syslog reports as specified by the user. The submenu named Syslog Report within the IVR web interface shows the customised logged file format.

To add logs, open the Xtend IVR Script Editor and enter the Syslog command. For example, to view the call details related to the Caller Number within the Call Report, add the command as given below:
    syslog "Call Time=" $date $time "Call from=" $cli "Call to=" $dli

Similarly, to view the corresponding Account Number of the caller, append the Syslog command as follows:
    syslog "Entered Account No-" $AccNo

The syslog data gets displayed in the IVR report and the log data includes “Device ID”, “Log Time”, “Log Data” as shown in the below image.


User Accounts

Click on the sub menu User Accounts to modify the General Settings.

Click on the button New User to add a user. Set the “Login name”, “Real name”, “Session Duration” and the “User Password”. Enter data; press Add to create new user.

To update the entries, click on Update button. Click on the button Delete User to remove a user.

When the deletion gets completed, a report appears as shown below. A prompt appears asking confirmation to delete the User. Click on Yes.


Update Logs

Click on this submenu in order to update the logs of Xtend IVR.

After updation process, the call report appears.


Clear Logs

This submenu clears the entire logs including “Service Reports”, “Call Logs” and “Last Updated File path”. When the user selects this submenu, a warning appears as shown below. Click on Delete.

A prompt appears asking confirmation to delete the logs. Click on Yes.

After successful deletion of the logs, a report appears as given below.


Logout

Click on the logout icon present on the top right of the window to logout from Xtend IVR Reporting Tool. A session report appears with the “Login time”, “Logout time” and “Session duration”.


Command index

Built-in Commands

Following are the built-in commands supported by the Xtend IVR engine.

Answer command causes the script to pickup the phone line.
Syntax
Answer [number of rings]

Tell me more!

The beep command produces a beep sound on the auxiliary multimedia device or on the phone line if connected.
Syntax
Beep <frequency> <duration>

Tell me more!

BgPlay command plays the specified .wav file in the background.
Syntax
BgPlay <wave file>

Tell me more!

BgVolume command adjusts the background play back volume.
Syntax
BgVolume <percent>

Tell me more!

Bp (Break Point) command automatically sets a break point inside the script.
Syntax
Bp

Tell me more!

The Break command will cause the execution of the script to break out of the current WHILE loop.
Syntax
Break

Tell me more!

The Clear command will immediately clear any pending ON, PLAY, RECORD and SPEAK commands and removes any pending keys from the input queue.
Syntax
Clear

Tell me more!

The Continue command will continue the looping in the While loop.
Syntax
Continue

Tell me more!

Display command prints messages in the Display area of the Main window.
Syntax
Display <string>

Tell me more!

The Exit command will cause the execution of the script to break out of the current WHILE loop.
Syntax
Exit

Tell me more!

The Function command identifies the start of a user-defined function.
Syntax
Function FunctionName ( Parameters )
<statements>
Return [Expression]

Tell me more!

The Goto command causes the script to jump to the specified label and start execution from that position.
Syntax
Goto <label>

Tell me more!

Hangup command hangs up the call.
Syntax
Hangup

Tell me more!

The Load command will load all variables from the given file.
Syntax
Load <filename>

Tell me more!

The Log command will log the given text into the log file maintained in the log directory.
Syntax
Log <string | variable>

Tell me more!

The Loop command will continue the looping in the While loop.
Syntax
Loop

Tell me more!

On command will cause a jump to the specified <label> if the given <key> has been pressed.
Syntax
On <key> Goto <label>

Tell me more!

Play command will playback the specified .wav file on the phone line.
Syntax
Play <wavefile>

Tell me more!

The Record command will record the incoming voice.
Syntax
Record <seconds>

Tell me more!

The Reject command rejects the incoming calls.
Syntax:
Reject

Tell me more!

The Restart command restarts Xtend IVR from Script.
Syntax
Restart

Tell me more!

The Run command will execute the specified program.
Syntax
Run <exe file>
or
! <exe file>

Tell me more!

The Runtimeout command sets the timeout in seconds for any subsequent RUN commands.
Syntax
Runtimeout <seconds>

Tell me more!

The Save command will save all variables to the given file.
Syntax
Save <filename>

Tell me more!

The Sleep command suspends the execution of the current script for a specified interval.
Syntax
Sleep <duration>

Tell me more!

The SleepEvent command suspends the execution of the current script for a specified interval of time or until an event occurs.
Syntax
SleepEvent <duration>

Tell me more!

The Speak command will speak out the given text.
Syntax
Speak [String]

Tell me more!

The Timeout command sets the timeout for an incoming call in seconds.
Syntax
Timeout <seconds>

Tell me more!

The VoiceLog command will log the telephony audio to a specified file.
Syntax
VoiceLog <wave file>

Tell me more!

Volume command will adjust the playback volume of the specified .wav file.
Syntax
Volume <percent>

Tell me more!

The Wait command will wait for the specified number of milliseconds.
Syntax
Wait <milliseconds>

Tell me more!


Function index

Internal Functions

Following are the built-in functions supported by the Xtend IVR engine.

The activeCalls() function obtains the number of calls active in the dialed line.
Syntax
$numInteger = ActiveCalls(<dli>)

Tell me more!

The activePorts() function obtains the number of ports being monitored by the IVR.
Syntax
$numInteger = ActivePorts()

Tell me more!

The alltrim() function trims all the leading and trailing white-space characters, tabs, carriage return and line feed from the string parameter and returns trimmed string.
Syntax
$trimmedString = alltrim(<string>)

Tell me more!

The ascii() function returns the ASCII code of the character entered.
Syntax
$asciiCode = ascii(<character>)

Tell me more!

AtomicAdd() function increments the value of a variable in a particular device.
Syntax
AtomicAdd(<deviceId>, <$variable>, <value>)

Tell me more!

AtomicGet() function gains access to the variables across devices.
Syntax
$valueString = AtomicGet(<deviceId>, <$variable>)

Tell me more!

AtomicSet() function sets the value of a variable in a particular device.
Syntax
AtomicSet(<deviceId>, <$variable>, <value>)

Tell me more!

The BlindTransfer() function blindly transfers the call to the particular extension phone.
Syntax
$statusBoolean = BlindTransfer(<extensionNumber>)

Tell me more!

The Calls() function obtains the number of calls handled by the current port.
Syntax
$numInteger = Calls(<dli>)

Tell me more!

The chr() function will return the character if given its ASCII code.
Syntax
$character = chr(<number>)

Tell me more!

ComClose() closes the serial port communication connection.
Syntax
ComClose()

Tell me more!

ComOpen() establishes a connection with the serial port.
Syntax
ComOpen("<Communication Port>", "<BaudRate> <Parity, Databits, Stopbits> <FlowControl>",)

Tell me more!

ComRead() reads data from the serial port.
Syntax
$buffer = ComRead(<Size>, <Timeout>)

Tell me more!

ComReadLine() reads a single line of data from the serial port.
Syntax
$buffer = ComReadLine(<Timeout>)

Tell me more!

ComReadSize() finds out the size of the data in the serial port that are ready to be read.
Syntax
$size = ComReadSize()

Tell me more!

ComWrite() writes data to the serial port.
Syntax
comWrite(<buffer>)

Tell me more!

ComWriteLine() writes a line of data to the serial port.
Syntax
ComWriteLine(<buffer>)

Tell me more!

The compare() function will compare two strings.
Syntax
$integer = compare(<String1>, <String2>)

Tell me more!

The concat() function will return a copy of the string after appending all given strings (<string1>, <string2>, ....).
Syntax
$concatenatedString = concat(<string1>, <string2>, ....)

Tell me more!

Convert() is used to convert the wave file into the specified wave format and saves it in a separate file.
Syntax:
$status = wave.Convert ("<Source Filename >","<Codec>","[Target Filename]")

Tell me more!

CountMessage() returns the total number of messages present in the message queue of the specified device.
Syntax:
$TotalMsg = CountMessage([DeviceId])

Tell me more!

The Datasize() function returns the data size of the wave file.
Syntax:
$size = wave.datasize ("<Wavefile>","[Compr]")

Tell me more!

DeleteFile() function deletes the specified file and returns boolean value true if file deleted, false otherwise.
Syntax
$boolean = DeleteFile(<filename>)

Tell me more!

DeviceSpecific() executes a function unique to a specific driver.
Syntax
DeviceSpecific(<functionName>[, parameters])

Tell me more!

Dial() makes an outgoing call.
Syntax
$bool = Dial(<Phone Number>)

Tell me more!

The Encrypt() function is to encrypt the wave file using the encryption type BLOWFISH or XOR.
Syntax
$bool = wave.Encrypt ("<Wave Filename>","<Password>","<Type>","[Destination File]")

Tell me more!

Escape() function converts the binary characters in the string to its percentage(%) hexa form.
Syntax
$escapedString = Escape(<string>)

Tell me more!

The ExtractXmlTag() function is used to retrieve the text in which the tag should be searched for and returns the text as per the specified offset value.
Syntax:
$xmltext = ExtractXmlTag ( <xmldata>, <starting tag>, <ending tag>, [offset] )

Tell me more!

The Find() function finds a character or substring inside a larger string and returns the zero-based index of the first character in the 'Master string'.
Syntax
$index = Find(<Master string>, <Sub string>, [Offset])

Tell me more!

Format() function writes formatted data to a string.
Syntax
$formattedString = Format(fcString [,arguments]..)

Tell me more!

Fraction() function returns the fractional portion of the number.
Syntax
$numericInteger = Fraction(<number>)

Tell me more!

The Get() function is to get specific web page.
Syntax
$Page = http.Get("<URL>")

Tell me more!

The GetCallProgress() function obtains the current status of a Dial() or Transfer() operation.
Syntax
$statusString = GetCallProgress()

Tell me more!

The Get2File() is to get specific web page into a file.
Syntax
$Status = http.Get2File("<URL>","<Filename>")

Tell me more!

The GetInfo() function retrieves information from the driver DLL.
Syntax
$infoString = GetInfo(<attribute>)

Tell me more!

GetMessage() function fetches a string from the message queue of the specified device.
Syntax
$msgString = GetMessage(<deviceId>)

Tell me more!

The GetStartTime() function generates the starting date and time of the IVR.
Syntax
$dateTime = GetStartTime()

Tell me more!

The GetTag() function is used to retrieve the remark attached to a tag/label within the wave file.
Syntax
$bool=wave.GetTag ("<Wave Filename>","<Tag>")

Tell me more!

The GetTickCount() retrieves the number of milliseconds that have elapsed since the system had started.
Syntax
$intCount = GetTickCount()

Tell me more!

The GetTime() function fetches the local date and time.
Syntax
$dateTime = GetTime()

Tell me more!

The hashoffile() function gives the hash value of any type of file.
Syntax
$hash = md5.hashoffile("<filename>")

Tell me more!

The hashofstring() function gives the hash value of specified string.
Syntax
$hash = md5.hashofstring ("<String>")

Tell me more!

The hashofwavedata() function gives the hash value of of wave file.
Syntax
$hash = md5.hashofwavedata("<Wavefile>")

Tell me more!

Index() function returns the zero-based index of a substring or a character inside a larger string. If sub string or character is not found, it will return -1. Index function has the same syntax as that of Find() function.
Syntax
$index = Index(<Master string>, <Sub string>)

Tell me more!

The init() function is used to initialize the specific port in order to send and receive data.
Syntax
udp.init("<Port>")

Tell me more!

The input() function will accept numbers entered on the dial-pad by the user.
Syntax
$inputKey = input(<max digits>, [wait in seconds], [enter key], [esc key], [mask])

Tell me more!

Integer() function returns the integral part of the number.
Syntax
$numericInteger = Integer(<number>)

Tell me more!

IsVariable() function searches for the given variable anywhere inside the script and returns 1 if present, 0 otherwise.
Syntax
$boolean = IsVariable("$variable")

Tell me more!

The len() function will return the length of the <string>.
Syntax
$length = len(<string>)

Tell me more!

The left() function will return the leftmost length of the <string>.
Syntax:
$LeftString = left(<string>, <len>)

Tell me more!

LoadFile() function loads the specified number of lines of text from the file to a variable.
Syntax
$boolean = LoadFile(<filename>, <$variable>, <NoOfLines>)

Tell me more!

Lock() function permits one and only one script to execute inside a block of statements.
Syntax
Lock(<name>)

Tell me more!

The Loudness() function gives the maximum frequency of the wave within the given block size.
Syntax
$val = wave.loudness ("<Wave Filename >",[Block Size],"[Freqstoignore]")

Tell me more!

The lower() function will return a copy of the <string> converted to lowercase.
Syntax
$lowerCaseString = lower(<string>)

Tell me more!

The ltrim() function will return a copy of the <string> after removing all the leading spaces.
Syntax
$leadingSpaceTrimmedString = ltrim(<string>)

Tell me more!

The Merge() function merges two waves and store it in the specified location.
Syntax
$stat = wave.merge ("<Wavefile1>","<Wavefile2>","<Destination Filename>")

Tell me more!

Mid() function extracts a substring of length [len] characters from <string>.
Syntax
$extractedString = mid(<string>, <start index>, [len])

Tell me more!

PlayTimeLeft() function returns the pending play back time in milliseconds.
Syntax
$timeInteger = PlayTimeLeft()

Tell me more!

PutMessage() function places a string into the message queue of the specified device.
Syntax
PutMessage(<deviceId>, <string>)

Tell me more!

The receive() function used to receive UDP data from a specific UDP port
Syntax
udp.receive("<Timeout>")

Tell me more!

The RecordTimeLeft() function returns the remaining time for recording.
Syntax
$timeInteger = RecordTimeLeft()

Tell me more!

The Reverse() function reverses a given string.
Syntax:
$index = Reverse(<Master string>, <Sub string>)

Tell me more!

The ReverseFind() function finds a character or substring inside a larger string starting the search from the end.
Syntax
$index = ReverseFind(<Master string>, <Sub string>)

Tell me more!

The right() function will return the rightmost length of the <string>.
Syntax:
$RightString = right(<string>, <len>)

Tell me more!

Rindex() function returns the zero-based index of a substring or a character inside a larger string starting the search from the end. Rindex() has the same syntax as that of ReverseFind() function.
Syntax
$index = Rindex(<Master string>, <Sub string>)

Tell me more!

The rtrim() function will return a copy of the <string> after removing all the trailing whitespaces.
Syntax
$trailingSpaceTrimmedString = rtrim(<string>)

Tell me more!

SaveFile() function replaces the content from the variable with that of the file by the specified number of lines.
Syntax
$boolean = SaveFile(<filename>, <$variable>, <NoOfLines>)

Tell me more!

The seconds() function gives the time elapsed in seconds after the process has started.
Syntax
$timePeriod = seconds()

Tell me more!

The send() function sends data to the UDP port of the specified IP address.
Syntax
udp.send("<IP>",<Port>,"<Data>")

Tell me more!

The SetInfo() function sets the attribute of the driver.
Syntax
SetInfo(<attribute>, <value>)

Tell me more!

The SetTag() Used to add a tag/label within the wave file.
Syntax
$bool=wave.SetTag ("<Wave Filename>","<Tag>","<Remark>")

Tell me more!

The SetVariable() function changes the scope of the variable from local to global and assigns value to all instances of the variable.
Syntax
SetVarInVar(<variable>, <value>)

Tell me more!

SoftDisconnect() function destroys a softInterconnect with a specified device.
Syntax
SoftDisconnect(<deviceId>)

Tell me more!

SoftInterConnect() function interconnects the current device and the specified device.
Syntax
SoftInterConnect(<deviceId>)

Tell me more!

SoftListen() function listens to a particular channel.
Syntax
SoftListen(<deviceId>[, Type])

Tell me more!

SoftStream() function streams the Incoming, Outgoing or both audio of the current device to the incoming audio of the specified device.
Syntax
SoftStream(<deviceId>[, Type])

Tell me more!

SoftUnlisten() function unlistens from the specified device.
Syntax
SoftUnlisten(<deviceId>)

Tell me more!

SoftUnstream() function releases SoftStream() to the specified device.
Syntax
SoftUnstream(<deviceId>)

Tell me more!

The srAcceptWords() function defines the grammar for the subsequent Input() operation.
Syntax
srAcceptWords(<word 1>, <word 2>, ..., <word N>)

Tell me more!

The srAudio() function specifies when the audio play back has to be stopped.
Syntax
srAudio (<type>)

Tell me more!

The srConfidence() function determines the level of recognition for the words/ grammar defined.
Syntax
$levelInteger = srConfidence()

Tell me more!

The srGrammar() function loads grammar for speech recognition in the script.
Syntax
srGrammar(<fileName>)
or
srGrammar(<actualXmlText>)

Tell me more!

The srKeepGrammar() function sets the grammar for the subsequent Input() operation in the script.
Syntax
srKeepGrammar(<boolean>)

Tell me more!

SubStr() function extracts a substring from a larger string and has the same syntax as that of mid() function.
Syntax
$extractedString = substr(<string>, <start index>, [len])

Tell me more!

The TotalCalls() function obtains the total number of calls handled by the IVR so far.
Syntax
$numInteger = TotalCalls()

Tell me more!

The Transfer() function transfers the call to an extension phone.
Syntax
$statusString = Transfer(<extensionNumber>, <timeout>)

Tell me more!

The Type() function returns the type of the wave file.
Syntax
$val = wave.type ("<Wavefile>")

Tell me more!

The upper() function will return a copy of the <string> converted to uppercase.
Syntax
$upperCaseString = upper(<string>)

Tell me more!

The UnEscape() function reverses the Escape() process.
Syntax
$unEscapedString = UnEscape(<string>)

Tell me more!

The UnLock() function releases the last Lock() operation.
Syntax
UnLock()

Tell me more!


Command and Function index

Quick Reference

Following are the functions and commands supported by the Xtend IVR engine.

A

The activeCalls() function obtains the number of calls active in the dialed line.
Syntax:
$numInteger = ActiveCalls(<dli>)

Tell me more!

The activePorts() function obtains the number of ports being monitored by the Xtend IVR.
Syntax:
$numInteger = ActivePorts()

Tell me more!

The alltrim() function trims all the leading and trailing white-space characters, tabs, carriage return and line feed from the string parameter and returns trimmed string.
Syntax:
$trimmedString = alltrim(<string>)

Tell me more!

The answer command causes the script to pickup the phone line after specified number of rings.
Syntax:
answer <no:of Rings>

Tell me more!

The ascii() function returns the ASCII code of the character entered.
Syntax:
$asciiCode = ascii(<character>)

Tell me more!

AtomicAdd() function increments the value of a variable in a particular device.
Syntax:
AtomicAdd(<deviceId>, <$variable>, <value>)

Tell me more!

AtomicGet() function gains access to the variables across devices.
Syntax:
$valueString = AtomicGet(<deviceId>, <$variable>)

Tell me more!

AtomicSet() function sets the value of a variable in a particular device.
Syntax:
AtomicSet(<deviceId>, <$variable>, <value>)

Tell me more!

B

The bgPlay command plays the specified .wav file in the background. If no extension is provided, .wav is assumed automatically.
Syntax:
BgPlay <wave file>

Tell me more!

The bgVolume command adjusts the background playback volume.
Syntax:
BgVolume <percent>

Tell me more!

The beep command produces a beep sound on the auxiliary multimedia device or on the phoneline, if connected.
Syntax:
Beep <frequency> <duration>

Tell me more!

The BlindTransfer() function blindly transfers the call to the particular extension phone.
Syntax:
$statusBoolean = BlindTransfer(<extensionNumber>)

Tell me more!

BP command automatically sets a break point inside the script.
Syntax:
BP

Tell me more!

The BREAK or EXIT command will cause the execution of the script to break out of the current WHILE loop.
Syntax:
Break

Tell me more!

C

The Calls() function obtains the number of calls handled by the current port.
Syntax:
$numInteger = Calls(<dli>)

Tell me more!

The chr() function will return the character if given its ASCII code.
Syntax:
$character = chr(<number>)

Tell me more!

The CLEAR command will immediately clear any pending ON, PLAY, RECORD and SPEAK commands and removes any pending keys from the input queue.
Syntax:
Clear

Tell me more!

ComClose() closes the serial port communication connection.
Syntax:
ComClose()

Tell me more!

ComOpen() establishes a connection with the serial port.
Syntax:
ComOpen("<Communication Port>", "<BaudRate> <Parity, Databits, Stopbits> <FlowControl>")

Tell me more!

The compare() function will compare two strings.
Syntax:
$integer = compare(<String1>, <String2>)

Tell me more!

ComRead() reads data from the serial port.
Syntax:
$buffer = ComRead(<Size>, <Timeout>)

Tell me more!

ComReadLine() reads a single line of data from the serial port.
Syntax:
$buffer = ComReadLine(<Timeout>)

Tell me more!

ComReadSize() finds out the size of the data in the serial port that are ready to be read.
Syntax:
$size = ComReadSize()

Tell me more!

ComWrite() writes data to the serial port.
Syntax:
comWrite(<buffer>)

Tell me more!

ComWriteLine() writes a line of data to the serial port.
Syntax:
ComWriteLine(<buffer>)

Tell me more!

The concat() function will return a copy of the string after appending all given strings (<string1>, <string2>, <string3>).
Syntax:
$concatenatedString = concat(<string1>, <string2>, <string3>)

Tell me more!

Convert() is used to convert the wave file into the specified wave format and saves it in a separate file.
Syntax:
$status = wave.Convert ("<Source Filename>","<Codec>","[Target Filename]")

Tell me more!

CountMessage() returns the total number of messages present in the message queue of the specified device.
Syntax:
$TotalMsg = CountMessage([DeviceId])

Tell me more!

D

The Datasize() function returns the data size of the wave file.
Syntax:
$size = wave.datasize ("<Wavefile>","[Compr]")

Tell me more!

DeleteFile() function deletes the specified file and returns boolean value true if file is deleted, false otherwise.
Syntax:
$boolean = DeleteFile(<filename>)

Tell me more!

DeviceSpecific() executes a function unique to a specific driver.
Syntax:
DeviceSpecific(<functionName>[, parameters])

Tell me more!

Dial() makes an outgoing call.
Syntax:
$bool = Dial(<Phone Number>)

Tell me more!

Display command prints messages in the Display area of the Main window.
Syntax:
Display <string>

Tell me more!

E

The Encrypt() function is to encrypt the wave file using the encryption type BLOWFISH or XOR.
Syntax
$bool = wave.Encrypt ("<Wave Filename>","<Password>","<Type>","[Destination File]")

Tell me more!

Escape() function converts the binary characters in the string to its percentage(%) hexa form.
Syntax:
$escapedString = Escape(<string>)

Tell me more!

The Exit command will cause the execution of the script to break out of the current WHILE loop.
Syntax:
Exit

Tell me more!

The ExtractXmlTag() function is used to retrieve the text in which the tag should be searched for and returns the text as per the specified offset value.
Syntax:
$xmltext = ExtractXmlTag ( <xmldata>, <starting tag>, <ending tag>, [offset] )

Tell me more!

F

The Find() function finds a character or substring inside a larger string and returns the zero-based index of the first character in the 'Master string'.
Syntax:
$index = Find(<Master string>, <Sub string>, [offset])

Tell me more!

Format() function writes formatted data to a string.
Syntax:
$formattedString = Format(fcString [,arguments]..)

Tell me more!

Fraction() function returns the fractional part of the number.
Syntax:
$Integer = Fraction(number)

Tell me more!

The Function keyword identifies the start of a user-defined function.
Syntax:
Function FunctionName ( Param1, Param2, ... )
<statements>
Return [Expression]

Tell me more!

G

The Get() is to get specific web page.
Syntax
$Page = http.Get("<URL>")

Tell me more!

The GetCallProgress() function obtains the current status of a Dial() or Transfer() operation.
Syntax:
$statusString = GetCallProgress()

Tell me more!

The Get2File() is to get specific web page into a file.
Syntax
$Status = http.Get2File("<URL>","<Filename>")

Tell me more!

The GetInfo() function retrieves information from the driver DLL.
Syntax:
$infoString = GetInfo(<attribute>)

Tell me more!

The GetTag() function is used to retrieve the remark attached to a tag/label within the wave file.
Syntax
$bool=wave.GetTag ("<Wave Filename>","<Tag>")

Tell me more!

GetMessage() function fetches a string from the message queue of the specified device.
Syntax:
$msgString = GetMessage(<deviceId>)

Tell me more!

The GetStartTime() function generates the starting date and time of the IVR.
Syntax:
$dateTime = GetStartTime()

Tell me more!

The GetTickCount() retrieves the number of milliseconds that have elapsed since the system had started.
Syntax:
$intCount = GetTickCount()

Tell me more!

The GetTime() function fetches the local date and time.
Syntax:
$dateTime = GetTime()

Tell me more!

The GOTO command causes the control of the script to jump to the specified label and start execution from that position.
Syntax:
Goto <label>

Tell me more!

H

This command causes the script to hang-up the line.
Syntax:
Hangup

Tell me more!

The hashoffile() function gives the hash value of any type of file.
Syntax
$hash = md5.hashoffile("<filename>")

Tell me more!

The hashofstring() function gives the hash value of specified string.
Syntax
$hash = $hash = md5.hashofstring ("<String>")

Tell me more!

The hashofwavedata() function gives the hash value of of wave file.
Syntax
$hash = $hash = md5.hashofwavedata("<Wavefile>")

Tell me more!

I

The IF statement will check the <condition> and if it’s true will execute the commands inside the <statements> block. If not true, the control will move to the next <condition> or block.
Syntax:
IF <condition> <statements> ELSE <statements> ENDIF

or

IF <condition1> <statements> ELSE IF <condition2> <statements> ENDIF

or

IF <condition1> <statements> ELIF <condition2> <statements> ENDIF

or

IF <condition>THEN GOTO <label>

Tell me more!

Index() function returns the zero-based index of a substring or a character inside a larger string. If sub string or character is not found, it will return -1. Index function has the same syntax as that of Find() function.
Syntax:
$index = Index(<Master string>, <Sub string>)

Tell me more!

The init() function is used to initialize the specific port in order to send and receive data.
Syntax
udp.init("<Port>")

Tell me more!

The input() function will accept numbers entered on the dial-pad by the user.
Syntax:
$inputKey = input(<max digits>, [wait in seconds], [enter key], [esc key], [mask])

Tell me more!

Integer() function returns the integral part of the number.
Syntax:
$Integer = Integer(number)

Tell me more!

IsVariable() function searches for the given variable anywhere inside the script and returns 1 if present, 0 otherwise.
Syntax:
$boolean = IsVariable("$variable")

Tell me more!

L

The left() function will return the leftmost length of the <string>.
Syntax:
$LeftString = left(<string>, <len>)

Tell me more!

The len() function will return the length of the <string>.
Syntax:
$length = len(<string>)

Tell me more!

The LOAD command will load all variables from the given file.
Syntax:
Load <filename>

Tell me more!

LoadFile() function loads the specified number of lines of text from the file to a variable.
Syntax:
$boolean = LoadFile(<filename>, <$variable>, <nooflines>)

Tell me more!

Lock() function permits one and only one script to execute inside a block of statements.
Syntax:
Lock(<name>)

Tell me more!

The Log command will log the given text into the log file maintained in the log directory.
Syntax:
Log <string>

Tell me more!

The Loop command will continue the looping in the While loop.
Syntax:
Loop

Tell me more!

The Loudness() function gives the maximum frequency of the wave within the given block size.
Syntax
$val = wave.loudness ("<Wave Filename >",[Block Size],"[Freqstoignore]")

Tell me more!

The lower() function will return a copy of the <string> converted to lowercase.
Syntax:
$lowerCaseString = lower(<string>)

Tell me more!

The ltrim() function will return a copy of the <string> after removing all the leading spaces.
Syntax:
$leadingSpaceTrimmedString = ltrim(<string>)

Tell me more!

M

The Merge() function merges two waves and store it in the specified location.
Syntax
$stat = wave.merge ("<Wavefile1>","<Wavefile2>","<Destination Filename>")

Tell me more!

Mid() function extracts a substring of length [len] characters from <string>.
Syntax:
$extractedString = mid(<string>, <start index>, [len])

Tell me more!

O

The ON command will cause a jump to the specified Label.
Syntax:
ON <key> GOTO <label>

Tell me more!

P

PLAY command will playback the specified .wav file on the phone line.
Syntax:
Play <wavefile1>[<wavefile2> <wavefile3> ... <wavefileN>]

Tell me more!

PlayTimeLeft() function returns the pending play back time in milliseconds.
Syntax:
$timeInteger = PlayTimeLeft()

Tell me more!

PutMessage() function places a string into the message queue of the specified device.
Syntax:
PutMessage(<deviceId>, <string>)

Tell me more!

R

The Random() function returns a random number less than the given number.
Syntax:
$intNum = Random(<number>)

Tell me more!

The RECORD command will record the incoming voice.
Syntax:
Record <seconds>

Tell me more!

The receive() function used to receive UDP data from a specific UDP port
Syntax
udp.receive("<Timeout>")

Tell me more!

The RecordTimeLeft() function returns the remaining time for recording.
Syntax:
$timeInteger = RecordTimeLeft()

Tell me more!

The Restart command restarts Xtend IVR from Script.
Syntax:
Restart

Tell me more!

The Reject command rejects the incoming calls.
Syntax:
Reject

Tell me more!

The Reverse() function reverses a given string.
Syntax:
$index = Reverse(<Master string>, <Sub string>)

Tell me more!

The ReverseFind() function finds a character or substring inside a larger string starting the search from the end.
Syntax:
$index = ReverseFind(<Master string>, <Sub string>)

Tell me more!

The right() function will return the rightmost length of the <string>.
Syntax:
$RightString = right(<string>, <len>)

Tell me more!

Rindex() function returns the zero-based index of a substring or a character inside a larger string starting the search from the end. Rindex() has the same syntax as that of ReverseFind() function.
Syntax:
$index = Rindex(<Master string>, <Sub string>)

Tell me more!

The rtrim() function will return a copy of the <string> after removing all the trailing whitespaces.
Syntax:
$trailingSpaceTrimmedString = rtrim(<string>)

Tell me more!

The RUN command will execute the specified program.
Syntax:
Run <exe file>
or
! <exe file>

Tell me more!

The RUNTIMEOUT command sets the timeout in seconds for any subsequent RUN commands.
Syntax:
Runtimeout <seconds>

Tell me more!

S

The Save command will save all variables to the given file.
Syntax:
Save <filename>

Tell me more!

SaveFile() function replaces the content from the variable with that of the file by the specified number of lines.
Syntax:
$boolean = SaveFile(<filename>, <$variable>, <nooflines>)

Tell me more!

The seconds() function gives the time elapsed in seconds after the process has started.
Syntax:
$timePeriod = seconds()

Tell me more!

The send() function sends data to the UDP port of the specified IP address.
Syntax
udp.send("<IP>",<Port>,"<Data>")

Tell me more!

The SetInfo() function sets the attribute of the driver.
Syntax:
SetInfo(<attribute>, <value>)

Tell me more!

The SetTag() Used to add a tag/label within the wave file.
Syntax
$bool=wave.SetTag ("<Wave Filename>","<Tag>","<Remark>")

Tell me more!

The SetVariable() function changes the scope of the variable from local to global and assigns value to all instances of the variable.
Syntax
SetVarInVar(<variable>, <value>)

Tell me more!

The Sleep command suspends the execution of the current script for a specified interval.
Synatx
Sleep <duration>

Tell me more!

The SleepEvent command suspends the execution of the current script for a specified interval of time or until an event occurs.
Syntax:
SleepEvent <duration>

Tell me more!

SoftDisconnect() function destroys a softInterconnect with a specified device.
Syntax:
SoftDisconnect(<deviceId>)

Tell me more!

SoftInterConnect() function interconnects the current device and the specified device.
Syntax:
SoftInterConnect(<deviceId>)

Tell me more!

SoftListen() function listens to a particular channel.
Syntax:
SoftListen(<deviceId>[, Type])

Tell me more!

SoftStream() function streams the Incoming, Outgoing or both audio of the current device to the incoming audio of the specified device.
Syntax:
SoftStream(<deviceId>[, Type])

Tell me more!

SoftUnlisten() function unlistens from the specified device.
Syntax:
SoftUnlisten(<deviceId>)

Tell me more!

SoftUnstream() function releases SoftStream() to the specified device.
Syntax:
SoftUnstream(<deviceId>)

Tell me more!

The SPEAK command will speak out the given text.
Syntax:
speak [String]

Tell me more!

The srAcceptWords() function defines the grammar for the subsequent Input() operation.
Syntax:
srAcceptWords(<word 1>, <word 2>, ..., <word N>)

Tell me more!

The srAudio() function specifies when the audio play back has to be stopped.
Syntax:
srAudio (<type>)

Tell me more!

The srConfidence() function determines the level of recognition for the words/grammar defined.
Syntax:
$levelInteger = srConfidence()

Tell me more!

The srGrammar() function loads grammar for speech recognition in the script.
Syntax:
srGrammar(<fileName>)
or
srGrammar(<actualXmlText>)

Tell me more!

The srKeepGrammar() function sets the grammar for the subsequent Input() operation in the script.
Syntax:
srKeepGrammar(<boolean>)

Tell me more!

SubStr() function extracts a substring from a larger string and has the same syntax as that of mid() function.
Syntax:
$extractedString = substr(<string>, <start index>, [len])

Tell me more!

T

The TIMEOUT command sets the timeout in seconds for an incoming call.
Syntax:
Timeout <seconds>

Tell me more!

The TotalCalls() function obtains the total number of calls handled by the IVR so far.
Syntax:
$numInteger = TotalCalls()

Tell me more!

The Transfer() function transfers the call to an extension phone.
Syntax:
$statusString = Transfer(<extensionNumber>, <timeout>)

Tell me more!

The Type() function returns the type of the wave file.
Syntax
$val = wave.type ("<Wavefile>")

Tell me more!

U

The upper() function will return a copy of the <string> converted to uppercase.
Syntax:
$upperCaseString = upper(<string>)

Tell me more!

The UnEscape() function reverses the Escape() process.
Syntax:
$unEscapedString = UnEscape(<string>)

Tell me more!

The UnLock() function releases the last Lock() operation.
Syntax:
UnLock()

Tell me more!

V

VoiceLog command logs the telephony audio to a specified file.
Syntax:
VoiceLog <waveFile>

Tell me more!

Volume command will adjust the playback volume of the specified .wav file.
Syntax:
Volume <percent>

Tell me more!

W

The WAIT command will wait for the specified number of milliseconds.
Syntax:
Wait <milliseconds>

Tell me more!

The WHILE command will check the <condition> and if it’s true will execute the commands inside the <statements> block until the condition becomes false.
Syntax:
while <condition>
<statements>
endwhile

Tell me more!


HotKeys

Following are the shortcuts supported by the Xtend IVR Developer Edition.

Answer lifts the handset of the simulated phone.
Shortcut:
F3

Tell me more!

Close shuts down the Xtend IVR.
Shortcut:
Alt + F4

Tell me more!

Default execution runs the current script at a normal pace.
Shortcut:
F5

Tell me more!

Edit Script loads the Xtend IVR editor with the currently loaded IVR application as its active script.
Shortcut:
F2

Tell me more!

Enable/disable IVR toggles the enabling of the IVR.
Shortcut:
F9

Tell me more!

HangUp disconnects the call.
Shortcut:
F4

Tell me more!

Help loads the Help file for Xtend IVR scripting language.
Shortcut:
F1

Tell me more!

Refresh reloads the active IVR script.
Shortcut:
F9 (Double-click)

Tell me more!

Reload reloads the driver that the runtime should use while configuring the Standard Edition.
Shortcut:
F5

Tell me more!

Single Step switches the IVR script execution into single step mode.
Shortcut:
F7

Tell me more!

Slow decelerates the script execution.
Shortcut:
F6

Tell me more!

View Log shows the system log file.
Shortcut:
Ctrl + <View Log>

Tell me more!

View System Menu pops up the system menu.
Shortcut:
Alt + <Space>

Tell me more!


Developer Edition

The Developer Edition of Xtend IVR allows the developer to create, test and debug IVR scripts without using a voice card/voice modem. To achieve this objective, the Developer Edition includes a user friendly IDE, Language specific Editor, Language Help with examples and an easy to use Configuration utility.

An on screen phone can be used to navigate and listen to prompts. All variables used by the IVR can be viewed and edited on the screen. Script execution can be single step, slow or at full speed.

This comprehensive debugging capability enables the developer to code and test the IVR without much effort. Once the IVR is completely tested and debugged, the script could be directly deployed by purchasing the Xtend IVR runtime.

The Developer Edition can simulate a telephony environment using Multimedia system only. As a result, the number of live resources that you require is less. If you require a demo or a test implementation on actual telephone lines, you should purchase the Standard Edition.

The developer edition of Xtend IVR is completely free and can be downloaded from http://www.xtendtech.com/downloads


Standard Edition

The Xtend IVR Standard Edition comprises of Developer Edition and Xtend IVR Runtime. There are different versions of Runtime based on the number of ports. The Runtime can support right from a single line to even 512 lines or more, depending on the customer requirements. The number of ports supported by the Runtime should be specified at the time of purchase and is mentioned in the "About box" accessible from the Main Window.

The Standard Edition is a rugged server class solid product that offers stability and efficiency. It is the Standard Edition that we actually deploy at the user's site.

The greatest advantage of Xtend IVR Standard Edition is its scalability, i.e., suppose a user having a 4 line Standard Edition deployed in his site wants to increase the number of telephone lines supported by the system to 30 lines. All he has to do is to increase his license from 4 to 30 lines. He does not have to change single line of the code as a result of customization.
Features of Xtend IVR
Built In Scripting Language | Built-in scripting language
 | The power of Xtend IVR resides in its scripting language which is simple to learn, flexible and easy to code. Complex telephony operations like call transfer, speech recognition etc. can be coded in just a couple of lines of script.
24/7 Uptime Tested | 24/7 Uptime Tested
 | All runtimes are extensively tested with more than 10,000+ calls to ensure rock solid stability.
Support for Multiple Voice Devices | Support for Multiple Voice Devices
 | Xtend IVR implements a driver model for interfacing with voice devices. This enables Xtend IVR to support practically any voice device available in the market. At present, the available drivers from Eicon and Dialogic support Digital (E1/T1), SS7, H323 & SIP and Analog voice devices. Some of the supported devices include Diva Server PRI/E1, Diva Server Analog 4P, Diva Server V-PRI/E1, Diva Server V-4PRI, Diva Server V-PRI/T1, Diva Server Soft SS7, Diva Server SoftIP, D/4 PCI, D/4 PCI UF, D/300 JCT E1 etc. Complete reference implementations of the Xtend IVR driver for Diva Server API and Global Call API is available for manufacturers desiring to support their voice device. Additional voice devices will be supported on an ongoing basis, depending on customer requests and device availability.
Comprehensive Database Support | Comprehensive Database Support
 | Xtend IVR provides simple database functions to access SQL Server, DB2, Oracle, Sybase, Access and other standard databases via ADO and ODBC. In most cases, direct SQL statements can be inserted inside the script to obtain the required data. Advanced database functionality can be implemented by interfacing to any of the supported languages.
Language Interfaces | Language Interfaces
 | The scripting language includes the ability to call functions written in Vbscript, Javascript and Perlscript (Windows Scripting Host), functions written in C# or VB.Net (.Net Framework) and the ability to call programs written in Foxpro, Clipper, Visual Basic, C, C++ and other legacy languages.
Scalability and Multi-Port support | Scalability and Multi-Port support
 | Xtend IVR works right from a single port voice device to a 512 port T1/E1 solution with NO changes in code. This means that when coding for a single port IVR, if the developer extends multi-thread support, then the same can be deployed for a 512 port IVR also. Xtend IVR also supports clustering of systems to provide for higher port densities of 1000+ ports and to provide for fail-over/redundant backup.
Support for Text to Speech and Speech Recognition | Support for Text to Speech and Speech Recognition
 | Xtend IVR supports all Speech API 4.x and 5.x compatible engines for Text to Speech. UT8 strings are supported for enabling TTS of foreign language speech engines. All Speech API 5.x engines provide support for Speech Recognition including the ability to dynamically create and load multiple recognition grammars, perform speech cut-through on complete recognition of sentence or on recognition of the first word or in presence of speech.
Multi-language prompts | Support for Multi-language prompts and Number to Speech
 | The scripting language is designed from ground up for easy multi-language prompt support and enables the user to implement IVR support for multiple languages quickly. The innovative number to speech technology enables numbers, dates etc. to be spoken out in English, Hindi or Malayalam.
Advanced Features | Advanced Features
 | Xtend IVR supports advanced features like background play, real-time voice snooping and mixing and voice logging capability that enables one to provide superior voice solutions with minimal effort.
Service Ports | Service Ports
 | Support for general purpose ports to implement additional functionality not directly related to, but playing a supporting role to the IVR such as, polling a serial device every 10 seconds or for retrieving mails every 3 minutes etc. These general purpose ports run the same scripting language, enabling one to quickly implement background tasks.
Multimedia Ports | Multimedia Ports
 | Support for multimedia devices for streaming audio to multiple channels. For instance, the input of the sound card mic can be taken and provided to all callers who dial into the system. Such an implementation could be used for providing a real-time radio/music channel service to callers.
Run-time Customization | Run-time Customization
 | Xtend IVR has the capability to change the logo bitmap and also determine the messages that appear in the window title and its About dialog box so as to facilitate developer customization.
Fully Internet Enabled | Fully Internet Enabled
 | Directly obtain a web page or mail, post data to web site, send or receive e-mail and communicate with web services. HTTP, HTTPS, SMTP, POP3 are supported.
Plugin Interfaces | Plugin Interfaces
 | Xtend IVR supports a plugin interface to enable easy extensions to its scripting language. This permits implementation of additional functionality if such customization is required. For example, the in-built database functionality and SMTP/POP3 access is implemented as plugins.
Script Compiler | Script Compiler
 | Xtend IVR supports compiled scripts, so that end user modification of script files can be prevented. To prevent any sort of tampering, Xtend IVR scripts are tokenized, encrypted and check summed.
Full fledged Developer Edition | Full-fledged Developer Edition
 | Unlike a conventional development environment which requires the use of two phone lines to test and debug the IVR prompts, the Xtend IVR Developer Edition simulates an incoming call in software which allows the IVR development to be done on any multimedia system. In fact the developer edition is completely free for you to try out and can be downloaded from http://www.xtendtech.com/downloads.


Frequently Asked Questions

Xtend IVR - FAQ

  • What is the difference between a STANDARD edition and a DEVELOPER edition?
  • How do I start Xtend IVR?
  • Why do I get the error message "HASP not found"?
  • How many phone lines does Xtend IVR support?
  • Does Xtend IVR support regional languages via TTS?
  • The Operating Systems under which Xtend IVR works.
  • What kind of user support is provided?
  • What are the enhancements made to Xtend IVR Ver 2.50?
  • What are the system requirements for Xtend IVR?
  • What are the devices supported by Xtend IVR?
  • Which is the latest version of Xtend IVR?
  • Is speech recognition possible in Xtend IVR?
  • Will Xtend IVR detect pulse and tone dialing?
  • Does Xtend IVR support analog and digital lines?
  • Is Xtend IVR freely distributable?
  • Is database access possible?
  • Play command and Record command do not work simultaneously in Xtend IVR.
  • Do you need a Sound card to run Xtend IVR?
  • What is the Sampling rate of a recorded file?


System Requirements

Developer Edition

  • Pentium – 200 MHz.
  • 64 MB RAM.
  • 1.2GB HDD (40 MB for installation).
  • Sound Card, Head Phone/Speaker and Microphone.
  • Windows 98SE/Me/NT 4.0/2000/XP
  • SAPI 5.0 (Speech API).

Standard Edition
  • Pentium – 400 MHz.
  • 256 MB RAM.
  • 1.2GB HDD (65 MB for installation).
  • Voice Modem/Voice Cards.
  • Windows 98SE/ME/NT 4.0 (No Voice Modem Support)/2000/XP.
  • SAPI 5.0 (Speech API).

Typical CPU load:

    10% CPU Usage on a PIII 1 Ghz system, 128 MB, NT 4.0 Workstation
    16 IVR ports in use i.e. 4 D/4 PCI (Dialogic Voice Cards)
    Database not in use. TTS not in use.


What is New in 3.0?

  • New Language Features
    • Support for multimedia devices for streaming audio to multiple channels.
    • Xtend IVR supports compiled scripts to prevent end user modification of the script.
    • Multi-lingual prompt support.
    • User defined functions.
    • Script chaining capability.
    • IVR can now use dial command for dial out applications like payment reminder.
    • Optimized script engine to execute faster with minimum load on the processor.
    • Added boolean constants TRUE and FALSE which can be used wherever a literal or variable is permitted.
    • Modified conditional statements that support evaluation to TRUE.
    • Capable of comparing literals of string data type.
    • Macro capability to refer a variable inside a variable.
  • New Engine Features
    • Audio Compression Manager (ACM) is supported so all wave file format can be played back.
    • Support for mutliple voice devices. Some of them include Diva Server PRI/E1, Diva Server Analog 4P, Diva Server V-PRI/E1, Diva Server V-4PRI, Diva Server V-PRI/T1, Diva Server Soft SS7, Diva Server SoftIP, D/4 PCI, D/4 PCI UF, D/300 JCT E1 etc.
    • PCT-AN-4 supported.
  • New User Interface Features
    • Tooltip display for variable values when cursor is positioned on source window.
    • Adding break points during execution.
    • Menu options in Main Window can be enabled/disabled in the runtime.
    • Plugin interface to enable easy extensions to scripting language.
  • New Plug-ins
    • Database: Built-in support for operations on ODBC/ADO databases. This means that information present in these databases can be accessed directly from the script without an integration with other languages, thereby making it very easy to write exam result announcement systems, Booking systems, Bank balance query systems and other database query or update systems in a few lines of code. Look at XIVR\Samples\BankBalance for a comprehensive example of using the database plug-ins.
    • Date: Built-in support for handling date variables. Using the plugins, we can validate the dates, add or subtract 2 dates, fetch day/month/year information from the given date.
    • Files: Built-in support for efficient usage of files and folders. Plugins have been developed to fetch the file information and set its attributes, retrieve values of Environment variables and execute an application from the Xtend IVR script. You can perform file/ folder validation, copy the contents, move it to another location and also delete the file from the folder, in addition to creating a temporary file in the given path.
    • Internet: Built-in support for Internet Operations like HTTP Get/Post, SMTP and POP3 enable easy integration of Xtend IVR with existing internet systems. The ability to Get and Post information to the World Wide Web enables Xtend IVR to easily push or retrieve data from Web based information systems. SMTP and POP3 plug-ins enable Xtend IVR to transmit or retrieve E-Mail from any source. Look in the Samples\WorldTime directory for a comprehensive example of using the Internet plug-ins.
    • Maths: Built-in support for performing mathematical and numerical operations. Thus, it is possible to find the absolute value, natural logarithm and square root of a number. You can also find the nearest Integer greater than and lesser than the given digit. Given a decimal number, you can round the digit to specific decimal places. You can evaluate an expression and return the value to perform further mathematical operations.
    • Number To Speech: Built-in support for announcing dates, amounts and numbers in Indian English and Hindi.
    • Time: Built-in support for managing time instances/variables. Thus, you can add hours/minutes/seconds to an instance of time, convert the time into a 12-hour clock or 24-hour clock format, add or subtract 2 instances, extract hour/minute/seconds element and also validate the time.
  • New System Variables
    • $CallType
    • $DeviceName
    • $DriverName
    • $InputMode
    • $Rli
    • $Version
    • $WavDir
  • New Commands
    • Beep
    • BgPlay
    • BgVolume
    • Bp
    • Dial
    • Sleep
    • VoiceLog
  • New Functions
    • ActiveCalls()
    • ActivePorts()
    • AtomicAdd()
    • AtomicGet()
    • AtomicSet()
    • Calls()
    • ComClose()
    • ComOpen()
    • ComRead()
    • ComReadLine()
    • ComReadSize()
    • comWrite()
    • DeleteFile()
    • DeviceSpecific()
    • Escape()
    • Find()
    • Format()
    • GetCallProgress()
    • GetInfo()
    • GetMessage()
    • GetStartTime()
    • GetTime()
    • LoadFile()
    • Lock()
    • PlayTimeLeft()
    • PutMessage()
    • RecordTimeLeft()
    • ReverseFind()
    • SaveFile()
    • Seconds()
    • SetInfo()
    • SetVariable()
    • SoftDisconnect()
    • SoftInterConnect()
    • SoftListen()
    • SoftStream()
    • SoftUnlisten()
    • SoftUnstream()
    • srAcceptWords()
    • srAudio()
    • srConfidence()
    • srGrammar()
    • srKeepGrammar()
    • TotalCalls()
    • Transfer()
    • UnEscape()
    • UnLock()


sample - Function

 *--------------------------------------------------------------------
* Script : Sample- Function
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Tool kit that implements
* function as a separate ivr file. The function and the file must
* have the same name.
* --------------------------------------------------------------------

:GET_ACCOUNT_NUMBER

* Accept account code from customer
* ---------------------------------
wait 0
Speak "Please punch in your account number after pressing the star key."

if $Debug == 1
FlashBox(TopRight,"\n Valid Account Numbers:\n\n Account PinCode\n 1111 1234\n 2222 2345\n 3333 3456\n 4444 4567\n 5555 5678\n 6666 6789\n\n")
endif

$Acno = Input(4,3,#,*)

if $Debug == 1
FlashBox(Close)
endif

if Len($Acno) = 0
Speak "Invalid Account code"
Speak "Access Denied"
goto GET_ACCOUNT_NUMBER
endif

Return $Acno
*---------------------------------------------------------------------------------------------


sample-Speak & Goto

*-------------------------------------------------------------
* Script : Sample-Speak&Goto
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*-------------------------------------------------------------
:MAIN

answer 3

speak "Hello"
speak "How Are You"

$Msg = "Hello , How are you"

speak $Msg

volume 200

speak “Hello , How are you”
hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Input

*------------------------------------------------------------
* Script : Sample-Input
* Date : 1st February 2003
* Notes : Sample script for XIVR Toolkit.
*-------------------------------------------------------------

:MAIN

answer 2

speak "Enter a five digit number"
$Number = input(5)
speak $Number

; Wait for 5 seconds & accept 5 digits.

speak "Enter a five digit number"
$Number = input(5,5)
speak $Number

; Wait for 5 seconds and if # is pressed, then input function will cease accepting the values.

speak "Enter a five digit number"
$Number = input(5,5,#)
speak $Number

; Wait for 5 seconds. Press # to end input or Press * to clear input buffer and start again.

speak "Enter a five digit number"
$Number = input(5,5,#,*)
speak $Number

hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Record

*------------------------------------------------------------
* Script : Sample-Record
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*------------------------------------------------------------

MAIN:

answer 2

speak "Starting speech recording right now"

record 5

wait 0

play $RecordFile

wait 0

hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-OnTimeOut

*---------------------------------------------------------
* Script : Sample-OnTimeOut
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*---------------------------------------------------------

:MAIN

answer 2

$A = 1

timeout 5

while $A = 1
display "Timeout will occur in 5 seconds"
wait 0
endwhile

:ONTIMEOUT

speak "Time out"

wait 0

hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Load

*--------------------------------------------------------
* Script : Sample-Load
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*--------------------------------------------------------
:MAIN

answer 2

load "c:\Xtend IVR Test Suite\tutorial\sample.txt"

speak $SampleVal
speak $SampleName

save “allvars.txt”

hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Clear

*---------------------------------------------------------
* Script : Sample-Clear
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*---------------------------------------------------------
:MAIN
    answer 2
    speak "Hello World Hello World Hello"
    speak "World Hello World Hello World"
    speak "World Hello World Hello World"
    clear

    hangup
    goto MAIN

:ONSYSTEMERROR
    log $Error
    Clear
    hangup
    goto MAIN

:ONHANGUP
    hangup
    goto MAIN
*-------------------------------------------------------------------


sample-Log

*----------------------------------------------------------------
* Script : Sample-Log
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*----------------------------------------------------------------

MAIN:

answer 2

$a = 10
$b = 0

; A Divide by Zero error will occur and the execution will jump
; to the ONSYSTEMERROR label where the LOG command
; will log the $Error variable for future reference.

$c = $a / $b
hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Shift

*-----------------------------------------------------------------------------
* Script : Sample-Shift
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*------------------------------------------------------------------------------

:MAIN

answer 2

speak "Enter a 4 digit number"
$Num = Input(4,6,#,*)
speak "The number you entered is " $Num
wait 1

$Opr =1
$Rs = $Num << $Opr

speak "The value got after using, bitwise operator, Shift Left with " $Opr

speak " on value " $Num " is " $Rs
wait 200

$Ls = $Rs >> $Opr

speak "The value got after using, bitwise operator, Shift Right, with " $Opr
speak " on value " $Rs " is " $Ls

wait 1
hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Break

*--------------------------------------------------------------------
* Script : Sample-Break
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*--------------------------------------------------------------------

:MAIN

answer 2

$Count = 1
speak “Entering loop”

while $Count < 100

if $Count = 10
break
endif

$Count = $Count + 1
endwhile

speak “Exiting loop”

hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Ascii() & Chr()

*----------------------------------------------------------------
* Script : Sample-Ascii()&Chr()
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*---------------------------------------------------------------

:MAIN

answer 2

on # goto STOP

$ctr = 65
$end = ascii("Z")

while $ctr <= $end

$b = chr($ctr)
speak $b
wait 0

$ctr += 1

endwhile

:STOP

hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Mid()

*--------------------------------------------------------------------
* Script : Sample-Mid()
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*---------------------------------------------------------------------

:MAIN

answer 1

// "EXtending" "E" is added to get good accent
$word = "EXtending Technologies"

speak $Word "is spelled as "

// When spell, "E" has to be ignored. That is why $ctr is set to 1

$ctr = 1

:LP

while $ctr <= len($Word)

$a = mid($Word,$ctr,1)
speak $a
wait 0
$ctr += 1

endwhile

hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear
hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-Len()

*---------------------------------------------------------------
* Script : Sample-Len()
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*---------------------------------------------------------------

timeout 10

:MAIN

answer 2

$Flag = 0

:REP

speak "Please enter a number"
$a = input(3,2)

if len($a) = 0 then goto REP

speak "Please wait."
speak "Let me compute the sum of " $a "numbers"

$ctr = 0
$sum = 0
$Flag = 1

while $ctr <= $a

$sum = $sum + $ctr
$ctr += 1
endwhile

$Flag = 2
speak "The sum of " $a "numbers is " $sum
wait 0

hangup
goto MAIN

:ONTIMEOUT

if $Flag = 1
speak "The number you entered is too big”
speak “to compute within 10 seconds"
wait 0
hangup
goto MAIN
endif

if $Flag = 0
speak "Time is up. Good bye"
wait 0
endif
hangup
goto MAIN

:ONSYSTEMERROR

log $Error
Clear

hangup
goto MAIN

:ONHANGUP

goto MAIN

*---------------------------------------------------------------------------------------------


sample-WaveSave & WaveRestore & WaveDelete

 *--------------------------------------------------------------------------------------
* Script : Sample- WaveSave & WaveRestore & WaveDelete
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit that implements WaveSave,
* WaveRestore and WaveDelete plugins.
*-------------------------------------------------------------------------------

:BEGIN

answer 1

speak "please mention the matter in minimum words , recording starts now"
wait 0
record 10
wait 0

*save the voice data to the database wavedb
WaveSave $RecordFile

*restores the voice data with the current waveid to the file
$RecordFile = "C:\test.wav"
WaveRestore $waveid
play $RecordFile
wait 0

*delete this record from the database
WaveDelete $waveid

if $ErrorNo == -1
speak "Unable to restore wav file in mdb file"
hangup
goto BEGIN
endif

:ONSYSYSTEMERROR

log $Error
hangup
goto BEGIN

*---------------------------------------------------------------------------------------------


sample - GetMail() & SendMail()

 *---------------------------------------------------------------------------------
* Script :Sample- GetMail() & SendMail()
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit that implements SendMail() and GetMail() plugins.
*---------------------------------------------------------------------------------
:BEGIN
    answer 1

    $pop3.server = "192.168.1.1"
    $pop3.user = "someone@xtnet.com"
    $pop3.password = "1234asd"
    $pop3.msgno = 0
    if GetMail("$pop3") == 0
        hangup
        MsgBox $error
        goto BEGIN
    endif

    $smtp.server = "192.168.1.1"
    $smtp.from = "somebody@rediff.com"
    $smtp.to = "support@xtnet.com"
    $smtp.subject = "Testing Email plugin"
    $smtp.body = "Testing"
    if SendMail("$smtp") == 0
        hangup
        MsgBox $error
        goto BEGIN
    endif

    hangup
    goto BEGIN

:ONSYSTEMERROR
    log $error
    hangup
    goto BEGIN

*--------------------------------------------------------------------------------------------------


sample-VoiceLog

*--------------------------------------------------------
* Script : Sample-VoiceLog
* Date : 1st February 2003
* Notes : Sample script for Xtend IVR Toolkit.
*--------------------------------------------------------
MAIN:

    display "Waiting for call."

    while true
        $status = GetCallProgress()
        if Find($status,"CONNECTED") == 0
            break
        endif
    endwhile

    if Find($DeviceName, "Pair for") == -1
        $Curr = GetTime()
        $File = Format("%04u%02u%02u%02u%02u%02u-%03u.wav", mid($curr,0,4), mid($curr,5,2), mid($curr,8,2), mid($curr,11,2), mid($curr,14,2), mid($curr,17,2), $DeviceId)

        VoiceLog $File
    endif

    display "CONNECTED:" $cli $dli

    while true
        $status = GetCallProgress()
        if Find($status,"DISCONNECTED") == 0
            break
        endif
    endwhile

    hangup
    goto MAIN

ONHANGUP:
    hangup
    goto MAIN

ONSYSTEMERROR:
    log $error
    display $error
    hangup
    goto MAIN

*---------------------------------------------------------------------------------------------


Sample Scripts

Sample scripts are provided as a learning aid for the developers. Almost all the commands and functions described in the manual are used in these scripts. Any doubts regarding the usage of these commands can be resolved by browsing through these scripts.

Ascii() and Chr() functions are demonstrated here.

Break command is demonstrated here.

Clear command is demonstrated here.

ComClose(), ComOpen(), ComReadLine(), ComReadSize() and ComWrite() functions are demonstrated here.

Function is demonstrated here.

GetMail() and SendMail() plugins are demonstrated here.

Goto and Speak commands are demonstrated here.

Input() function is demonstrated here.

Len() function is demonstrated here.

Load command is demonstrated here.

Log command is demonstrated here.

Mid() function is demonstrated here.

ONTIMEOUT label is demonstrated here.

Record command is demonstrated here.

Shift Operator is demonstrated here.

srAcceptWords(), srConfidence() and srKeepGrammar() functions are demonstrated here.

VoiceLog is demonstrated here.


Language Reference

The power of Xtend IVR lies in its simple, flexible but powerful script language. The script language is very easy to learn, as the syntax is very similar to that of the BASIC language. Language requires no previous knowledge of any kind of programming or scripting.

Language is flexible in the sense that you can extend the language by adding your own commands in the script. This is done through a mechanism called Plugins. These Plugins are located in a separate directory called Plugins. When you install Xtend IVR Toolkit, you will get some pre built Plugins.

  • Basic Features
  • Comments
  • Labels
  • Variables
  • Operators
  • Commands
  • Conditional Statements
  • Loop Statements
  • Functions
  • Commands and Functions


ON key Goto

On <key> GoTo <label>
Note: Now Obsolete

    On command will cause a jump to the specified <label> if the given <key> has been pressed.
Parameters
    <key> Key to be pressed.
    <label> Label to jump on.
Remarks

  • On command setting is automatically cleared when Wait command times out or if any of the keys having an effect is pressed.
Example
    On # GoTo EXIT_MENU
On 1 GoTo MENU_1
On 2 GoTo MENU_2

:TRYAGAIN
Play "Menu.wav"
Wait 5
GoTo TRYAGAIN

:MENU_1
Play "Menu1.wav"
…
…

:MENU_2
Play "Menu2.wav"
…
…

:EXIT_MENU
Hangup


SbPlay

 SbPlay <wave file>
    Plays the specified ".wav" file on the sound blaster. If no extension is provided, .wav is assumed automatically.
Parameters
    <wave file> Wave file to be played.
Remarks
    None.
Example

MAIN:

   Answer

   SbPlay "welcome.wav"
   wait 0

   $RecordFile = "c:\recordedfile.wav"

   SbPlay $RecordFile
   wait 0

   hangup
   goto MAIN

:ONSYSTEMERROR
   log $Error
   Clear
   hangup
   goto MAIN

:ONHANGUP
   goto MAIN


Dial()

 $bool = Dial ("<PhoneNumber>")
    Dials the phone number of the user to make an outgoing call.
Parameters
    <PhoneNumber> Specify the phone number of the user to be called.
Return Value
  • If successful returns TRUE, else returns FALSE.
Remarks
  • An outgoing call is made to the phone number given.
  • Asynchronous dial() only initiates the function before it falls through. To know the status of the dial out function, use GetCallProgress().
Example

$Status = Dial("1234567890")

while true
    $Status = GetCallProgress()

    if $Status == "CONNECTED"
        Play "Welcome.wav"
        wait 0

        break
    endif

    sleep 250
endwhile
The function dials the number "1234567890". Meanwhile, the call progress is monitored. If $Status shows "CONNECTED" the system welcomes the user and breaks out of the loop.


GetVarInVar()

GetVarInVar ( $variable )

or

$$variable

    The GetVarInVar() function is used to refer to a variable which is in another variable.

Parameters

    $variable It contains another variable whose value is to be referenced.

Example

    $Var = "abcd"
$Var1 = $Var
$Var2 = GetVarInVar($Var1)
  • $Var2 now contains "abcd". $$Var2 can also be used directly instead of GetVarInVar() function.


IsVarInVar()

IsVarInVar ( $variable)

    The IsVarInVar() function will return true if the variable which is given, refers to another and if that variable has already been declared ,otherwise false.

Parameter

    $variable The variable which contains another which is to be checked for its existence.

Remarks

  • IsVarInVar() returns false, if the variable which is referenced does not exist. i.e.,
$Var4=$Var3
IsVarInVar($Var4) will return false since $Var3 is not declared.
  • IsVarInVar() returns false, if the variable does not contain another variable. i.e.,
IsVarInVar($Var5) will return false, if $Var5 is not declared.

Example

    $Var1 = 0
    $Var2 = $Var1

  • IsVarInVar($Var2) returns true


PlayInput()

$key = PlayInput ( < WaveFile > , < max digits > , [ wait in seconds ] ,
[enter key] , [esc key] , [Mask] , [ NoofRepeats ] )

    PlayInput() command will playback the specified .wav file on the phone line and accept the user input. If no extension is provided, “.wav” is assumed. A string variable can be used in place of the wave filename. The play begins immediately and happens in the background.

Parameters

    $key Variable which accepts the input.
    <Wave file> The .wav file to be played.
    <max digits> Maximum number of digits entered on the dial pad by the user.
    [wait in seconds] Waits for the duration [seconds] for any further inputs or until the [enter key] is pressed. This is optional.
    [enter key] Enter key is for an early exit from the wait duration [seconds].
    [esc key] Optional and will erase the previously pressed keystrokes, allowing re-entry.
    [Mask] Optional and is used for filtering the input. Defaults options are "0123456789".
    [NoofRepeats] Number of times the file should be played repeatedly. This is an optional argument.

Remarks

  • The PlayInput() function has the combined effect of using Play and Input functions.

Example

$key = PlayInput("punchaccount.wav",4, 5, #,*)

$key = PlayInput("punchaccount.wav",4, 5, #,* ,"13579",2)
  • In the first example PlayInput function plays the wave file "punchaccount.wav" accepting a 4 digit input or wait for 5 seconds which ever is earlier. In the second example only odd numbers are accepted as input since the input mask is "13579".


PlayMenu()

$key = PlayMenu( <Wavefile> , <options> ,< DelayBetweenPromptsInSec> , <NoofRepeats> )

    The PlayMenu() function plays the menu wav file.If no extension is provided, “.wav” is assumed.

Parameters

    $key Variable which accepts the input.
    <Wavefile> The .wav file to be played.
    <options> Options in the wav file that are to be accepted Options other than the given will not be accepted.
    < DelayBetweenPromptsInSec> Time delay between playing any two options.
    < NoofRepeats> Number of times the menu is to be played repeatedly.

Remarks

    Defaults are:
  • options = "0123456789"

  • DelayBetweenPrompts=4

  • NoofRepeats=3

Example

    $key =PlayMenu("prompt.wav", "123", 4, 3)

  • They will play the options in the file "prompt.wav " repeatedly 3 times with a delay of 4 seconds between each options and accepts either of the options 1,2 or 3.


SetVarInVar()

SetVarInVar ( < $variable > , < $value > )

The SetVarInVar() function will set the given value to the variable, which is stored in another variable.

Parameters

    $variable The variable which contains another variable whose value is to be set.
    $value Value to be set for the variable.

Example

    $Var1 = 2
$Var2 = $Var1
SetVarInVar($Var2 , 4)
  • Now the value of $var1 will be set to 4.


SpeakInput()

$key = SpeakInput (< Text >, < max digits > , [wait in seconds] ,
[enter key] , [esc key] , [Mask] , [NoofRepeats] )

    The SpeakInput() function speak out the given text string if a suitable Text To Speech (TTS) Engine has been installed on that system and accepts the input from the user.

Parameters

    $key Variable which accepts the input.

    < Text > The text to be spoken out.

    < max digits > Maximum number of digits entered on the dial pad by the user

    [wait in seconds] Waits for a duration of [seconds] for any further inputs or until the [enter key] is pressed.This is optional.

    [enter key] Enter key is for an early exit from the wait duration [seconds] .

    [esc key] Optional and will erase the previously pressed keystrokes, allowing re-entry.

    [Mask] Optional, and is used for filtering the input.

    [NoofRepeats] Number of times the text should be repeated.This is an optional argument.

Remarks

The speakInput() function has the combined effect of using the Speak and Input functions.

Example

     $key= SpeakInput("Enter your account number",4, 5, #,*)

  • In the above example the function speaks out the text "Enter your account number" and accepts a 4 digit input or wait for 5 seconds which ever is earlier.


SpeakMenu()

$key = SpeakMenu ( < Text > ,< Options > , <DelayBetweenPromptsInSec> , <NoofRepeats>)

    The SpeakMenu() function speaks out the given text string if a suitable Text To Speech (TTS) Engine has been installed on that system and accepts user input.

Parameters

    $key Variable which accepts the input.

    < Text > The menu text string to be spoken out.

    < Options > Options in the text string that are to be accepted.

    <DelayBetweenPromptsInSec> Time delay between speaking out any two options.

    < NoofRepeats> Number of times the text menu is to be spoken out repeatedly.

Remarks

    Defaults are:
  • options = "0123456789"

  • DelayBetweenPrompts=4

  • NoofRepeats=3
    •

Example

     $key = SpeakMenu("prompt.wav", "123", 4, 3)

  • It will play the options 1,2 and 3 in the file "prompt.wav " repeatedly 3 times with a delay of 4 seconds between each options.


Strings

String Operations

The following are the string operations in Xtend IVR.
  • Alltrim()
  • Ascii()
  • Chr()
  • Compare()
  • Concat()
  • Find()
  • Format()
  • Index()
  • Len()
  • Lower()
  • Ltrim()
  • Mid()
  • ReverseFind()
  • Rindex()
  • Rtrim()
  • Substr()
  • Upper()


WaveStorage

Plugins
Database | : List of database plugins.
Date | : List of plugins used to handle date.
File | : List of plugins used to handle files and folders.
Internet | : List of plugins used to manipulate Internet.
Maths | : List of plugins for mathematical and numerical operations.
Number To Speech | : Plugins to convert numbers into audio files.
Time | : List of plugins used to handle time.
Wave Storage | : Stores and retrieves the wave files.(Note: Now Obsolete)
Miscellaneous | : Plugins for other operations.


Internet

Database Plugins

Close | : Closes the connection with the database.
Open | : Establishes connection with the database and executes the query.
RunSQL | : Executes the query for database operation.
Skip | : Moves the record pointer to the subsequent record.


Date

Date Plugins

AddDay | : Adds or subtracts specified number of days to the given date.
AddMonth | : Adds or subtracts specified number of months to the given date.
AddYear | : Adds or subtracts specified number of years to the given date.
Cmp | : Calculates the number of days between two dates.
GetCDay | : Returns the real name of the day in the given date expression.
GetCMonth | : Returns the name of the month in the given date expression.
GetDay | : Returns an integer representing the day in the given date expression.
GetMonth | : Returns the month of the year in the given date expression.
GetYear | : Returns the year in the given date expression.
IsLeapYear | : Returns Boolean value for leap year checking.
IsValid | : Determines whether a variable's value can be converted to a date.


    APPENDIX I

    The following Table illustrates the Data Types supported by Xtend IVR Database Plugins.

ODBC | DAO
SQL_CHAR SQL_REAL SQL_NUMERIC SQL_VARCHAR SQL_SMALLINT SQL_INTEGER SQL_BIT SQL_FLOAT SQL_DOUBLE SQL_DATE SQL_TIME SQL_TIMESTAMP SQL_TINYINT | Boolean Byte Short Long Currency Single Double Date/Time Text


APPENDIX II

Connection Type other than DAO and ODBC

DBMS | Connection Type | ["Database"] parameter for dbOpen()
dBASE III | "dBASE III" | "drive:\path"
dBASE IV | "dBASE IV" | "drive:\path"
FoxPro 2.0 | "FoxPro 2.0" | "drive:\path"
FoxPro 2.5 | "FoxPro 2.5" | "drive:\path"
FoxPro 2.6 | "FoxPro 2.6" | "drive:\path"
Btrieve | "Btrieve" | "drive:\path\filename.DDF"
Excel 3.0 | "Excel 3.0" | "drive:\path\filename.XLS"
Excel 4.0 | "Excel 4.0" | "drive:\path\filename.XLS"
Excel 5.0 | "Excel 5.0" | "drive:\path\filename.XLS"
Paradox 3.x | "Paradox 3.x" | "drive:\path"
Paradox 4.x | "Paradox 4.x" | "drive:\path"

Examples for the above are as follows:

For a 'Btrieve' DBMS, ["Database"] parameter for dbOpen() is "C:\Employee.ddf"
For a 'Excel x.0 ' DBMS, ["Database"] parameter for dbOpen() is "C:\Employee.xls"


dbAddNew ()

 dbAddNew ( [ "AliasName" ] )
    Prepares to add a new record in the table, call dbUpdate() to complete the operation.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
  • If Success, return 1; Otherwise –1.
Remarks
  • After calling dbAddNew(), set the Xtend IVR database variables which represents the table fields with new values and call dbUpdate() to make the changes. The new record is added in the table as last record.
Example

......
dbSetType("ODBC")
dbOpen("EMPDSN","Employee")
dbAddNew("Employee")
$Employee.Name ="John"
$Employee.Sal=5000
$Employee.Age=35
dbUpdate("Employee")
dbClose("Employee")
......
......
Note: Now obsolete.


dbBOF ()

 dbBOF ( [ "AliasName" ] )
    Calls this function to determine if the Beginning of file (BOF) is reached or record pointer placed before the first record.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
  • If BOF is reached, return 1; otherwise 0.
Remarks
    None.
Example

dbSetType ("DAO")
dbOpen ("c:\students\Details.mdb","Marks","Result")
dbGoBottom ("Result")
while dbBOF ("Result") = 0
    if  dbSkip ("Result",-1) <> -1
       speak  $Result.Name
       speak  $Result.TotalMarks
    endif
 endwhile
Note: Now obsolete.


dbClose ()

 dbClose ( [ "AliasName" ] )
    To close the opened database connection and clear the associated variables.
Parameters
    [ "AliasName" ] A valid database alias name representing the opened database.
Return Value
  • If BOF is reached, return 1; otherwise 0.
Remarks
    None.
Example
    dbSetType("DAO")
dbOpen("e:\sales\sales.mdb","Despatch")
dbClose("Despatch")
Note: Now obsolete.


dbDelete ()

 dbDelete ( [ "AliasName" ] )
    To delete the Current Record.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
    If Success, return 1; Otherwise 0
Remarks
  • After deleting the current record, the record just behind it becomes the current record.
Example
    ......
......
dbOpen("c:\stock\stock.mdb","List")
dbGoTo("List",500)
dbDelete("List")
......
......
dbClose("List")
Note: Now obsolete.


dbEdit ()

 dbEdit ( [ "AliasName" ] )
    Prepares to edit the current record, call dbUpdate() to complete the operation.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
    If Success, return 1; Otherwise 0.
Remarks
  • After calling dbEdit() make changes to the fields and call dbUpdate() to save the changes.
Example

......
dbSetType("ODBC")
dbOpen("EMPDSN","Employee")
dbGoTo("Employee",100)

if  compare($Employee.Name,"John")=1
      dbEdit("Employee")
      $Employee.Sal=5000
      $Employee.Hra=1500
      dbUpdate("Employee")
endif

      dbClose("Employee")
......
......
Note: Now obsolete.


dbEOF ()

 dbEOF ( [ "AliasName" ] )
    Call this function to determine whether the end of file (EOF) is reached or scrolled past the last record.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
  • If EOF is reached, return 1; Otherwise 0.
Remarks
    None.
Example
    dbSetType("DAO")
dbOpen("c:\students\Details.mdb","Marks","Result")
while dbEOF("Result") = 0
    if dbSkip("Result",1) <> -1
       speak  $Result.Name
       speak $Result.TotalMarks
    endif
 endwhile
......
......
dbClose("Result")
Note: Now obsolete.


dbFind ()

 dbFind ( [ "AliasName" ] , [ "Filter" ] )
    To locate the first record that satisfies the search criteria.
Parameters
    [ "AliasName" ] Alias name used to open the database.
    [ "Filter" ] A string expression represents the search criteria.You can use any SQL query without the key word WHERE. You should use the date format as mm/dd/yyyy for search criteria eventhough you are using other date formats. The string expression can contain operators like <, >, =, <> etc.
Return Value
  • If success, return 1; Otherwise 0.
Remarks
  • If the command is successful then the field values of the located record will get stored in the variables prefixed with [AliasName] but record pointer remains in the previous position i.e newly found record will NOT be the current record.
Example
    .........
.........
dbSetType("DAO")
dbOpen("e:\sales\sales.mdb","Despatch")
dbFind("Despatch","Amount=5000")
dbFind("Despatch", "Company=’SunShine’")
.........
.........
dbClose("Despatch")
Note: Now obsolete.


dbGoBottom ()

 dbGoBottom ( [ "AliasName" ] )
    To move the record pointer to the last record.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
  • On successful completion, return the record count; Otherwise 0.
Remarks
  • After execution, last record will become the current record.
  • Returns 0, if there is no record in the table.
Example
    ..........
..........
dbSetType(ODBC)
dbOpen("MYDSN","Personal","MyAlias")
dbGoBottom("MyAlias")
..........
..........
dbClose("MyAlias")
Note: Now obsolete.


dbGoTo ()

 dbGoTo ([ "AliasName" ] , [ "RecPosition" ] )
    To move record pointer to a new location.
Parameters
    [ "AliasName" ] Alias name used to open the database.
    [ "RecPosition" ]New Record position as Number.
Return Value
  • If success, return the new record position; Otherwise 0.
Remarks
  • After moving to the new location, new record becomes the current record.
Example
    ..........
..........
dbSetType("ODBC")
dbOpen("MYDSN","Personal","MyAlias")
dbGoTo("MyAlias",500)
dbGoTo("MyAlias",2500)
dbGoTo("MyAlias",1)
..........
..........
dbClose("MyAlias")

Note: Now obsolete.


dbGoTop ()

 dbGoTop ( [ "AliasName" ])
    To move record pointer to the first record.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
  • If success, then return 1; Otherwise 0.
Remarks
  • After executing this plugin, first record will become the current record.
  • If there is no record in the table, then the plugin will return 0.
Example

..........
..........
dbSetType("ODBC")
dbOpen("MYDSN","Personal","MyAlias")
dbGoTop("MyAlias")
..........
..........
dbClose("MyAlias")
Note: Now obsolete.


dbOpen ()

 dbOpen ( < "Database" > , < "Table" > , [ "Alias" ] , [ "UID" ] , [ "PWD" ] )
    To open the specified table and underlying database for performing the database operations.
Parameters
    < "Database" > Parameter represents the name of the database.If you are using DAO, give the database name with full directory path,for ODBC connection instead of database name you should give the Data Source Name (DSN).For connections other than DAO and ODBC you must supply the “Database” parameter in some other format, please refer Appendix II for further details.
    < "Table" > A string value represents the name of the table to be opened. If the table concept is invalid in your Database Management System (DBMS) then use the name of the database without any extension.
    [ "Alias" ] An Xtend IVR variable without ‘$’ symbol at the starting position.This is an alias name which represents the open database, enumerates all the connection attributes and the underlying data in the table. If the database open is successful, then the fields of the table are automatically attached to the “AliasName” and are available in Xtend IVR as variables in the format of “$AliasName.FieldName” where FieldName is actual column name in the table.
    [ "UID" ] User name.
    [ "PWD" ] Password.
Return Value
  • If success, return 1, Otherwise 0.
Remarks
  • After moving to the new location, new record becomes the current record.
Example

1.    *Open the table "Personal" in the Employee database
      *Fields in the table are "Name" and "Age"

      $Status = dbSetType("DAO")
      $Status = dbOpen ("c:\Employee.mdb","Personal","Emp")
      .............
      ............

       Speak $Emp.Name
       Speak $Emp.Age
       dbClose("Emp")

2.   Open database with user name and password

       $Ret =  $dbSetType("ODBC")
       $Ret = dbOpen("MYDSN","ResultInfo","Result","Admin","AdminPwd")
       ............
       ............
       Speak $Result.Total
       Speak $Result.Division
       dbClose("Result")

3.     * Not using DAO or ODBC
       * Open a FoxPro database Master.dbf
       * Database fields Tax and Balance

       $Ret = dbSetType("FoxPro 2.5")
       $Ret=dbOpen("c:\Accounts","Master")
       ...........
       ...........
       Speak $Master.Tax
       Speak $Master.Balance
       dbClose("Master")
Note: Now obsolete.


dbRecCount ()

 dbRecCount ( [ "AliasName" ] )
    Returns total number of records in the opened table.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
    If success, return the total number of records; Otherwise 0.
Remarks
    None.
Example
    ..........
..........
dbOpen("c:\Accounts\Master.mdb","Report")
$RecCount = dbRecCount("Report")
speak  $RecCount
..........
..........
dbClose("Report")
Note: Now obsolete.


dbRecNo ()

 dbRecNo ( [ "AliasName" ] )
    Used to get the Current Record Number.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
    If success, return the current record number; Otherwise 0.
Remarks
    None.
Example
    ..........
..........
$CurrRec = dbRecNo("Emp")
if $CurrRec <>0
  speak $CurrRec
endif
dbClose("Emp")

Note: Now obsolete.


dbSetType ()

 dbSetType ( < "Type" > )
    This command is used to set the database connection type.
Parameters
    < "Type" > This string represents the connection type. If you are using DAO then this parameter will be “DAO” and for ODBC it will be “ODBC ”. If you are using database like FoxPro, dBase, Paradox etc. then you must use some special strings as type.
Return Value
    If success return 1, Otherwise 0.
Remarks
  • This might be the first command to start database access. By using this command you can specify the connection type like DAO, ODBC or others to open the database.
  • The default connection type is DAO so if you ommit the command it will assume that you are using DAO as database connection.
  • You can also supply an empty string for DAO based connection.
  • Once you set the database connection type, it remains there and will use all database open commands unless you change it by issuing the same command with different type value.Please refer Appendix I for further information.
Example
     $Status = dbSetType ("ODBC")

     $Status = dbSetType ("DAO")

     $Status = dbSetType ("FoxPro 2.5")

Note: Now obsolete.


dbSkip ()

 dbSkip ( [ "AliasName" ] , [ "Records To Skip" ] )
    To move record pointer in forward or backward direction from the current position.
Parameters
    [ "AliasName" ] Alias name used to open the database.
    [ "Records To Skip" ] Number of records to skip from the current position.
Return Value
    If success, return to the new record position.If you have moved past EOF or BOF then it will return 0.
Remarks
  • Positive values move towards end of file (EOF) while negative values move towards beginning of file (BOF). After reaching the specified record position, that record becomes the current record.
Example
    .........
.........
dbSetType("DAO")
dbOpen("c:\students\Details.mdb","Marks","$Result")
dbSkip("$Result",100)
dbSkip("$Result",-20)
.........
.........
dbClose ("$Result")

Note: Now obsolete.


dbSQL ()

 dbSQL ( [ "AliasName" ] , [ "SQL" ] , [ "NewAlias" ] )
    To open a new table from an opened database with a filter, you can supply a valid SQL Query as filter.
Parameters
    [ "AliasName" ] A valid alias name represents opened database.
    [ "SQL" ] An SQL query to open a new table, only SELECT statements are allowed.
    [ "NewAlias" ] Valid Xtend IVR variables as new database alias to enumerate the newly opened table.
Return Value
    If success, return 1; Otherwise 0.
Remarks
  • The supplied query will act as the filter for further operations using the new database alias. After creating the new database alias it is possible to call other database commands using this Alias Name .But your operations are restricted to the records that satisfies the initial query, but the command dbZap() will erase all the records in the table. You must call separate dbClose() to close the new database alias.
  • Once you created a new database alias using dbSQL() then it is not possible to use the same alias name in another dbSQL() command.
  • If there is no record which satisfies the query then the command will return 0 but the new database alias will inherit all the attributes of the parent database alias but the field values will not be available in the variables.
Example
    .........
.........
dbSetType("DAO")
dbOpen("c:\students\Result.mdb","Exam","Alias1")
dbSQL("Alias1","SELECT * FROM  Students WHERE Mark>5","Alias2")
speak $Alias2.Name
speak $Alias2.Age
dbSQL("Alias2","SELECT * FROM Students WHERE Mark=50","Alias3")
dbClose("Alias1")
dbClose("Alias2")

* ERROR because $Alias2 is created by another dbSQL()

Note: Now obsolete.


dbUpdate ()

 dbUpdate ( [ "AliasName" ] )
    Calls this command to update the database.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
    If Success, return 1; Otherwise 0.
Remarks
  • Call this function to complete the dbAddNew() / dbEdit() command.
  • Once executed , it is not possible to cancel the operation in anyway.
  • If you are calling multiple dbAddNew() or dbEdit() before dbUpdate() command then the last dbAddNew()/dbEdit() will be used to update the database ie., there must be one to one correspondence between dbAddNew() / dbEdit() and dbUpdate().
  • On error the descriptive error message is available in the Xtend IVR system variable $Error.
Example

......
dbSetType("ODBC")
dbOpen("EMPDSN","Employee")
dbAddNew("Employee")
$Employee.Name ="John"
$Employee.Sal=5000
$Employee.Age=35
dbUpdate("Employee")
dbClose("Employee")
......
......

Note: Now obsolete.


dbZap ()

 dbZap ( [ "AliasName" ] )
    To delete all records from the table.
Parameters
    [ "AliasName" ] Alias name used to open the database.
Return Value
  • If Success, return 1; Otherwise 0.
Remarks
  • Once deleted it’s not possible to restore the records.
Example
    dbSetType("ODBC")
dbOpen("EMPDSN","Employee")
dbZap("Employee")
dbClose("Employee")

Note: Now obsolete.


XIVR-databaseplugins

DataBase Plugins

Xtend IVR supports all usual database operations through a number of standalone plugins accompanying with it, user can access almost all databases like Oracle, MS SQL Server, MS Access, FoxPro, dBase, Paradox etc. using these plugins. You can access and modify the records in a table from the Xtend IVR environment itself, but you cannot alter the schema of the database. The plugins supports database connections like DAO, ODBC and special connection property available for database like FoxPro, dBase, Paradox etc. you can specify the connection type, that supports the Database Management System (DBMS), before you open the database.The database field values are available in the Xtend IVR as variables but with certain format. You can manipulate these variables as normal Xtend IVR variables. The coming sections describe the functionality and syntax of these commands in detail.

Database Access Sequence

The first step is to set the connection type that required to open the database then call the command to open it, after successful completion of the command you can perform the database manipulation using the other commands and finally issue the command to close the database. The return value 0 implies the failure of the command and Xtend IVR system variable $Error will contain the description of the error.

Data Type Support

Xtend IVR Database plugins supports numerous types of SQL data types but it slightly vary with connection type see the Appendix I for supported data types corresponding to the database connection property.

Database Commands

dbSetType | : Set the Database Connection Type.
dbOpen | : Open the specified database.
dbClose | : Close the database.
dbRecNo | : Returns Current Record Number.
dbRecCount | : Returns Number of Records in the Table.
dbGoTo | : Move to a specified Record.
dbDelete | : Delete the Current Record.
dbSkip | : Skip a Number of Records from current position Either in backward or forward direction.
dbEOF | : Check End of File (EOF) is reached.
dbBOF | : Check Beginning of File (BOF) is reached.
dbFind | : Find the record that match the Filter condition.
dbAddNew | : Add New Record.
dbEdit | : Edit the Current Record.
dbUpdate | : Save the changes after AddNew /Edit.
dbZap | : Delete all records from the Table.
dbSQL | : Open a new Table with a filter condition.
dbGoTop | : Moves to the first record.
dbGoBottom | : Moves to the Last record.

Appendix I

Appendix II

About Plugins


File System

File Plugins

Copy | : Copies the file to another location.
CreateFolder | : Creates a folder and returns a new Folder object representing that folder.
CreateUnique | : Creates a temporary file.
Delete | : Permanently deletes an existing file.
GetEnv | : Returns the value of the specified environment variable.
GetFileInfo | : Retrieves information about all the properties and attributes of a file.
IsFile | : Returns a Boolean indicating whether the specified file exists.
IsFolder | : Returns a Boolean indicating whether the specified folder exists.
Move | : Moves one or more files from one folder to another.
SetAttrib | : Sets or returns the file's attributes.
Start | : Initiates an application from the IVR script.


Internet

Internet Plugins

GetMail | : Fetch email from the specified POP3 server.
SendMail | : Sends emails from Xtend IVR script.
Socket | : Allows basic socket communication.
Http | : Downloads web pages/flip contents from the internet.
Pipe | : Redirects data from the console to the Xtend IVR.


Math

Mathematical Plugins

Absolute | : Returns the absolute value of a number.
Evals | : Evaluates the expression to return a numeric value.
IntDigit | : Returns the integer portion of a number.
LogN | : Returns the natural logarithm of a given number.
NumberFix | : Removes the fractional part of a number.
RoundDigit | : Rounds a given number to a specified number of decimal places.
Square | : Calculates the square root of a given number.


GetTextField ()

 GetTextField ( <TextFile>, [Search Key], [Column Index], [Delimiter] )
    Used to retrieve data from text files.
Parameters
    <TextFile> The name of the text file to be opened.
    [Search Key] The value of the search key. If this parameter is missing, then it takes the first column of the first record.
    [Column Index] The position of the column to be retrieved. If you want to retrieve the first column, give 1 as column number.
    [Delimiter] The character used in the text file to separate fields. You can use any character as delimiter. If this parameter is missing, the default is taken as SPACE.
Return Value
    Data from the text file.
Remarks
  • The text file must be organized as follows:
      <Column1>, <Column2>, <Column3>, <Column4> etc.….
      <Column1>, <Column2>, <Column3>, <Column4> etc.….
      <Column1>, <Column2>, <Column3>, <Column4> etc.….
      <Column1>, <Column2>, <Column3>, <Column4> etc.….
  • Here multiple columns are separated using the delimiter comma. You can have any number of rows and columns with any character as delimiter between columns. (Something like a database table, containing rows and columns.)
  • GetTextField plugin retrieves the column values from the given text file, just like the field values from a database table.
  • GetTextField plugin can read only from text files. You can not write into the text files. For writing to the text files, you have to make your own applications and use with the Run command.
Example
    Sample Text file "Master.txt"

    11111,Charly Brown,25000
    22222,David Thomas,32000
    33333,Peter Williams,10000
    44444,James,12000
    55555,Thomas,32200
    66666,Alexander,23456

1.  $Acno = "33333"
    $Name = GetTextField("Master.txt",$Acno,2,",")

        $Name would be "Peter Williams"

2.  $Name = GetTextField("Master.txt")

        $Name would be "11111 Charly"

         *<SearchKey> is missing. So the first record is taken.
             *<Column Index> parameter is missing. Default is taken as "1".
             *The <Delimiter> parameter is missing. So the default delimiter is taken as SPACE.

3.  $Acno = "33333"
    $Balance = GetTextField("Master.txt",$Acno,3,",")

        $Balance would be "10000"
    Note: Now Obsolete.


WaveStorage

Miscellaneous
Accept | : Accepts input from the telephone keypad.
FlashBox | : Used to display a window to provide some program specific information.
GetTextField | : Used to retrieve data from text files.(Note: Now Obsolete)
MsgBox | : Displays a message in a dialog box.


WaveStorage

Numbers to Wave Files
Date2Wav | :Converts and speaks date in human voice.
Digit2Wav | :Converts and speaks digit in human voice.
Money2Wav | :Converts and speaks the amount in human voice.
Num2Wav | :Converts and speaks number in human voice.
Time2Wav | :Converts and speaks time in human voice.


IVR Wave files

Handling Wave Files

When preparing applications, a developer will often come across numbers especially to make numeric announcements including date, currency, time, digits and numbers. Xtend IVR facilitates digit handling and their play back a bit more easier with Number-to-Speech plugins.

However, there are some points to be kept in mind while working with WAVE files. These are discussed below.

  1. Multiple wave files delimited by a space may be specified as arguments with the Play command.
  2. All Number-to-Speech plugins return a string containing multiple wave files separated by a space.
  3. All wave plugins dynamically create and return the wave file names.
  4. The conventions to name a wave file in English are as follows:
    • The prefix of a wave file name usually represents the language and the artist. For example,
      Engsam25.wav denotes the number 25 articulated by Mr.Sam in English.
      Arbjab33.wav denotes the number 33 articulated by Mr.Jaber in Arabic.
    • A number is expressed in both continuous and conclusive accent. Thus we need two wave files to represent each number. To distinguish a file with a continuous accent we insert an '_' before the filename. For example,
      Engsam_25.wav means the number 25 articulated by Mr.Sam in English with a continuous accent.
      Arbjab_33.wav means the number 33 articulated by Mr.Jaber in Arabic with a continuous accent.
    • We write in words, in place of numerals, to indicate numbers above hundred such as,
      Engsamhundred.wav to denote the number 100 spoken by Mr.Sam in English. At the same time,
      Engsam_hundred.wav denotes the number 100 spoken by Mr.Sam in English with a continuous tone.
  5. Similarly, we name the Hindi wave files, in that, we specify Hin in place of Eng such as HinSre49.wav, HinSre_Feb.wav and so on.

Thus, we have 100 wave files for numbers from 0 to 99 with a conclusive accent, like engsam0.wav to engsam99.wav and another 100 wave files to represent the same in a continuous tone, like engsam_0.wav to engsam_99.wav. Also, we keep two wave files for each of the following numbers:

    100 Hundred.wav, _Hundred.wav
    1000 Thousand.wav, _Thousand.wav
    100000 Lakh.wav, _Lakh.wav
    1000000 Million.wav, _Million.wav
    10000000 Crore.wav, _Crore.wav
    100000000 Billion.wav, _Billion.wav
    1000000000000 Trillion.wav, _Trillion.wav

In case of announcing numbers in Hindi, we save the files as

    100 Sau.wav, _Sau.wav
    1000 Hasaar.wav, _Hasaar.wav
    100000 Lakh.wav, _Lakh.wav
    10000000 Karode.wav, _karode.wav

Xtend IVR supports another 12 wave files to express the 12 months of a year such as _jan.wav, _feb.wav, _mar.wav and so on. We follow the same names in both Hindi and English languages. The currency files supported right now include:

    dollar.wav, _dollar.wav
    dollars.wav, _dollars.wav
    pound.wav, _pound.wav
    pounds.wav, _pounds.wav

Coming to Hindi language, the same would be in

    rupaya.wav, _rupaya.wav
    rupaye.wav, _rupaye.wav
    paisa.wav, _paisa.wav
    paisae.wav, _paisae.wav

A set of waves auxiliary to time plugins consists of the following wave files in English.

    hour.wav, _hour.wav
    hours.wav, _hours.wav
    minute.wav, _minute.wav
    minutes.wav, _minutes.wav

For Hindi speaking linguistic regions, we can save the wave files in the following names.

    Khanda.wav, _Khanda.wav
    Khande.wav, _Khande.wav
    minute.wav, _minute.wav
    minutes.wav, _minutes.wav

In addition to the above mentioned waves, some miscellaneous waves are also necessary for Number-to-Speech plugins to function properly. They are:

    _and.wav
    _first.wav
    _second.wav
    _third.wav
    _th.wav
    _21st.wav
    _22nd.wav
    _23rd.wav
    _25th.wav
    _31st.wav
    _point.wav
    _minus.wav

Auxiliary wave files that are of use in Hindi speech are:

    _dashamsh.wav
    _point.wav
    _minus.wav


Time

Time Plugins

AddHour | : Adds or subtracts a given number of time period in hours to the time mentioned.
AddMinute | : Adds or subtracts a given time interval in minutes to the time mentioned.
AddSecond | : Adds or subtracts a given time period in seconds to the time.
Cmp | : Calculates the number of seconds between two time instances.
Get12 | : Converts a 24-hour clock into a 12-hour format.
Get24 | : Converts a 12-hour clock into a 24-hour format.
GetHour | : Extracts the hour element from the given time expression.
GetMinute | : Returns an integer between 0 and 59, representing the minute of the hour from the given time expression.
GetSecond | : Extracts seconds from the given time expression.
IsValid | : Determines whether a varible's value can be converted to time format.


WaveDelete

 WaveDelete <$number>
    Calls this plugin to delete a record from the the table Wave in the database wavedb .
Parameters
    <$number> Number of the particular record that is to be removed.If it is 1 then the first record is removed.
Remarks
  • Error occurs if one tries to delete a record that does not exist . ie if the given record number is 0 or if it surpasses the total number of records in the table.
Example

: MAIN

     answer 2
     record 5
     wait 0
     wavesave $RecordFile
     $RecordFile = "C:\Hello.wav"
     waverestore $waveid
     play $RecordFile
     wait 0
     WaveDelete $waveid
     hangup
     goto :MAIN

:ONSYSYSTEMERROR

     log $Error
     hangup
     goto BEGIN

:ONHANGUP

     hangup
     goto :MAIN
  • Here, in this example, the script records the voice for 5 seconds in the default file temp\0.rec and then it is appended to the database wavedb. After that it is retrieved to the file "C:\Hello.wav" and played back. Script now deletes that record since $waveid has its number.
Note: Now obsolete.


WaveRestore

 WaveRestore <$waveid>
    The WaveRestore plugin restores the particular record with the .$waveID from wavedb to a file specified in the variable $RecordFile.
Parameters
    <$waveid> Reserved IVR variable which contains the ID of the wave record whose data is to be retrieved.
Remarks
  • waverestore retrieves only a single record with the particular ID in the reserved variable $waveid to the file specified in the variable $RecordFile.
  • The file to which the record should be retrieved can be changed by altering the content of $RecordFile.
  • An error is reported if wavedb is not present or can not be accessed.
  • Wave data is stored in wavedb by using the plugin WaveSave.
Example
    1.     answer 2
       WaveRestore $waveid
       ............
       ............

       Restores the record with $waveid to the default file ..\ temp \ 0.rec.

2.     answer 2
       $waveid  =  1
       WaveRestore $waveid
       $waveid += 1
       $RecordFile  = "C:\Xivr\Samples\1.wav"
       WaveRestore $waveid
       ............
       ............
  • In this example ,first record from wavedb is saved to file " temp \ 0.rec " and the second record to the file " C:\ Xivr \ Samples \ 1.wav ".
Note: Now obsolete.


WaveSave

 WaveSave ( <$RecordFile | $Variable> )
    The WaveSave plugin saves the wave file specified in the $RecordFile or in a $Variable to a DAO database wavedb.
Parameters
    <$RecordFile | $Variable> Contains the name of the file to be saved to the database.
Remarks
  • <$RecordFile> Either the variable is automatically initialized to a unique temporary filename by Xtend IVR when a session is started or the user can specify a file name.
  • Single WaveSave statement saves only one file specified in the <$RecordFile> or <$variable>.
  • Each file is saved as a record to the Wave table in the database wavedb.
  • wavedb is created dynamically if it does not exist otherwise the file is appended as the next record.
  • Each file is saved to the database with a unique ID, that is used to retrieve the file.( usually ID starts with 1 for the first record and is incremented automatically by 1 as and when new records are appended ).
  • Multiple WavSave statements are needed for adding more files to the database.
  • Wave data is retrieved from wavedb by using the plugin WaveRestore with the waveID.
Example

1.    answer 2
      record 5
      WaveSave $RecordFile
      ............
      ............

2.    answer 2
      WaveSave "C:\roar.wav"
      WaveSave "C:\howl.wav"
      ............
      ............

3.    answer 2
      $WaveVar = "C:\yell.wav"
      WaveSave $WaveVar
      ............
      ............
Note: Now obsolete.


Miscellaneous

Manipulate Wave Files
WaveSave | :Saves the wave file to a database.
WaveRestore | :Retrieves the wave file from the database.
WaveDelete | :Deletes the wave file from the database.
Note: Now obsolete.


Sample - Multi-threading and Software Communication

*--------------------------------------------------------------------------
* Script : Sample - Multi-threading and Software Communication
* Date : 1st Feb 2006
* Notes : Sample Script for Xtend IVR toolkit.
*--------------------------------------------------------------------------

MAIN:

    if Find($DriverName, "Multimedia") <> -1

        AtomicSet("$mmdevice", $deviceid)

        Answer
        display $deviceid "Streaming MM device"

        while true
            $key = input(1)
        endwhile
    else
        display "Waiting for call..."
        answer

        $ListenId = AtomicGet("$mmdevice")
        SoftListen($ListenId,2)

        display $deviceid "Call connected for 30 seconds to " $ListenId

        sleep 30000
        SoftUnListen($ListenId)
    endif

    hangup
    goto MAIN

:ONSYSTEMERROR
    log $error
    hangup
    goto MAIN

:ONHANGUP
    hangup
    goto MAIN

*--------------------------------------------------------------------------


System Menu

System menu assists the user in managing the Xtend IVR application. Right click on the titlebar of the main window or click on the Xtend IVR icon to get the system menu. The following menu items appear: Restore, Move, Size, Minimize, Maximize, Close, About Xtend IVR, Help, View Log, View System Log, App Window, Configure, Change Script, Edit Script. Let's take a look at each menu item one-by-one.

Restore

Restore button is enabled when the screen size is maximum. Suppose you maximize the screen, then the Restore button is used to resize it back to the previous size and location.

Maximize button replaces the Restore button at the top right corner of the titlebar when the screen is restored and Restore button replaces Maximize button when the screen is maximized. To enlarge the window again to fill the screen, use Maximize button in the Titlebar or double-click on the Titlebar.

Move

When Move is clicked, the whole script window gets selected. The arrow keys on the keyboard can be used to change the location of the script window, i.e. it can be used to move the window in the direction of choice. By pressing the arrow marked to the right side, the window moves to that side and correspondingly for all the directions. The Move button is active only when the script screen is not maximized.

Size

Size command resizes the script window. When the Size button is clicked, the whole script window gets selected. This activates the arrow keys on the keyboard. The arrow keys can be used to change the size of the script window. By pressing the arrow marked to the right side, the window stretches to that side and correspondingly for all the directions. The Size button is active only when the script screen is not maximized.

Minimize

When you click Minimize, it reduces the script window to an icon. The Minimize button changes to Restore button after the screen is minimized. To restore the window to its previous size and location, double click on the icon or click on the Restore button. To enlarge the screen, click on the Maximize button.

Maximize

When the screen is minimized, click the Maximize button to enlarge the script window to fill the screen. To reinstate the window to its previous size and location, click Restore or, to minimize it click the Minimize button.

Close

Use Close button or the hotkey Alt + F4 to shut down/close the Xtend IVR.

About Xtend IVR

About provides the details of the company, the product and the version of the product. You can also press the About bitmap in the main window to get the same.

Help

Opens up the Xtend IVR help file. The same effect is produced by the function key F1.

View Log

Discloses the current application log file stored in the script's Log folder.

View System Log

Facilitates to view the log file maintained by the Xtend IVR system.

App Window

Reveals or conceals the application window commenced by the IVR.

Configure

Allows us to particularize the IVR attributes with the purpose of configuring and customizing the Xtend IVR.

Change Script

Loads an application into the Xtend IVR by selecting an existing script from the displayed dialog box.

Edit Script

Presents the currently loaded script in the Xtend IVR Editor for editing purpose. The function key F2 avails itself of the same privilege.