1. High level design description

2. Description of Classes

3. Building the Demo

4. Running the Demo

4.1. Configuring the operation mode and using call scenario

4.2. Starting and Stopping the Demo

4.3. Receiving Incoming SIP Calls

4.4. Making Calls

4.5. Using Call Generator

1. High level design description

SipDemo is a simple expandable demo application written in C++ and designed to implement a basic SIP and VoIP/FoIP scenarios supported by Dialogic HMP products. All components of the application are running in a context of the same main thread; this model is effective for small-to-medium solutions (100-300 SIP channels) and was chosen for simplicity. Although the demo is single-threaded, the classes are thread-safe and the demo provides means for inter-thread communication via Dialogic SRL messaging mechanism.

The current version of demo supports VoIP and FoIP calls in 1PCC and 3PCC mode.

The major components of the application are shown on the Fig. 1

Figure 1. High Level Design Diagram

The topmost component of the application is the CAppManager class object. It performs all system-level tasks, such as starting GlobalCall libraries, initializing virtual IP boards, configures the common VoIP parameters etc. The application creates only 1 instance of this class. The class accepts configuration parameters and run-time commands from configuration file and user console interface and uses it to control the SIP devices it owns in a form of array of CSipChannel objects.

The CSipChannel combines SIP, voice and fax functionality.

The demo also defines AEventProcessor class which is an abstract base class for all other run-time classes and defines a common way to process Dialogic and user events.

CEventManagerwaits and dispatches all events from Dialogic SRL to underlying Event Processors without any processing, thus abstracting low level implementation.

User Interface (CAppConsole) component acts like an input/output facility, and its main function is to receive user input from the keyboard and send it over to the CAppManager. All classes may use CAppLogobject to write their states to the application log file and display it on the program console.

The class dependencies and hierarchy show on the Figure 2.

Figure 2. Class hierarchy.

2. Description of Classes

Class: CAppManager

Implementation: Singleton / concrete

Functionality: The single instance of this class is created in the main module, which instantiate the class and calls its public start-up method Init(). The Init() accepts a configuration file name as an argument; the class reads the file and uses its data to initialize and configure all SIP channels.

The objects of the class are only accessible from two modules: EntryPoint.cpp, where main() is defined, and CAppManager::Init(),CAppManager::Shurdown() and CAppManager::OnTimer() methods are called, and from AppConsole.cpp, where the App Manager methods are called for making single “manual” calls or controlling bulk call generator, upon commands from the keyboard.

Interactions: CSipChannelclass objects

Class: CSipChannel

Implementation: Concrete

Functionality: Combines IP, voice and (optionally) T.38 fax functionality; used as a subject of SIP call session. Carriesconfiguration data (such as a list of supported capabilities, DTMF transfer mode, call scenario)and acts as a high level interface between Application Manager (controlled by the user) and the underlying low-level technology classes, like AGCDevice, CVoiceDev, CFaxDev .

Interactions: Object of the class are initialized by theCAppManagersingletone; each object usesAGCDevice, CVoiceDev, and CFaxDev for handling SIP calls, audio manipulations and T.38 fax operations; driven by run-time events and call scenarios provided by the configuration file.

Class: AGCDevice

Implementation: Abstract

Functionality: Pure virtualclass; provides an interface to handle SIP sessions in 1PCC or 3PCC mode.

Interactions: None on the abstract level.

Class: C3PccDev, C1PccDev

Implementation: Concrete

Functionality: Concrete implementation of the AGCDevice class, provides an interface to handle SIP sessions in 1PCC or 3PCC mode.

Interactions: WhetherC3PccDevorC1PccDev object is instantiated by the CSipChannelaccording to the operating mode provided in the configuration file.

Class: CVoiceDev

Implementation: Concrete

Functionality: Plays or records audio files from/to the hard disk in different formats, defined by the file extension; dials or detects DTMF digits.

Interactions: Controlled by the CSipChannelobject.

Class: CFaxDev

Implementation: Concrete

Functionality: Sends or receives faxes.

Interactions: Controlled by the CSipChannelobject.

Class: CAppConsole

Implementation: Concrete

Functionality: Creates I/O console in Windows environment, allows for user input at run time; receives messages and prints information provided by all other objects.

Interactions: Works with the CAppManager for start-up, shutdown and run-time control; any class object may display on the user screen at run time.

