Previous PageTable Of Contents../index.htmlIndexNext Page



4.6. Demo Details

This chapter provides a detailed description of the demo.

This section presents a closer examination of the IPTMail_R4 demo, by looking into its structure and source code. The IPTMail_R4 demo source code is located in the Dialogic\Samples\gc_demos\IPDemos\iptmail_R4\ directory and is included in the following files:


Table 2. IPTMail Source Files

Samples\gc_demos\IPDemos\IPTMail_R4\

APPDEFS.H

Application definitions

Samples\gc_demos\IPDemos\IPTMail_R4\

APPINIT.C

Application initialization

Samples\gc_demos\IPDemos\IPTMail_R4\

APPINIT.H

Header file for application initialization

Samples\gc_demos\IPDemos\IPTMail_R4\

APPMAIN.C

The main application file: contains the thread initialization, route ports, etc.

Samples\gc_demos\IPDemos\IPTMail_R4\

APPMAIN.H

Header file for main application

Samples\gc_demos\IPDemos\IPTMail_R4\

APPPARS.C

Read configuration file functions

Samples\gc_demos\IPDemos\IPTMail_R4\

APPPARS.H

Header file for reading configuration file functions

Samples\gc_demos\IPDemos\IPTMail_R4\

APPSTAT.C

Application state machine functions

Samples\gc_demos\IPDemos\IPTMail_R4\

APPSTAT.H

Header file for the application state machine functions

Samples\gc_demos\IPDemos\IPTMail_R4\

APPSTRC.H

Definitions of application structures

Samples\gc_demos\IPDemos\IPTMail_R4\

APPVARS.H

Definition of application variables

Samples\gc_demos\IPDemos\IPTMail_R4\

GATEIP.C

Initialize IP, Get IP available channels, handle IP events

Samples\gc_demos\IPDemos\IPTMail_R4\

GATEIP.H

Header file for the IP functions

Samples\gc_demos\IPDemos\IPTMail_R4\

MAILDEFS.H

Mailbox definitions

Samples\gc_demos\IPDemos\IPTMail_R4\

MAILUTIL.C

Mailbox utility functions

Samples\gc_demos\IPDemos\IPTMail_R4\

MAILUTIL.H

Header file for Mailbox utility functions

Samples\gc_demos\IPDemos\IPTMail_R4\

VOICE.C

Initialize voice resources, get voice resources available channels, handle voice resources events

Samples\gc_demos\IPDemos\IPTMail_R4\

VOICE.H

Header file for voice resources functions.

Samples\gc_demos\IPDemos\IPTMail_R4\

Iptmail_r4.cfg

IPTMail demo configuration file

Samples\gc_demos\IPDemos\IPTMail_R4\

Iptmail_r4.exe

IPTMail demo executable file

Samples\gc_demos\IPDemos\IPTMail_R4\

Stoplisten.vox

Voice file

Samples\gc_demos\IPDemos\IPTMail_R4\

ErrorInput.vox

Voice file

Samples\gc_demos\IPDemos\IPTMail_R4\

ListenMenu.vox

Voice file

Samples\gc_demos\IPDemos\IPTMail_R4\

MainMenu.vox

Voice file

Samples\gc_demos\IPDemos\IPTMail_R4\

SaveConfirm.vox

Voice file

Samples\gc_demos\IPDemos\IPTMail_R4\

SendMsg.vox

Voice file

Samples\gc_demos\IPDemos\IPTMail_R4\

StartRec.vox

Voice file

Samples\gc_demos\IPDemos\IPTMail_R4\

StopRec.vox

Voice File

Samples\gc_demos\IPDemos\IPTMail_R4\

ThankYou.vox

Voice File

Samples\gc_demos\IPDemos\IPTMail_R4\

UnavMenu.vox

Voice File

Samples\gc_demos\UTIL\

Libdbg.c, Libdbg.h, Libdefs.h

Project files that include all debug definitions and functions (static debug library)

NOTE:
If you move the files for the IPTMail demo, be sure to move the .vox files as well, otherwise the IPTMail demo will not work.

