Previous PageTable Of ContentsIndexNext Page



3 Messaging API Programming Model

3.1 Introduction

This chapter:

3.2 AG ISDN Messaging API Application Overview

An AG ISDN Messaging API application typically performs the following tasks:

Undisplayed Graphic

Figure 9: AG ISDN Messaging API Application Flowchart

3.3 Initializing Your AG Boards

You must initialize and load DSP files, Trunk Control Programs (TCPs) and protocol stack runfiles to your AG board(s) before you can run an AG ISDN application. The items to load to the boards are specified in an AG configuration file (ag.cfg). To load the components to your AG boards, run agmon, the AG board initialization and monitoring utility. agmon reads the AG configuration file and sets up your boards as described in the file. To learn how to create an AG configuration file for your setup, see the AG ISDN Installation Manual, the installation manual for your AG board, and the AG Runtime Configuration and Developer's Manual.

Keep agmon running on the system to monitor your AG boards and report errors.

3.4 Initializing the Application

To initialize, an AG ISDN Messaging API application does the following:

3.4.1 About Network Access Identifiers (NAIs)

A trunk is referred to by its network access identifier (NAI). When you initialize an ISDN protocol stack instance for a CTA context (using isdnStartProtocol), you specify the NAI of the trunk to associate with the CTA context. From then on, the application can communicate with the D channel on that trunk via the CTA context handle. For example, when an event is received, the CTA context handle indicates the trunk on which the event occurred.

Different board types support differing numbers of D channels, with different NAI numbers.

The table below shows what each AG board type supports:

For more information, see Section 4.4, Accessing D Channels.

3.4.2 About Connection Ids

The connection id is a handle to a call on a B channel. It is used to identify the call in all communications between the ACU and the application. The id is a number between 0 and 39.

When an incoming call arrives, the protocol stack assigns it a connection id. The connection id assigned is the highest unused value starting with 39. For example, if connection ids 39 and 38 are already allocated to calls, the protocol stack assigns id 37 to the next call.

When the application places a call, it assigns a connection id to the call. To avoid any chance of collision, the application should use connection ids beginning with 0. The application must keep track of which connection ids are in use and which are available. (The demonstration program documented in Chapter 9 illustrates this.)

When a call is disconnected, the connection id is freed. The id can then be assigned to a new call by the protocol stack or the application.

A different set of connection ids (numbered 0 through 39) is available for each D channel. Thus a call is identified both by its D channel context and by its connection id.

3.5 Sending ISDN Messages to the ACU

To send a message to the ACU, the application does the following:

Figure 10 illustrates the content and meaning of each of the arguments sent in an isdnSendMessage function call:

Undisplayed Graphic

Figure 10: isdnSendMessage Data Structures

3.6 Receiving Events and ISDN ACU Messages

All messages and events are presented to the application through the standard CT Access/AG Access event handling mechanism. The events returned can be standard CT access or AG Access events, events sent by an ISDN protocol stack instance, or events specific to any AG Access or CT Access extensions. They arrive in the form of the standard CTA (or ADI) event data structure:

The CTA_EVENT or ADI_EVENT structure informs the application which event occurred on which CTA context, and provides additional information specific to the event. The event's prefix relates the event to a specific Natural MicroSystems library of functions, as shown in the following table:

The CTA_EVENT or ADI_EVENT structure contains the following fields:

CT Access and AG Access applications receive these events in different ways, as follows:

3.6.1 Receiving Messages From the ACU

When an ISDN ACU message is received, an ISDNEVN_RCV_MESSAGE event occurs.

buffer in the CT Access or AG Access structure is a pointer to an ISDN_PACKET structure. This structure contains:

Figure 11 illustrates the structure of this message packet:

Figure 11: Receiving ACU Messages

After receiving and processing the data within the CTA_EVENT event buffer, the application must use isdnReleaseBuffer to free the buffer as quickly as possible. Otherwise, the ISDN interface will time out and stop passing events to the application. For more information about isdnReleaseBuffer, see Chapter 7.

The following code fragment illustrates how the application should process an incoming ISDN ACU event from the on-board protocol stack via the CT Access event mechanism:

3.7 Stopping an ISDN Protocol Stack Instance

To stop an ISDN protocol stack instance, call isdnStopProtocol from within the application. This shuts down the ISDN protocol stack instance, and releases all on-board resources and buffers formerly used by the protocol stack instance.

The ISDNEVN_STOP_PROTOCOL event contains the completion status of the stop request. If the stack instance stopped successfully, the value field in this event contains SUCCESS. Otherwise, another reason code appears here.

For more information about isdnStopProtocol, see Chapter 7.


Natural MicroSystems, Inc.
100 Crossing Boulevard
Framingham, MA 01702

Contact Developer Support

Previous PageTable Of ContentsIndexNext Page