Class: CAppLog

Implementation: Singleton / concrete

Functionality: Provides configurable logging to file and console

Interactions: All objects will use the log file to log messages and results.

3. Building the Demo

This demo was created under Microsoft® Visual Studio® 2008 environment. It can also be built with Visual Studio® 2003; when using Visual Studio® 6.0, some minor code changes may be needed, mainly around STD header files and namespace usage.

To build the demo, the following libraries must be included in a linker list:

libdevmgmt.lib LIBDXXMT.lib libfaxmt.lib libgc.lib libipm.lib libsrlmt.lib sdpApi.lib

The sdpAPI.lib and SDP API is used in 3PCC mode only, and provided as a convenience tool; the user can use other tools for SDP manipulation; in this case the sdpAPI is not required.

4. Running the Demo

4.1. Configuring the operation mode and using call scenario

Before running the demo, its config file may need to be modified. By default, the config file name is SipDemo.cfg; the name can be altered by modifying an argument in the Init() method of the CAppManager object in the EntryPoint.cpp module. The demo currently doesn’t process any command line arguments.

The config file syntax is simple and quite self-explanatory; the following parameters should be adjusted before running the demo:

[CommonParms] Section:

3PCC = Yes

-Sets the operation mode – 1PCC or 3PCC; default is 1PCC

MaxSipCalls

-defines a number of SIP session what can run simultaneously. Must not exceed the number of Call Control, G711 RTP or Voice resource count defined by the HMP license used on the machine.

[Encoder] section specifies DTMF transfer mode for a giving test and the VoIP coders the system will locally support; see the commented section for a coder list. Example:

Rfc2388Dtmf= Yes

#Coder = G.723_5.3k fpp_2 VAD_YES Direction_sendrecv

Coder =G.711ulaw fpp_20 VAD_NODirection_sendrecv

It means that only G.711 ULaw will be used for any outbound calls, or will be searched on incoming requests. Note that the ‘#’ is a comment mark; all lines started with this sign are ignored by the demo

[AddressList] section specifies a list of destination addresses used by manual or automatic calls. Please see the comments on a top of this section for a syntax.

[Incoming] and [Outgoing] sections define a call scenario for incoming or outgoing SIP calls, respectively. The syntax is rather simple and is briefly described in the configuration file. The following commands are currently supported:

play <filename> - plays a file

record <filename> <max_time> - records audio to file up to maxtime (100 ms units), or until stopped

dial <digits> - dials DTMF's specified by <digits>

getdigits <num> <maxtime> - waits for <num> DTMF's during <maxtime> (100 ms units)

delay <time> - does nothing during (<time> * 10) ms

random_delay <time> - the same as above, but the time is selected randomly, up to <time>

For [Incoming] only:

answer - when presents, the script starts on ACCEPTED event, otherwise, the script starts on ANSWERED. The demo will perform all command preceding the answer while in ACCEPTED state, and the will answer the call.

The script moves forward when the current commands complete with success (like TDX_PLAY event on playcommand) or error. When the script passes the last command the application drops the call. If the call is dropped by the remote side, the script halts, and all resources are released.

4.2. Starting and Stopping the Demo

To run the demo, configure the parameters as described above and just click its executable file (no command line arguments). After few seconds required for initialization, the demo screen will stop scrolling, and the demo is ready to make or accept SIP calls.

To stop the demo, hit F10 key.

4.3. Receiving Incoming SIP Calls

After being initialized, the demo is ready to accept and answer (depending on the configuration file settings) an in coming SIP call on any free channel. When the call is detected, it is processed according to the script defined in the [Incoming] section of the configuration file. User can drop the call at any time with F6 key.

4.4. Making Calls

To make a call, the user hits F5 key, then enters the destination address and click <ENTER>. If no address is specified before <ENTER>, the demo will attempt to pick an address from the [AddressList] section of the configuration fail. If none is provided, the call will fail and error message will be displayed on the screen.

When the outbound call is answered, the demo will start executing the scenario described in the [Outgoing] section.

4.5. Using Call Generator

The demo can be used as a call generator to create a bulk of outbound SIP calls. Click F3 to start bulk test. The CAppManager will start looking for available channels and make calls on them about every 10 ms. The destination addresses for the calls will be taking from the [AddressList] in round-robin manner.

To stop the calls, hit F9.