# Accessing D channels

Once one or more contexts are created for the D channels, initialize a separate ISDN protocol stack instance for each context and associate a specific D channel with the context. When this is done, a D channel is ready to send and receive messages.

## 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 context (using isdnStartProtocol), specify the NAI of the trunk to associate with the context. If duplicate NAI values are defined, specify the NFAS group number. From then on, the application can communicate with the D channel on that trunk through the context handle.

For example, when an event is received, the context handle indicates the trunk on which the event occurred. Different board types support different numbers of D channels and provide different NAI default values. The following table shows what each board type supports:

Board type | Number of D channels | NAI default values
Four-trunk board | As many as 4 | 0 through 3
Two-trunk board | As many as 2 | 0 through 1

## Initializing ISDN protocol stack instances

Use isdnStartProtocol to initialize NMS ISDN protocol stack instances.

Note: Once you reference the context in an isdnStartProtocol function call, do not reference that context in any other function call except isdnStopProtocol (to stop the stack).

To start up an NMS ISDN protocol stack instance for ISDN ACU call control or LAPD, set the protocol, partner_equip, and parms arguments as follows:

### protocol

Set the protocol argument to:

Structure | Mode
ISDN_PROTOCOL_Q931CC | ACU stack mode
ISDN_PROTOCOL_LAPD | LAPD stack mode

### partner_equip

partner_equip indicates the type of equipment connected to the board.

If the board is... | And NMS ISDN is to run in... | Set partner_equip to...
--- | --- | ---
Connected to network | ACU stack mode | EQUIPMENT_NT
Connected to network | LAPD stack mode | EQUIPMENT_DCE
Acting as network | ACU stack mode | EQUIPMENT_TE
Acting as network | LAPD stack mode | EQUIPMENT_DTE

### parms

The parms argument is a pointer to a parameter structure to configure the protocol stack. If the application needs to change a parameter, pass a pointer to one of the following structures in this call:

Structure | Mode
ISDN_PROTOCOL_PARMS_Q931CC | ACU stack mode
ISDN_PROTOCOL_PARMS_LAPD | LAPD stack mode

If the application does not need to modify parameters, pass NULL to accept the default settings. For ACU, all of the services are supported by default.

The ISDNEVN_START_PROTOCOL event contains the completion status of the start request. If the ISDN protocol stack instance starts successfully, the value field in this event contains SUCCESS. Otherwise, another value appears here.

See isdnStartProtocol for more information.