The IPTMail_R4 demo is designed to operate in a single thread mode. (There is a secondary thread operating alongside the main thread. This secondary thread consists of keyboard events, and does not change the overall structure of the demo.). Because of the nature of a single threaded application, the state machines do not, and should not, block any other operation, but wait for the SRL. Figure 2. Thread Diagram illustrates the demo's thread structure.

NOTE:
The application programming framework also allows multi-thread operation. It is not demonstrated in the IPTMail_R4 demo.

Figure 2. Thread Diagram


Figure

  1. Get any arguments from the command-line.
  2. Reset the demo data structures. Initialize all channels' states to INIT.
  3. Call gc_Start( ): starts all configured , call control libraries.
  4. Set SRL modeltype to SR_STASYNC.
  5. Set-up the call-back handler, callback_hdlr.
  6. Call getVoiceChannels( ) which checks the number of available voice devices :
  1. Call getIPChannels( ) which checks the number of available IP channels:
  1. Call getmailChannels( ) to find the demo MAX available channels (the smaller of available IP or Voice Devices and the number of channels specified with the --n command line option, if used ).
    NOTE:
    The printf( ) function must be used when printing an error/ trace/warning during the above initialization operations one through six, because some actions are not related to a specific channel and log files are not yet opened.
  2. Open the channels' log files if --l command-line option was used.
  3. Read information from the configuration file (IPTMail_R4.cfg or other CFG file determined by the user) and update the ConfigFileParm in the Session data structure.
  4. Print information from the configuration file.
  5. Call the IPInit( ) function. See Section 4.6.4. IPLink-Related Initialization for a description of the IPInit( ) function.
  6. Call the VoiceInit( ) function. See Section 4.6.5. Voice-Related Initialization for a description of the VoiceInit( ) function..
  7. Call the InitMailBoxs( ) function, which initializes the MailBox structure.
  8. Create waitForKey thread to receive keyboard input.

The IPLink initialization procedure described in this section is defined in the IPInit( ) function in the GATEIP.C file, which performs the following:

For all channels:

Call VoiceInit( ), located in the VOICE.C file, which does the following:

For all channels:

This section describes the main data structures:

The Session data structure (defined in Appstrc.h) contains the following fields:

There is a session structure for every channel. Each channel session contains pointer to a MailBox structure.

The IPParams data structure (defined in Appstrc.h) contains the following fields:

The VoiceParams data structure (defined in Appstrc.h) contains the following fields:

The MailBox data structure (defined in Maildefs.h) contains the following fields

The IPTMail_R4 demo uses the SRL mechanism to retrieve the IP/R4/Keyboard events. The application waits for events using the sr_waitevt(-1) function. When an event occurs, SRL calls event handlers automatically.

In the initialization phase of the demo the mailInitialization( ) function will perform the following:

  1. Set SRL modeltype to SR_STASYNC, by calling sr_setparm( ).
  2. Set-up the call-back handler, by calling sr_enbhdlr( ).

The SRL will be notified of application exit events using a special key CTRL_CLOSE_EVENT, when calling sr_putevt( ).

There is an endless loop {while(1) } in the main( ) function in the APPMAIN.C file. In that loop, the application waits forever for an event by calling the sr_waitevt( ) function. The event must be handled immediately and event-specific information should be retrieved before the next call to sr_waitevt( ).

When the next event occurs or when a timeout is reached, the sr_waitevt( ) returns and the call-back handler function is called automatically.

When the R4/GC/Keyboard event is received, the application performs the following:

  1. Get the event device handle, by calling sr_getevtdev( ).
  2. Get the channel number related to the event, from the global array (HandleToChannel[ ]).
  3. Update the METAEVENT structure by calling gc_GetMetaEvent( ).
  4. Get the event type, by calling sr_getevttype( ).

Previous PageTable Of ContentsTop Of PageIndexNext Page

Click here to contact Dialogic Customer Engineering

Copyright 2002, Intel Corporation
All rights reserved
This page generated February, 2002