Table of Contents Index NMS Glossary Previous Page Next Page Version


Chapter 7

Demonstration Programs


7.1 Introduction
7.2 Demonstration Programs
7.3 ISDN Daemon: isdncta 7.3.1 isdncta Structure and Coding Features 153

7.4 ISDN Call Control Demonstration: isdnchan 7.4.1 isdnchan Structure and Coding Features 160

main Function 160

Opening the AG Driver, CTA Context, and Protocol 161

Calling MyReceiveCall Or MyPlaceCall 161

Call Receiving Function MyReceiveCall 162

Call Placement Function MyPlaceCall 165

Switching Function ConnectBChannel 165

7.5 ISDN NCC Call Control Demonstration: isdnncc 7.5.1 isdnncc Structure and Coding Features 171

main Function 172

Opening the AG Driver, CTA Context, and Protocol 172

Calling MyReceiveCall Or MyPlaceCall 173

Call Receiving Function MyReceiveCall 173

Call Placement Function MyPlaceCall 175

Disconnecting Function MyHangUp 176

Switching Function ConnectBChannel 177

7.1 IntroductionTop of Page

This chapter describes the functionality and structure of the demonstration programs supplied with your NMS ISDN software package.

Each demonstration program is shipped as an executable program, including its source and makefiles.

Before you start the demonstration programs, ensure that:

· Natural Access is properly installed.

· The board is executing.

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

7.2 Demonstration ProgramsTop of Page

The following demonstration programs are provided with NMS ISDN:
Program

Description

isdncta

A daemon which starts and stops the ISDN protocol stack.

isdnncc

ISDN NCC call control demonstration program.

isdnchan

ISDN ADI call control demonstration program.

7.3 ISDN Daemon: isdnctaTop of Page

Name

isdncta

Purpose

Starts and stops the ISDN protocol stack. Demonstrates:

Once the ISDN protocol stack is started using this program, you can run any other Natural Access call control program with NMS ISDN.

Featured Functions

isdnStartProtocol, isdnStopProtocol

Requirements

Usage

isdncta [options]

where options is one or more of the following:
Option

Description

Default

-a nai

Network access identifier of trunk to use.

0

-g group_#

NFAS group number if Multiple CCID is configured.

-b board_#

Board number (Terminal Equipment interface). Note: Do not use -B if this option is specified.

0

-B board_#

Board number (Network Terminator interface). Note: Do not use -b if this option is specified.

0

-I hex_bit

(Optional) Setting for in_calls_behavior, in hex. Use to make bit settings required for overlap receiving and/or channel ID setting (see Chapter 4):

CC_TRANSPARENT_OVERLAP_RCV =0x0080

CC_SET_CHAN_ID=0x2000

0x0

-o operator

Network operator variant. Allowed values:

Value Protocol
3 France Telecom VN6
8 Northern Telecom DMS 100
9 INS-1500 NTT
11 EuroISDN1

15 Australian Telecom 1
16 QSIG
17 Hong Kong Telephone
20 US National ISDN 2
23 AT&T 5ESS10
24 AT&T 4ESS
25 Korea
50 Taiwan

23 (AT&T 5ESS10)

-O hex_bit

(Optional) Setting for out_calls_behavior, in hex. Use to make bit settings required for overlap sending and/or A-law/mu law coding (see Chapter 4):

CC_USER_SENDING_COMPLETE =0x0002

CC_USE_MU_LAW=0x0010

CC_USE_A_LAW=0x0020

0x0

-c country

Country. The behavior of a network operator may change depending on the country specified. The default country depends on the operator. Allowed values:

Value Country
1 USA
32 Belgium
33 France
44 Great Britain
46 Sweden
49 Germany
61 Australia
81 Japan
82 Korea
86 China
92 Singapore
852 Hong Kong
866 Taiwan
1000 Europe1

1 (USA)

-s

Creates the default connections needed to support NMS ISDN call control. Only necessary if switching is enabled in your configuration file (such as, Clocking.HBus.ClockMode=
MASTER_A, MASTER_B, or SLAVE).

If EnableMVIP=NO, these connections are made automatically when the board boots. For more information, Section 3.3, Making Switch Connections for NMS ISDN.

No connections are made. (Assumes switching is disabled.)

-T

