Voice API for Linux Demo Guide — June 2005 23
Demo Details
5.5 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. As an
introduction to the program, a simplified outline of d40demo is shown:
• Initialization
– Spawn subprocess for each channel
– End parent process
– Initialize interrupt handlers
– Open channel and files
– Initialize process variables
• Main Program Body
– Place channel onhook
– Wait for one ring
– Go offhook
– Play introduction message
– Start menu routine loop
• Play menu prompt
• Get caller response
• Process caller response
– End loop
The outline provides a general approach to any voice application, not only d40demo. For example,
all voice applications need some type of initialization routine to open the channel, initialize
variables, and open files. A voice menu system is also a universal feature found in most voice
applications because a caller needs a vocal prompt to instruct him on his choice of actions. These
routines are called system routines and are in the d4xtools.c module.
DIGITS.VOX Voice file
PROMPT.VOX Voice file
Table 5. Files Used by the d40demo
File Name Purpose