(Page 1 of 1 in this chapter) Version


Chapter 7

Demonstration Program


7.1 Introduction
7.2 briswi
7.2.1 briswi Files
7.2.2 briswi Coding Features
7.2.3 Switching on the MVIP Bus

7.1 Introduction

This chapter describes the functionality and structure of the demonstration program supplied with the BRI service software package. The demonstration program is shipped as an executable program with its source.

Note: Since this program is based upon the Microsoft Foundation Classes, it can only be recompiled by Microsoft Visual C++ V5.0. Other compilers cannot be used.

Before you start the demonstration program, ensure that:

Refer to the appropriate installation manual for your operating system for details on installation.

7.2 briswi

Name

briswi

Purpose

Allows you to receive and place calls. It uses the BRI service call control functions on a BX 2000 board as well as the ADI service's media functions (AG board or QX board). It demonstrates:

Featured Functions

The following table presents the featured functions in briswi:
Function Type

Functions

Call Control

briAcceptCall, briAnswerCall, briGetCallStatus, briPlaceCall, briRejectCall, briReleaseCall, briSetExtendedArgs, briStartProtocol, briStopProtocol

Media (optional)

adiPlayFromMemory, adiRecordFromMemory, adiStartProtocol, adiStopProtocol

Switching (optional)

swiMakeConnection, swiOpenSwitch

Requirements

Usage

To start briswi, click Start. Select Programs and then select Natural MicroSystems BRI Service / Sample program BriSwi.

Functional Overview

briswi is a sample demonstration program that creates one CTA queue and two CTA contexts using the BRI service (and optionally, the ADI service). One CTA context is dedicated to receive calls, the other CTA context is dedicated to place calls.

When briswi is launched, the BRI Switching Sample window appears:

This window contains the following sections:
Section

Description

Incoming Call

Handles a CTA context dedicated to wait for incoming calls. This CTA context is referred to as "In" as soon as it is opened.

Outgoing Call

Handles a CTA context dedicated to place calls. This CTA context is referred to as "Out" as soon as it is opened.

Event History

Displays received events for incoming and outgoing CTA contexts.

Media Board

Indicates the board to be used. By default, no media board is selected.

If you do not select either an AG board or a QX board, only call control functions will be available (i.e., only the BRI service will be opened on both CTA contexts).

If you select a media board, the ADI service and the Switching service will be opened with the BRI service on both CTA contexts.

The BRI Switching Sample window contains the following buttons:
Button

Description

Initializes the demonstration program (initializes CT Access and creates the CTA queue).

Exits the demonstration program.

Note: If ctdaemon is started, tracing in CT Access will be enabled. Refer to the CT Access Developer's Reference Manual for more information about ctdaemon.

Prerequisites

If you do not need media functions, skip steps 2 and 3.

To start briswi for an ISDN demonstration:

  1. Connect the BX 2000 BRI ports to the PSTN or a PBX.

    
    
  2. Run the bxmon tool to configure the MVIP bus clocks. For more information about bxmon, refer to the BX 2000 Installation and Developer's Manual.

    
    
  3. Start agmon.

    
    
  4. Launch briswi.

Procedure