t309 option for D channel backup configurations (see Appendix B).

Disabled.

-h or -?

Display a help screen, and terminate the program.

N/A

1 Use for the following countries: Austria, Denmark, Finland, Greece, Iceland, Ireland, Italy, Liechtenstein, Luxembourg, Netherlands, Norway, Portugal, Russia, Spain, or Switzerland.

Functional Overview

To enable other Natural Access programs to place or receive calls on an ISDN trunk, the user starts the ISDN protocol stack by running isdncta. This program allows the user to choose from several ISDN operator variants based on command line options.

When isdncta is launched, it does the following:

1. It parses command line arguments, and makes sure all arguments are valid and do not conflict.

2. It initializes Natural Access.

3. If the -s option is specified, isdncta makes connections needed to support NMS ISDN call control. (If .Clocking.HBus
.ClockMode=MASTER_A
, MASTER_B, or SLAVE in the configuration file, these connections are made automatically when the board boots.) For more information, see
Section 3.3, Making Switch Connections for NMS ISDN.

4. If the -g option is specified, isdncta sets ENABLE_MULTIPLE_CCID parameters in the ISDN_PROTOCOL_PARMS_CHANNELIZED structure to enable Multiple CCID configuration, and passes the provided NFAS group number as an extra argument to isdnStartProtocol.

5. It starts the ISDN protocol stack on the board specified on the command line, either as Terminal Equipment (TE) or as Network Equipment (NT), with the specified network operator variant and country variant.

6. It waits for the q key to be pressed. When the q key is pressed, the daemon program stops the ISDN protocol stack and terminates.

Procedure

To launch isdncta:

1. Set up your configuration file to describe your board and software. For more information, see the NMS ISDN Installation Manual.

2. Run oamsys (or agmon for versions prior to Natural Access 4.0) to initialize your hardware and to make your configuration file changes effective.

3. To start the ISDN protocol stack, enter:

isdncta [options]


... where options is one or more of the command line options described above.

4.	 Now launch another demonstration program.

5. When you have finished, press Q to terminate isdncta.

Compilation

isdncta is supplied in executable form and as source code. If you need to recompile isdncta, do one of the following:
Under this OS...

Go to this directory...

Enter...

Windows NT

\nms\ctaccess\demos\isdncta

nmake

UNIX

/opt/nms/ctaccess/demos/isdncta

make

For more information, see the NMS ISDN readme file.

7.3.1 isdncta Structure and Coding Features

isdncta is based on the Natural Access asynchronous programming model. Most functions in the program are Natural Access primitives, with names starting with ncc, adi or cta. An example is nccStartProtocol, which starts a TCP instance on a context. Other functions in isdncta are found in CTADEMO, a library distributed with Natural Access containing examples of how to use the API. CTADEMO functions have names starting with Demo. One example is DemoOpenPort, which opens the Natural Access application queue, and then calls another demonstration function to create a context and open services on the new queue. Most CTADEMO functions are wrappers that enclose the corresponding NCC or ADI function and wait for an event to terminate the function, signaling whether the function was successful or not. In this way, they transform an asynchronous wait for an event into a synchronous function.

The main function of isdncta first defines the list of Natural Access service managers that the application will need. Then it calls ParseArguments, which parses command line arguments, and assigns the corresponding values to variables. ParseArguments also checks that none of the user options are inconsistent with each other, and warns the user if it finds a problem.

Then main registers an error handler with Natural Access, calls ctaInitialize to initialize Natural Access, and calls MyOpenPort, which uses the demonstration library function DemoOpenPort to open a context.

If the -s option was specified, main then calls MyMakeConnection, which uses the Natural Access Switching service to make the connections necessary to support Natural Call Control. For more information, see Section 3.3, Making Switch Connections for NMS ISDN.

main then calls IsdnStart to start the ISDN protocol stack. IsdnStart calls isdnStartProtocol on the open context with the operator and country variant specified on the command line. isdnStartProtocol is started with ISDN_PROTOCOL_CHANNELIZED specified, so it runs in Natural Call Control mode.

main then calls WaitForKeyboardEvent. WaitForKeyboardEvent waits for the q key to be pressed. When the key is pressed, main calls IsdnStop, which calls isdnStopProtocol to stop the ISDN protocol stack. Then the daemon program terminates.

