# Initializing NaturalAccess

To begin call control operations, the application performs the following tasks:

Task | Description
1 | Initializes NaturalAccess services (including the ISDN Software) using ctaInitialize.
2 | Creates one or more event queues, using ctaCreateQueue. Each function call creates a queue and returns a handle. Make sure at least one queue is attached to the ADI API manager.
3 | Creates one or more contexts using ctaCreateContext. Each call creates a context and returns a context handle.
4 | Opens services on the contexts using ctaOpenServices.

Note: If D channel backup is defined in your 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.

For more information about initializing NaturalAccess, see the Dialogic® NaturalAccess™ Software Developer’s Manual.

## Specifying B channel contexts

Create a separate context for each B channel on each trunk or NFAS group your application will interact with. To open contexts under NaturalAccess, use ctaCreateContext followed by ctaOpenServices. In each call to ctaOpenServices, specify stream, timeslot, and mode.

### stream

For B channel contexts, set stream to the voice streams for the on-board DSPs. These streams are:

Board | DSP resource stream
--- | ---
AG 2000-BRI | MVIP 95: Local stream 0
All other digital trunk interface boards | MVIP 95: Local stream 16

### timeslot

For B channel contexts, set to a base timeslot in stream.

### mode

For B channel contexts, set mode to ADI_VOICE_DUPLEX. This mode allows voice (inband) transmission and reception. Because ISDN signaling is not carried in the B channels, do not use the modes involving signaling defined in the ADI documentation.

Set these values in the CTA_MVIP_ADDR structure passed to ctaOpenServices.

## Specifying dummy D channel contexts

Create a separate dummy context for each D channel on each trunk or NFAS group the application will interact with. The context for a D channel is used only to refer to the stack instance on the channel in other ISDN Software library function calls (such as isdnStopProtocol). Signaling from a D channel is not accessed through the dummy context. The channelizer in the protocol stack routes the signaling for each B channel to the context for that B channel.

The following table shows how the number of trunks on a board is related to the number of D channels available.

Boards with... | Can support up to...
--- | ---
Four trunks | Four separate D channels.
Two trunks | Two separate D channels.

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

Set these values in the CTA_MVIP_ADDR structure passed to ctaOpenServices.