# Initializing the application

An ISDN Software application performs the following initialization tasks for each trunk or NFAS group:

1. Make switch connections

2. Initialize NaturalAccess and create contexts

3. Initialize an ISDN or DPNSS protocol stack instance

4. Start a TCP on each B channel context

## Make switch connections

If necessary, the application makes switch connections to route D channel data to the HDLC controller, and to route B channel information to DSP resources. Certain default connections are automatically made if switching is not enabled. The following illustration shows routing channel data to on-board resources:

For more information, see Making switch connections for ISDN Software.

## Initialize NaturalAccess and create contexts

The application initializes NaturalAccess, and creates a separate context for each B channel on the trunk or NFAS group that it will interact with. For more information, see Initializing NaturalAccess.

The application must also create a separate dummy context for the D channel. This context is used only to refer to the stack instance on the channel with other ISDN Software library functions (such as isdnStopProtocol). Signaling from a D channel is not accessed through this context; instead, the channelizer in the protocol stack routes the signaling for each B channel to the context for that B channel.

The following illustration shows creating contexts for channels:

## Initialize an ISDN or DPNSS protocol stack instance

The application initializes an ISDN or DPNSS protocol stack instance on the D channel context using isdnStartProtocol. This function starts up an ISDN protocol stack instance on the dummy context in channelized stack mode. In the function invocation, the trunk is specified using its network access identifier (NAI) and NFAS group number (for duplicate NAI values).

The following illustration shows calling isdnStartProtocol:

For more information, see Setting up D channels and ISDN TCP parameters overview.

## Start a TCP on each B channel context

The application starts a TCP on each B channel context, loading country-specific parameters for each context (if necessary). The following illustration shows starting TCPs on B channel contexts:

For more information, see Starting ISDN TCP instances.