7.4 ISDN Call Control Demonstration: isdnchanTop of Page

Name

isdnchan

Purpose

Uses the ISDN TCP with the ADI service to receive and place calls. Demonstrates:

Featured Functions

adiAnswerCall, adiGetCallStatus, adiPlaceCall, adiRejectCall, adiSetExtendedArgs, adiStartDTMF, adiStartProtocol, swiMakeConnection, vcePlayList, vceRecordMessage

Requirements

Usage

isdnchan [options]

... where options is one or more of the following:

Option

Description

Default

-a mode

Accept call, without answering. mode specifies the call acceptance method:

Value Description

1 Accept and play ring back tone.

2 Accept and remain silent until next
command.

3 Accept with user audio and play a voice
file.

4 Accept with user audio and detect
DTMFs.

Answer call.

-b board_#

Board number.

0

-d

Use the TCP's default parameters, without loading a country-specific parameter file. Refer to Appendix A for details on the default parameters of the NMS ISDN TCP.

Loads a country-specific parameter file.

-h or -?

Display a help screen, and terminate.

N/A

-i

Enable interactive dialing.

Disabled.

-n num_to_dial

Number to dial. num_to_dial must be formatted appropriately, as described in Section 5.3.4, Digit Strings in Outbound Calls.

123

-P

This option allows the user to place a call on an ISDN PRI trunk in Non-Exclusive Mode. This allows the equipment on the other side of the trunk to accept a call on any B channel.

Some ISDN network terminators do not accept exclusive calls. In these cases, you must use the -P option.

Exclusive Mode (Preferred Mode)

-r rings

Number of ring tones to play before answering inbound call.

2

-s n:m

stream and timeslot.

MVIP-95: 0:0

MVIP-90: 18:0

(depends upon board type)

-t threads

Number of threads to launch.

0

-u

Send a string of user-to-user information.

Disabled.

-v level

Verbosity level of messages printed on screen. level can be any of the following:

Value Description
0 Display error messages only
1 Display errors and
unexpected high-level events
2 Display errors and all high-
level events
3 Display errors and all events

2

Procedure

To start isdnchan for an ISDN demonstration:

1. Start isdncta as described in Section 7.3.

2. Enter the following at the command line:

isdnchan [options]

... where options is one or more of the command line options described above.

Functional Overview

When isdnchan is started, it does the following:

1. If the -d option is not specified, the program loads the country-specific parameters that isd0.tcp will use. To do so, it loads and parses one of the country-specific parameter files provided with the product.

2. It starts the NMS ISDN TCP isd0.tcp, configuring it using the parameters loaded in step 1.

3. It either places a call or waits for an inbound call, depending on the -i command line option.

4. If it is commanded to dial out (outbound behavior), it dials either automatically or interactively, depending on the -i command line option.

5. If the demonstration program is commanded to wait for a call (inbound behavior):

a. It waits for incoming calls.

b. When a call arrives, if the user has selected the -P command line option (Non-Exclusive Mode), the program performs the switching to connect the B channel on which the call has been received to the appropriate DSP resource on the board.

c. The user can answer immediately by pressing a key on the computer keyboard, or wait until a specified number of rings has been played by the TCP. When the rings have been played, the TCP answers without the user's intervention.

d. At this point, the program checks the first digit of the incoming number. If the digit is an 8, it rejects the call and plays a busy tone. If the digit is a 9, it rejects the call, plays a reorder tone and goes back to waiting for calls. If the digit is a 0, it rejects the call and plays a Special Information Tone (SIT).

Note: These digits are assigned in the code with a preprocessor directive. You can change them; for example, for tests in a switch-room environment where the demonstration program is connected to a line with an address starting with 8, 9, or 0. e. If the first digit is not an 8, 9, or 0, the demonstration program plays a welcome message and speaks back the digits it received.

f. It then plays another prompt asking the user to choose an action by pressing a key on the telephone keypad. Available actions are: play a file, record a file, or hang up.

g. It starts the DTMF tone detector and waits for a tone. If the tone does not arrive, it hangs up.

h. If the tone arrives, the demonstration program performs the action that the tone specifies, then hangs up.

6. If the demonstration program seizes the line first (outbound behavior):

a. It dials the number specified by the user.

