Voice API for Linux Demo Guide June 2005 05-2342-002
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT.
Contents Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 About This Publication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Applicability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Revision History This revision history summarizes the changes made in each published version of this document. Document No. Publication Date Description of Revisions 05-2342-002 June 2005 Demo Descriptions chapter : Added custserv, dpddemo, and d40demo. Also added information about the d4xtools.c toolkit. Running the Demos chapter : Added sections for custserv, dpddemo, and d40demo. Demo Details chapter : Added sections for custserv, dpddemo, and d40demo.
About This Publication The following topics provide information about the Voice API for Linux Demo Guide: • Purpose • Applicability • Intended Audience • How to Use This Publication • Related Information Purpose This publication describes the voice demonstration programs and provides instructions for running the demos on the Linux* operating system. Applicability This document version (05-2342-002) is published for Intel® Dialogic® System Release 6.1 for Linux.
About This Publication How to Use This Publication This publication assumes that you understand computer telephony terms and concepts, and are familiar with the Linux operating system and the C programming language. The information in this guide is organized as follows: • Chapter 1, “Demo Descriptions” provides a brief overview of the voice demos. • Chapter 2, “System Requirements” discusses the hardware and software required to run the demos.
Demo Descriptions 1. 1 This chapter provides a brief description of the voice demonstration programs. The following demonstration programs are provided with the voice software. These demos are supported on Springware boards only. cbansr Voice application that uses the asynchronous callback programming model. This demo is statedriven but uses event handlers that can be enabled or disabled for specific events on specific devices. The demo illustrates the voice recording and playback feature.
Demo Descriptions 8 Voice API for Linux Demo Guide — June 2005
System Requirements 2. 2 The requirements for running the voice demos are described in the following sections: • Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 • Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.
System Requirements 10 Voice API for Linux Demo Guide — June 2005
Preparing to Run the Demos 3. 3 This chapter provides information on preparations to follow before running a voice demo. Before you run a voice demo program, ensure that you have performed the following: 1. Adhered to the hardware and software requirements described in Chapter 2, “System Requirements”. 2. Installed a Springware board in your computer system. This product should support the R4 API libraries. 3. Started System Services for the board. 4.
Preparing to Run the Demos 12 Voice API for Linux Demo Guide — June 2005
Running the Demos 4. 4 This chapter describes how to run the voice demos. Topics include: • Starting the Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 • Demo Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 • Using the Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 • Stopping the Demo . . . . .
Running the Demos 4.1.2 Starting the pansr demo To run the pansr demo, follow these instructions: 1. Open a command prompt window and go to the directory where the demo is located. The default location is the /demos/dx_demos/ansr directory under INTEL_DIALOGIC_DIR (the environment variable for the directory in which the system release software was installed). 2. At the command prompt, type ./pansr -
Running the Demos Note: On Linux, the demo name is case-sensitive and must be entered as shown. The demo options are described in Table 1, “Voice Demo Options”, on page 15. If you don’t specify an option, default options are assumed. 4.1.5 Starting the d40demo To run the d40demo, follow these instructions: 1. Open a command prompt window and go to the directory where the demo is located.
Running the Demos Table 1. Voice Demo Options Demo Option Default Value Description/Value -nN N/A Specifies the number of D/4x channels to use. Values are: 1 to 12. Example -n4. -f N/A Specifies the front end interface. Values are: Analog, T1, and E1. Example: -fAnalog. Examples To run the cbansr demo on a D/41JCT-LS board, specify the following: ./cbansr -d1 -n4 -fAnalog To run the pansr demo on a D/120JCT-LS board using four channels, specify the following: ./pansr -d1 -n4 -fAnalog 4.
Running the Demos 7. Hang up the telephone. 8. Press Ctrl-C to terminate the demo. Note: 4.3.2 If you do not terminate the demo using Ctrl-C, the driver for the demo does not unload after quitting the program, necessitating a reboot before another demo can be loaded. Using the pansr demo The following procedure describes the activity after starting the cbansr demo: 1. After the demo starts, a screen is displayed with the status of the channels and calls. 2.
Running the Demos 5. Press Ctrl-C to terminate the demo. Note: 4.3.4 If you do not terminate the demo using Ctrl-C, the driver for the demo does not unload after quitting the program, necessitating a reboot before another demo can be loaded. Using the dpddemo The following procedure describes the activity after starting the dpddemo: 1. After the demo starts, a screen is displayed with the status of the channels and calls. 2. Dial an extension number configured for one of the voice channels. 3.
Running the Demos 4.4 Stopping the Demo Press Ctrl-C at any time to exit a voice demo. All channels and files are properly closed by the demo.
Running the Demos 20 Voice API for Linux Demo Guide — June 2005
5 Demo Details 5. This chapter provides more detail about the voice demos. You do not need this information to run the demos successfully. • Files Used by cbansr and pansr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 • Files Used by custserv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 • Files Used by dpddemo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Demo Details Table 3. Files Used by the custserv File Name 5.3 Purpose custserv Executable file custserv.c Source code custserv.h Header file CUSTSERV.VOX Greeting voice file Files Used by dpddemo Table 4 lists the files that are used by the dpddemo. Table 4. Files Used by the dpddemo File Name 5.4 Purpose answer.h Header file display.c Source code for the screen display dpddemo Executable file dpddemo.c Source code example.c Source code GOODBYE.VOX Goodbye voice file INTRO.
Demo Details Table 5. Files Used by the d40demo File Name 5.5 Purpose DIGITS.VOX Voice file PROMPT.VOX Voice file Supplementary Information for d40demo Supplementary information on the d40demo is given in the following topics: • Source Code Overview • Global Variables • Initialization Routine • Menu System Routine • Messaging System Routine 5.5.1 Source Code Overview The source code to d40demo is located in two modules, d40demo.c and d4xtools.c.
Demo Details Since d40demo is also a working order entry system, the source code contains nonsystem routines that are specific to the order entry application. The d40demo.c module contains the routines that manage a simple database, which are called the application specific routines. The d40demo program uses three system routines: • Initialization • Menu System Routine • Messaging System Routine 5.5.2 Global Variables Global variables are used by the functions in d4xtools.c.
Demo Details if (rc == 0) { close(0); . . The code that follows the close( ) function call within the if statement is only executed in the child process. The parent process fails the (rc == 0) comparison and loops back to the while statement. When all the arguments are exhausted, the parent process eliminates itself by a call to the exit( ) function. The signal( ) function calls redirect the signals from the outside world to call the sigcatch( ) function. The sigcatch( ) function, located in d4xtools.
Demo Details When input is received from the caller, four things can happen: control is passed to another menu; an action is performed; an action is performed and control is passed to another menu; an error message is played (invalid input). All menus provide the caller with options. In the example above, the first caller response transferred the caller to another menu. The second response performed an action (recording a message) and prompted the caller with the same menu.
Demo Details that can be used, DL_PREV and DL_CURR. DL_PREV returns the caller to the previous menu, and DL_CURR returns the caller to the current menu. me_validfnc Validation Function - Pointer to the function that validates the caller's response. This function returns a DL_MNUOPTS structure containing the response that was chosen. me_prompt Prompt Message - Pointer to the voice prompt message for this menu. me_retry Retry Message - Pointer to the retry prompt message for this menu.
Demo Details menu are implemented as a NULL-terminated array of DL_MNUOPTS structures. An array of DL_MNUOPTS structures allows a menu to have an arbitrary amount of options.
Demo Details DL_DATA Data Structure The DL_DATA structure defines the termination conditions for getting the response to the menu options. It holds the values for several fields that map to corresponding DV_TPT elements used when getting a caller's response. These are used with the global termination conditions located in def_dg_tpt.
Demo Details */ rspentry=(DL_MNUOPTS *)gt_data(digbuf,cur_menu->me_validfnc,cur_menu->me_prompt, cur_menu->me_retry, cur_menu->me_error,cur_menu->me_data); /* * Execute the appropriate actions for the last response */ /* If a function is required execute it if(rspentry->mo_fcnt != NULL) { (void) (*rspentry->mo_fcnt)(); } */ /* * If a new menu has been specified then switch to next menu * else switch to the default menu */ if(rspentry->mo_nxtmenu != NULL) { /* * Make the current menu previous * and the pr
Demo Details menu_engine( ) then transfers control to the next menu indicated in the mo_nxtmenu field. If the value of the field is NULL, control is passed to the default menu, specified in the me_defmenu field. A value of DM_PREV in me_defmenu sets the current menu to be the previous menu, and loops back to the gt_data( ) call at the beginning of the loop. The value of DM_CURR loops back, leaving the current menu the same. The menu_engine( ) function relies on other system routines defined in d4xtools.
Demo Details } /* Not a valid response */ playmsg(retry); } while (--numretry); /* * No valid response within max. # of retries, so call fatal error * handler for this menu, if any provided, and then hang up and go idle. */ if (error) (*error)(); longjmp(idlestate,1); /* never gets here but makes lint happy */ return (NULL); } The memcpy( ) function call copies the default get digit DV_TPT array, def_dg_tpt, into the local structure, dattpt.
Demo Details check_term( ) uses ATDX_TERMMSK( ) attribute to check the termination type. If the I/O function was terminated for any of the cases, the function calls a longjmp( ) and returns to idlestate. If none of these terminations occurred, the caller is still on the line, and the response must be validated. 5.5.5 Messaging System Routine The messaging system provides a way to play voice prompts or digits by specifying the name. It implements the dx_play( ) function at a higher level.
Demo Details The message system uses the DL_MSGS and DL_MSGTBL structures to store the information needed for a DX_IOTT structure. The buildmsg( ), buildmsg_v( ), builddate( ), gt_iott( ), gt_numiott( ), gt_groupiott( ), and gt_pairiott( ) functions use the message structures to build the DX_IOTT structure. The playmsg( ) and plaympmsg( ) functions use the DX_IOTT structure to play the message.
Index A A 7 answer.h 21, 22 asynchronous callback programming model 7 asynchronous polled programming model 7 C cbansr demo command line options 15 description 7 exiting 17 files used 21, 22 running 16 starting 13 cbansr executable file 21 cbansr.c 21 custserv demo description 7 exiting 18 running 17 starting 14 custserv.c 22 custserv.exe 22 custserv.h 22 CUSTSERV.VOX 22 D d40demo description 7 details 23 running 18 starting 15 d40demo.c 22 d40demo.exe 22 d4xtools.c 7, 22 date.h 22 DATE.
pansr.exe 21 prerequisites fo running the demo 11 prompt.h 22 PROMPT.VOX 23 S software requirements 9 Springware boards 7 stopping a demo 19 system requirements 9 T toolkit 7 d4xtools.