To run briswi:

  1. If you want to test media functions and switching, select the board in the Media Board section of the BRI Switching Sample window.

    
    If you do not want to test media functions and switching, go to Step 2.
  2. briswi does not specify a service or service manager when it calls ctaInitialize. You must specify the services and service managers in the cta.cfg file. The BRI service provides a default cta.cfg file to use where only the BRI service and BRIMGR are declared. If you use a media board, you may also add a line:

    
    Service = ADI, ADIMGR
    or
    Service = ADI, QDIMGR
    depending upon the media board type.
    Click on the Initialize BRI button to initialize CT Access. The Extended Arguments window appears:
    This window allows you to set extended arguments. If you close the window, no extended arguments will be set. If you leave the window opened, or minimized, each time a BRI call control function is called, briSetExtendedArgs will be called before with the associated values specified in the Extended Arguments window. Some predefined values are set by briswi.
    
    If you close this window and then want to set extended arguments, click on the Initialize BRI button  to reopen the window.
  3. By clicking on the Open Context button in the Incoming Call
    and /or Outgoing Call section(s), you create the In and /or Out CTA contexts. ctaCreateContext, ctaOpenServices,
    briStartProtocol, and optionally, adiStartProtocol are called at that time. briswi determines which services to open depending upon the media board chosen.

    
    You can choose the BX 2000 board number (by default, briswi uses board # 0), the stream, and the timeslot (according to the channel assignment described in Section 3.3.1, Specifying B Channel CTA Contexts). Enter the appropriate values in the Board, Stream, and  Timeslot fields.
    
    Note:  briswi refers only to the AG/QX board  # 0 specified in the ag.cfg /qx.cfg file. briswi uses the same stream and timeslots that are specified for the BX 2000 board.
    
    Figure 18 and Figure 19 illustrate the creation of the Incoming CTA context and the resulting events.
    
    
    
    
    Figure 18. Incoming CTA Context

    
    In the Event History section of the window, the events associated to this operation are displayed:
    Figure 19. Event History for the Incoming CTA Context

    
    Note:  The line "In 0x12000 ADIEVN_STARTPROTOCOL_DONE Finished(0x1001)" appears only if a media board has been selected.
    
Figure 20 and Figure 21 illustrate the creation of the Outgoing CTA context and the resulting events:

Figure 20. Outgoing CTA Context


In the Event History section of the window, the events associated to this operation are displayed:

Figure 21. Event History for the Outgoing CTA Context


Note:  You can open the "In" CTA context or the "Out" CTA context only. If you open both CTA contexts, they must have at least two different timeslots.
  1. You can now either:

    
    a.	 Place a call. Enter a Called Number in the Outgoing Call section of the BRI Switching Sample window:

    b. Receive a call. When the BRIEVN_INCOMING_CALL event is displayed in the Event History section of the window, either accept it, answer it, or reject it by pressing the appropriate button in the Incoming Call section of the window. If you first accept the call, you must then answer it or reject it.

  2. At any time, you can see the call status of each CTA context by clicking on the Call Status Info... button in the Incoming Call section or the Outgoing Call section of the window.

    
    The Incoming (or Outgoing) Call Status Information window displays: 
    As soon as this window is opened for a CTA context, it is refreshed when an event arrives for the specified CTA context. Click the Close button to return to the BRI Switching Sample window.
  3. When a call is established, if you have specified a media board, you can record or play a message depending upon whether the incoming or outgoing CTA context is active. To activate these media functions, click the following buttons on the BRI Switching Sample window:
    If this CTA context is active...

    Click on this button...

    Incoming

    Outgoing

    
    
  4. Either wait for BRIEVN_CALL_DISCONNECTED or release the call by clicking on the Release Call button.

    
    If you wait for BRIEVN_CALL_DISCONNECTED, you still must release the call afterwards.
  5. To exit the demonstration program click on the Exit button .

Compilation

briswi is supplied as an executable as well as source code.

If you need to recompile briswi, go to the <NMSDIR>\Bri\Demo directory and enter nmake or open the briswi.dsw project with Microsoft Visual C++ V5.0 and rebuild it.

7.2.1 briswi Files

briswi is a demonstration program built with the Microsoft Foundation Classes (MFC). The source code relative to the MFC is completely separated from the one related to CT Access, the BRI service, and the ADI service. The following table describes each of the files associated with briswi and their associated header files:
File

Description

BriSwi.cpp/h

MFC main program. briswi.cpp opens the main window (class CBriSwiDlg).

BriSwiDlg.cpp/h

MFC source code managing the main window. briswidlg.cpp manages the class CBriSwiDlg.

cbriswidlg is the constructor of the class cbriswidlg.

oninitdiaglog enables and disables buttons on the main window.

For more information about the contents of this file, refer to Section 7.2.2, briswi Coding Features.

BriSwiStatusDlg.cpp/h

MFC source code managing the display of the Call Control Status window.

BriSwiUUIdlg.cpp/h

MFC source code managing the display of the Extended Arguments window.

CallControl.cpp/h

Call control management (briappxxx functions: standard C language)

Switching.cpp/h

Switching management (swiappxxx functions: standard C language). For more information about this file, refer to Section 7.2.3, Switching on the MVIP Bus.

DSPFunc.cpp/h

Play and record management (adiappxxx functions: standard C language)

7.2.2 briswi Coding Features

Depending upon which button is clicked on the BRI Switching Sample window, the call control, media, and switching functions are executed as follows:
This function/button...

Does the following...

OnBriInit
[BRI Initialize button]

Calls briappInitialize ==> ctaInitialize and ctaCreateQueue.

OnExit
[Exit button]

Calls briappCloseContext ==> ctaDestroyContext, and briappUninitialize ==> ctaDestroyQueue.

OnInInit or OnOutInit [Open Context button]

Calls briappOpenContext which creates the CTA context, opens the services, starts the protocols, and opens switching devices ==> ctaCreateContext, ctaOpenServices, briStartProtocol, optionally adiStartProtocol, and swiOpenSwitch. For briStartProtocol, the default parameters are used. All informational events are sent to the application and VOICE_SERVICE and RAW_TELEPHONY_SERVICE calls are accepted. For adiStartProtocol, the nocc protocol is launched since no call control is done by the ADI service.

At the end of these functions, a timer of 200 ms is set. This timer is the mechanism used to check for events arriving from CT Access and also to let the user enter data at any time on the different windows opened in briswi. Every 200 ms, OntimerIdle is called. This function checks if a CT Access event arrived. If there is an event, it displays it in the Event history list and processes it. It also refreshes the status information of the associated CTA context.

OnInFinish or OnOutFinish
[Close Context button]

Calls briappCloseContext which stops the protocols, closes the services, and destroys the CTA context ==> briStopProtocol, optionally adiStopProtocol, ctaCloseServices, and ctaDestroyContext. These buttons are enabled as soon as the CTA contexts have been opened.

OnOutPlacecall
[Place Call button]

Gets the called and calling numbers and subaddresses, and calls briappPlaceCall ==> briPlaceCall. This button is enabled as soon as the "Out" CTA context has been opened.

All events that arrive during call establishment are displayed in the Event History section of the window (through OntimerIdle).

OnInAcceptCall
[Accept Call button], OnInAnswerCall
[Answer Call button], OnInRejectCall
[Reject Call button]

Calls respectively briappAcceptCall ==> briAcceptCall, briappAnswerCall ==> briAnswerCall, briappRejectCall ==> briRejectCall. These buttons are enabled when BRIEVN_INCOMING_CALL arrives for the "In" CTA context.

OnInRelease or OnOutRelease
[Release Call button]

Calls adiappStopPlaying or adiappStopRecording to stop the media function if needed ==> adiStopPlaying and adiStopRecording. Then it calls briappReleaseCall ==> briReleaseCall to release the call. These buttons are enabled when either a call was placed on the "Out" CTA context or a call arrived on the "In" CTA context.

OnInRecordMessage [Record Message button]

Opens a new file and calls adiappRecordToMemory ==> adiRecordToMemory to record a message. This button is enabled when BRIEVN_CALL_CONNECTED arrives. Each time ADIEVN_RECORD_DONE arrives, OnTimerIdle processes it (i.e., continues recording or stops recording).

OnOutPlayMessage
[Play Message button]

Opens a file provided with the demonstration program and calls adiappPlayFromMemory ==> adiPlayFromMemory to record a message. This button is enabled when BRIEVN_CALL_CONNECTED arrives. Each time ADIEVN_PLAY_DONE arrives, OnTimerIdle processes it (i.e., continues playing or stops playing).

OnInCallstatusInfo or OnOutCallstatusInfo
[Call Status Info button]

Calls briappGetCallStatus ==> briGetCallStatus and refreshes the Incoming/Outgoing Call Status Information window, if it is opened.

7.2.3 Switching on the MVIP Bus

The switching.cpp file manages the switching on the MVIP bus. The connections are set with swiappMakeConnections ==> swiMakeConnection. This function is called when either BRIEVN_INCOMING_CALL or BRIEVN_PLACING_CALL arrive.

For more information about switching on the BX 2000 board, refer to the BX 2000 Installation and Developer's Manual.

briswi sets the following switching on the MVIP bus:

Figure 22. briswi Switching on the MVIP bus


When calls arrive or are placed on the BX 2000 board, timeslots on local stream 0 are assigned (depending upon the timeslot t specified for "In" and "Out"). When the call is connected, briswi calls briGetCallStatus to get the timeslot assigned by the network (x) and then establish the connection of the local stream 0: timeslot x to the MVIP stream 7: timeslot t (full duplex mode).

On the media board, the connection between MVIP stream 7: timeslot t and local stream 5 (DSP resources):timeslot t is also established (full duplex mode). Therefore, all data arriving on timeslot x are routed to the DSP resources and vice versa to allow playing or recording messages.

Note: The choice of MVIP stream 6 and 7 is arbitrary.

In Figure 22, the dotted lines for the BX 2000 board are the default connections that are reset in swiappResetConnections. It is called when BRIEVN_CALL_RELEASED arrives on the CTA context.



(Page 1 of 1 in this chapter) Version


tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights reserved.