b. If the user has selected the -P command line option (Non-Exclusive Mode), the program performs the switching to connect the B channel on which the call has been placed to the appropriate DSP resource on the board.

c. When the call is answered, the demonstration program starts recording.

d. When silence is detected, the demonstration program stops recording and plays the DTMF tone meaning "hang up" for its inbound counterpart.

e. Then the program starts playing back the newly recorded voice file.

f. When playing is completed, it hangs up.

The demonstration program hangs up if the caller hangs up at any time. If -v is specified on the command line, the demonstration program displays on-screen the Natural Access messages it receives, according to the specified verbosity level.

The following table lists the interactions between two isdnchan applications connected back-to-back, in which one acts as an inbound application, and the other as an outbound application:
Outbound

Inbound

Place call


chap70.gif

Wait for call

Get connected


chap71.gif

Answer call

Record


chap72.gif

Speak prompt and digits

Send DTMF tone


chap73.gif

Detect DTMF tone

Play back recorded file


chap74.gif

Record voice

Wait for hang up, or hang up


chap75.gif

Wait for hang up, or hang up

Compilation

isdnchan is supplied as executable as well as source code.

If you need to recompile isdnchan, do one of the following:
Under this OS...

Go to this directory...

Enter...

Windows NT

\nms\ctaccess\demos\isdnchan

nmake

UNIX

/opt/nms/ctaccess/demos/isdnchan

make

For more information, see the NMS ISDN readme file.

7.4.1 isdnchan Structure and Coding Features

isdnchan is based on the Natural Access asynchronous programming model. Most functions in the program are Natural Access primitives, with names starting with adi or cta. An example is adiGetCallStatus, which retrieves a structure containing information about the current call. Other functions in isdnchan are found in CTADEMO, a library distributed with Natural Access containing examples of how to use the API. CTADEMO functions have names starting with Demo. One example is DemoRejectCall, which uses adiRejectCall and then waits for the result before returning. Most CTADEMO functions are wrappers that enclose the corresponding ADI function and wait for an event to terminate the function, signaling whether the function was successful or not. In this way, they transform an asynchronous wait for an event into a synchronous function.

main Function

The main function of isdnchan first defines the list of Natural Access service managers that the application will need. Then it parses its command line arguments, and assigns the corresponding values to its variables. The function also checks that none of the user options are inconsistent with each other, and warns the user if it finds a problem. Then it registers an error handler with Natural Access and starts Natural Access.

Then main launches the demonstration loop.

Opening the AG Driver, CTA Context, and Protocol

In isdnchan, RunDemo defines the list of Natural Access services needed by the application. Then it calls the DemoOpenPort function, a function from the CTADEMO library. DemoOpenPort opens the Natural Access application queue, attaching all defined service managers. It then creates a context and opens the defined services on the context specified by the user on the specified board. If the user did not specify these parameters in the command line, the default context opened is 4:0, 51 on board 0. If this context is already in use, the call to Natural Access fails and the demonstration program terminates.

Next, RunDemo calls DemoLoadParameters, a function from the CTADEMO library. DemoLoadParameters loads a country-specific parameter file, containing parameters to configure the TCP for the particular implementation of ISDN used in the country. If the -c option was specified on the command line with a three-letter country code cty, DemoLoadParameters looks for the file prtcty.par, where prt is the value given with the -p option on the command line, minus the trailing digit. Otherwise, DemoLoadParameters searches for the file adiisd.par. It looks first in the current directory, and then in one of the following locations:

· Windows NT: \nms\ctaccess\cfg\

If the country-specific parameter file cannot be found, the demonstration program terminates.

Next, RunDemo starts the TCP on the opened context. To do so, it calls adiStartProtocol with a NULL pointer for protoparms, so that the TCP uses the parameters just loaded from the country-specific parameter file.

Calling MyReceiveCall Or MyPlaceCall

At this point, RunDemo is ready to accept incoming calls or place outgoing calls. The incoming call loop is very simple: the function MyReceiveCall is called repeatedly. This function performs all of the call interaction, and hangs up the line when the call is completed. This function is discussed in detail later in this chapter.

The loop does the following:

The function MyReceiveCall first determines why it has been called.

The function MyPlaceCall does the following:

The function ConnectBChannel does the following:

