# Setting up D channels

Initialize an ISDN protocol stack instance on each D channel context, using isdnStartProtocol. This function starts up an ISDN protocol stack instance on the dummy context in channelized stack mode.

Note: If D channel backup is defined in the configuration, do not initialize NaturalAccess on the context bearing the backup D channel. See the Dialogic® NaturalAccess™ ISDN Software Installation Manual for more information on D channel backup.

## Network access identifiers (NAIs)

A trunk is referenced by a numeric value, called a network access identifier (NAI). All NAIs for a given board are defined in the board keyword file. NAI values are used as interface identifier values inside ISDN Q.931 messages sent across the network. When you initialize an ISDN protocol stack instance for a context (using isdnStartProtocol), you specify the NAI of the trunk to associate with the context. From then on, the application communicates 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.

In most configurations, NAIs are unique for each trunk, so the NAI value can be used to refer to a specific trunk on a particular board.

Some variants support duplicate NAI values, where NAIs are not unique across NFAS groups or the board. For these configurations, the application must provide both the NAI and NFAS group number to refer to a trunk when calling isdnStartProtocol.

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

The following table shows what each board type supports:

Digital trunk interface board type | Number of D channels | NAIs | Number of NFAS groups
--- | --- | --- | ---
Four trunk boards | Up to 4 | 0 through 3 | Up to 4
Two trunk boards | Up to 2 | 0 through 1 | Up to 2

The NAI and NFAS group number of a trunk are specified in the board keyword file. For more information, see the Dialogic® NaturalAccess™ ISDN Software Installation Manual.

## Initializing an ISDN Software protocol stack instance

To initialize an ISDN Software or DPNSS protocol stack instance on a context, use one of the following methods:

- Run the ISDN daemon (isdncta).

- Invoke isdnStartProtocol.

### Initializing a stack instance using the ISDN Software daemon

To initialize an ISDN protocol stack instance, run the isdncta daemon supplied with ISDN Software. This daemon starts the ISDN protocol stack, and also makes the switch connections needed to support ISDN Software. When an ISDN protocol stack instance is initialized with the daemon, applications that use the NCC API will operate with the ISDN TCP in the same way they would operate with any other TCP.

The daemon initializes an ISDN protocol stack instance by calling isdnStartProtocol. On the command line, indicate the NAI to use and, if multiple CCID is configured, the NFAS group number for this NAI. To learn how to launch isdncta, see isdncta (ISDN daemon).

### Initializing a stack instance using isdnStartProtocol

To initialize an ISDN protocol stack instance from within your application, call isdnStartProtocol.

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

To direct isdnStartProtocol to initialize a stack instance in channelized stack mode, set the protocol, partner_equip, and parms arguments as described in the following table. For DPNSS, refer to isdnStartProtocol in the Dialogic® NaturalAccess™ ISDN Messaging API Developer's Manual.

Argument | Set to...
--- | ---
protocol | ISDN_PROTOCOL_CHANNELIZED
partner_equip | The type of equipment connected to the board.
Set the value to... | If the board is...
EQUIPMENT_NT | Connected to network equipment.
EQUIPMENT_TE | Acting as network equipment.
parms | Pointer to a parameter structure to configure the stack. If the application needs to change any of the parameters for Natural Call Control, it should pass the structure name ISDN_PROTOCOL_PARMS_CHANNELIZED in this call. This structure is identical to the ISDN_PROTOCOL_PARMS_ Q931CC structure. The behavior bits that govern the stack's automatic responses (such as CC_SEND_CALL_PROC_RQ) must not be modified in channelized configuration. The only exceptions to this rule are the behavior bits governing Overlapped sending and receiving. Refer to the Dialogic® NaturalAccess™ ISDN Messaging API Developer's Manual for more information on ISDN Software parameters. If the application will not change parameters, pass NULL to accept the default settings. The default parameters for the channelized stack mode enable the required service access points (SAPIs).
n | Where n is an unsigned integer representing the NFAS group number, used for duplicate NAI values only. Note: Multiple CCID must be enabled by setting enable_Multiple_CCID to 1 in parms.

Three other structure members in the ISDN_PROTOCOL_PARMS_CHANNELIZED structure are important when calling isdnStartProtocol to initialize the ISDN stack:

Structure member | Action
--- | ---
NS_EXPLICIT_INTERFACE_ID | Forces the interface identifier value to be sent in output call control messages (SETUP, PROCEEDING, and others). Applies to the USA variants.
NS_SEND_USER_CONNECT_ACK | Forces a CONNECT_ACK message to be sent by the TE side upon receipt of a CONNECT message. Applies to the ETSI and Europe variants.
NS_PRESERVE_EXT_BIT_IN_CHAN_ID | Applicable when the variant is DMS, USA, or incoming call. If set, the channel ID's octet 3.3's extension bit is set to the value received in a SETUP message inside the PROCEEDING or ALERT messages.

For information about behavior bits and isdnStartProtocol, see the Dialogic® NaturalAccess™ ISDN Messaging API Developer's Manual.

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