# Initializing Natural Access

To begin operations, the application performs the following steps:

Step | Action
1 | Initializes Natural Access services (including the ISDN service) with ctaInitialize.
2 | Creates one or more event queues with ctaCreateQueue. Each function call creates a queue and returns a handle. Make sure at least one queue is attached to the ADI service manager.
3 | Creates one or more contexts with ctaCreateContext. Each call creates a context and returns a context handle.
4 | Opens services (initialized in Step 1) on the contexts using ctaOpenServices.

For more information about initializing Natural Access, see the Natural Access Developer's Reference Manual.

## Specifying B channel contexts

Create a separate context for each B channel your application interacts with. To open contexts under Natural Access, use ctaCreateContext followed by ctaOpenServices. In each call to ctaOpenServices, specify the following values:

Value | For B channel contexts, set to...
stream | The voice stream or streams for the on-board DSPs. These streams are:
Board | DSP resource stream
--- | ---
AG 2000-BRI | MVIP 95: Local stream 0
All other NMS digital trunk interface boards | MVIP 95: Local stream 16
timeslot | A base timeslot in stream.
mode | ADI_VOICE_DUPLEX. This mode allows voice (inband) transmission and reception. Do not use modes involving signaling that are defined in the ADI documentation, since ISDN signaling is not carried in the B channels.

Under Natural Access, these values are included in the ctaOpenServices.

## Specifying D channel contexts

The application must also create a separate context for each D channel with which it will interact. Four-digital trunk boards can each support up to four separate D channels. Two-digital trunk boards can each support up to two separate D channels.

To open D channel contexts under Natural Access, use ctaCreateContext followed by ctaOpenServices. In each call to ctaOpenServices, set stream, timeslot and mode to 0, since no DSP processing resources are needed to control the D channel data stream.

Under Natural Access, these values are included in the ctaOpenServices.