7.5 ISDN NCC Call Control Demonstration: isdnnccTop of Page

Name

isdnncc

Purpose

Uses the ISDN TCP with Natural Access to receive and place calls.

Demonstrates:

Featured Functions

adiCollectDigits, adiGetBoardInfo, adiStartCallProgress, adiStartDTMF, nccAnswerCall, nccDisconnectCall, nccGetCallStatus, nccGetExtendedCallStatus, nccPlaceCall, nccQueryCapability, nccRejectCall, nccReleaseCall, nccStartProtocol, swiMakeConnection, vcePlayList, vceRecordMessage

Requirements

Usage

isdnncc [options]

... where options is one or more of the following:
Option

Description

Default

-a mode

Accept call, without answering. mode specifies the call acceptance method:

Value Description

1 Accept and play ring back tone.
2 Accept and remain silent until next
command.
3 Accept with user audio and play a
voice file.
4 Accept with user audio and detect
DTMFs.

Answer call.

-b board_#

Board number.

0

-d

Use the TCP's default parameters, without loading the parameter file.

Refer to Appendix A for details on the default NCC parameters of the NMS ISDN TCP.

Loads the parameter file.

-h or -?

Display a help screen, and terminate.

N/A

-i

Program behaves as inbound.

Outbound.

-n num_to_dial

Number to dial. num_to_dial must be formatted appropriately, as described in Section 4.5.1, Initiating an Outbound Call.

123

-P

This option allows the user to place a call on an ISDN PRI trunk in Non-Exclusive Mode.

This allows the equipment on the other side of the trunk to accept a call on any B channel.

Some ISDN network terminators do not accept exclusive calls. In these cases, you must use the -P option.

Exclusive Mode (Preferred Mode)

-r rings

Number of ring tones to play before answering an inbound call.

2

-s n:m

Stream and timeslot.

MVIP-95: 0:0
MVIP-90: 18:0
(depends upon board type)

-t threads

Number of threads to launch.

0

-u

Send a string of user-to-user information.

Disabled.

-v level

Verbosity level of messages printed on screen. level can be any of the following:

Value Description
0 Display error messages only
1 Display errors and
unexpected high-level events
2 Display errors and all high-
level events
3 Display errors and all events

2

Procedure

To start isdnncc for an ISDN demonstration:

1. Start isdncta, as described in Section 7.3.

2. Enter the following at the command line:

isdnncc [options]


... where options is one or more of the command line options described above.

Functional Overview

When isdnncc is started, it does the following:

1. If the -d option is not specified, the program loads parameters that isd0.tcp will use.

To do so, it loads and parses one of the nccxisdn.par parameter files provided with the product.


2.	 It starts the NMS ISDN TCP isd0.tcp, configuring it using the parameters loaded in step 1.

3. It either places a call or waits for an inbound call, depending on the -i command line option.

4. If it is commanded to dial out (outbound behavior), it dials automatically.

5. If the demonstration program is commanded to wait for a call (inbound behavior):

a. It waits for incoming calls.

b. When a call arrives, call status structures are accessed to retrieve the incoming call information such as the called number, calling number, or UUI, if any.

c. If the user has selected the -P command line option (Non-Exclusive Mode), the program performs the switching to connect the B channel on which the call has been received to the appropriate DSP resource on the board.

d. If the -a option has been specified in the command line, the call is accepted using the mode supplied by the user.

e. At this point, the program checks the first digit of the incoming number. If the digit is an 8, it rejects the call and plays a busy tone. If the digit is a 9, it rejects the call, plays a reorder tone and goes back to waiting for calls. If the digit is a 0, it immediately rejects the call by calling nccDisconnectCall, starting the disconnect procedure.

f. If a reject digit was not found in the incoming number, the program waits until a specified number of rings have been played by the TCP. When the rings have been played, the TCP answers the call.

g. If the first digit is not an 8, 9, or 0, the demonstration program plays a welcome message and speaks back the digits it received.

h. It then plays another prompt asking the user to choose an action by pressing a key on the telephone keypad. Available actions are: record a file (1), play a file (2), or hang up (3).

i. The demonstration program starts the DTMF tone detector and waits for a tone. If the tone does not arrive, it hangs up.

j. If the tone arrives, the demonstration program performs the action that the tone specifies, then hangs up.

6. If the demonstration program seizes the line first (outbound behavior):

a. It dials the number specified by the user. The calling number is precoded as 987.

b. If the user has selected the -P command line option (Non-Exclusive Mode), the program performs the switching to connect the B channel on which the call has been placed to the appropriate DSP resource on the board.

c. When the call is answered, the demonstration program starts call progress.

d. If call progress detects the busy tone, the program hangs up, and ring tones are reported to the user. If call progress finishes with silence or detects voice, the program starts recording.

e. When silence is detected by the recording functions, the demonstration program stops recording and plays the DTMF tone 3 meaning hang up for its inbound counterpart.

f. When playing is completed, it hangs up.

The demonstration program hangs up if the caller hangs up at any time. If the program receives NCCEVN_CAPABILITY_UPDATE (meaning that the state of the ISDN stack has changed), it displays the new capability mask.

If the program receives NCCEVN_EXTENDED_CALL_STATUS_ UPDATE (sent by the TCP when a new UUI string or a progress descriptor is received from the network), a new field is displayed on the screen.

If -v is specified on the command line, the demonstration program displays on-screen the Natural Access messages it receives, according to the specified verbosity level.

The following table lists the interactions between two isdnncc applications connected back-to-back, in which one acts as an inbound application, and the other as an outbound application:
Outbound

Inbound

Place call.


chap77.gif

Wait for call.

Get connected.


chap78.gif

Answer call.

Record.


chap79.gif

Speak prompt and digits.

Send DTMF tone.


chap710.gif

Detect DTMF tone.

Hang up.


chap76.gif

Hang up.

Compilation

isdnncc is supplied as an executable as well as source code. If you need to recompile isdnncc, do one of the following:
Under this OS...

Go to this directory...

Enter...

Windows NT

\nms\ctaccess\demos\isdnncc

nmake

UNIX

/opt/nms/ctaccess/demos/isdnncc

make

For more information, see the NMS ISDN readme file.

7.5.1 isdnncc Structure and Coding Features

isdnncc is based on the Natural Access asynchronous programming model. Most function calls in the program are Natural Access primitives, with names starting with ncc (for call control), adi (for media operations) or cta. An example is nccGetCallStatus, which retrieves a structure containing some information about the current call. Other function calls in isdnncc are found in CTADEMO, a library distributed with Natural Access containing examples of how to use the API. CTADEMO functions have names starting with Demo. One example is DemoSetReportLevel, which sets a filter to tell which messages to report. Most CTADEMO functions are wrappers that enclose the corresponding NCC, ADI, or CTA function and wait for an event to terminate the function, signaling whether the function was successful or not. In this way, they transform an asynchronous wait for an event into a synchronous function.

main Function

The main function of isdnncc first defines the list of Natural Access service managers that the application will need. Then it parses its command line arguments, and assigns the corresponding values to its variables. The function also checks that none of the user options are inconsistent with each other, and warns the user if it finds a problem. Then it registers an error handler with Natural Access and starts Natural Access.

Then main launches the demonstration loop.

Opening the AG Driver, CTA Context, and Protocol

In isdnncc, RunDemo defines the list of Natural Access services needed by the application. Then it calls the DemoOpenPort function, a function from the CTADEMO library. DemoOpenPort opens the Natural Access application queue, attaching all defined service managers. It then creates a context and opens the defined services on the context specified by the user on the specified board. If the user did not specify these parameters in the command line, the default context opened is 4:0, 52 on board 0. If this context is already in use, the call to Natural Access fails and the demonstration program terminates.

Next, RunDemo calls ctaLoadParFile, a function from the CTA library. ctaLoadParFile loads the nccxisdn.par parameter file, containing parameters to configure the TCP. It looks for this file first in the current directory, and then in one of the following locations:

· Windows NT: \nms\ctaccess\cfg\

If the nccxisdn.par parameter file cannot be found, the demonstration program terminates.

Next, RunDemo starts the TCP on the opened context. To do so, it calls nccStartProtocol with the following arguments:

Since RunDemo changes the parameter defaults for NCC startparms and ISDN protstartparms, it first calls ctaGetParms to obtain the default parameter values.

Calling MyReceiveCall Or MyPlaceCall

At this point, RunDemo is ready to accept incoming calls or place outgoing calls. The incoming call loop is very simple: MyReceiveCall is called repeatedly. This function performs all the call interactions, and hangs up the line when the call is completed. If the -i option was not specified, the loop immediately calls MyPlaceCall to place a call.

Call Receiving Function MyReceiveCall

The function MyReceiveCall waits for NCCEVN_INCOMING_CALL event and then immediately queries Natural Access to get information about the incoming call by invoking nccGetCallStatus and nccGetExtendedCallStatus. The attributes are:

All these attributes are stored in data structures, of type NCC_CALL_STATUS and NCC_ISDN_EXT_CALL_STATUS. (See Section 4.4, Retrieving Call Information for more information.)

If Non-Exclusive Mode has been selected, MyReceiveCall calls ConnectBChannel to connect the appropriate DSP resource on the board to the B channel on the trunk.

While waiting for ADIEVN_INCOMING_CALL, MyReceiveCall may receive NCCEVN_RECEIVED_DIGIT, indicating that a digit has arrived in the queue. MyReceiveCall displays a message on the screen which indicates the digit. An NCCEVN_RECEIVED_DIGIT event is possible if the ISDN variant supports overlapped receiving mode and the user sets the appropriate behavior bit while starting ISDN protocol. (See Section 4.8 for more information). MyReceiveCall may also receive NCCEVN_CALL_DISCONNECTED, indicating that the calling party has hung up. MyReceiveCall calls hangup_in to hang up the call.

If the state of the ISDN stack changes, MyReceiveCall receives NCCEVN_CAPABILITY_UPDATE. It then invokes nccQueryCapability to retrieve the new capabilitymask. It prints this information on the screen. If the NCC_ISDN_EXT_CALL_STATUS structure is updated, NCCEVN_EXTENDED_CALL_STATUS_UPDATE is sent to the application. The value field of the event indicates the type of information that was changed. Currently, there are two fields which may be updated: uui and progressdescription. They are changed if the value of the event is equal to the value of NCC_X_STATUS_INFO_UUI and/or the NCC_X_STATUS_INFO_PROGRESS descriptor.

MyReceiveCall decides to answer or reject a call based on the first digit in the called number. Depending upon the digit, MyReceiveCall answers the call or rejects it in different ways. The digits MyReceiveCall looks for are defined in isdnncc.c. They signify the following:

If MyReceiveCall answers the call, it then implements the following user interaction. This allows the demonstration program to talk either with a human being on a telephone, or with a corresponding outbound application:

The function MyPlaceCall does the following:

If the state of the ISDN stack changes, MyPlaceCall receives NCCEVN_CAPABILITY_UPDATE. It then invokes nccQueryCapability to retrieve the new capabilitymask. It prints this information on the screen. If the NCC_ISDN_EXT_CALL_STATUS structure is updated, NCCEVN_EXTENDED_CALL_STATUS_UPDATE is sent to the application. The value field of the event indicates the type of information that was changed. Currently, there are two fields that may be updated: uui and progressdescription. They are changed if the value of the event is equal to the value of NCC_X_STATUS_INFO_UUI and/or the NCC_X_STATUS_INFO_PROGRESS descriptor.

Disconnecting Function MyHangUp

MyHangUp is called whenever the program wants to hang up. The function first calls nccGetCallStatus to obtain the call's state. If the current call's state is NCC_CALLSTATE_DISCONNECTED (meaning that the NCCEVN_CALL_DISCONNECTED event has been received), nccReleaseCall is called to release the call handle. Receipt of the NCCEVN_CALL_RELEASED event indicates that the call handle has been cleared.

If the call state returned by nccGetCallStatus is different from NCC_CALLSTATE_DISCONNECTED, the function has been called to initiate the disconnect process. nccDisconnectCall is called in this case, and MyHangUp waits for the NCCEVN_CALL_DISCONNECTED event indicating that the other party accepted the disconnect. Then nccReleaseCall is called to clear the call handle.

Switching Function ConnectBChannel

ConnectBChannel does the following:



Table of Contents Index NMS Glossary Previous Page Next Page Version


1 In MVIP-90 terms, this is local streams 18:0, 0.

2 In MVIP-90 terms, this is local streams 18:0,0.

Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2001, Natural MicroSystems, Inc. All rights reserved.