# Setting up the Natural Access environment

Before calling functions from the Voice Message library, the application must set up the Natural Access environment by performing the following steps:

1. Initialize the Natural Access application.

2. Create event queues and contexts and attach the contexts to an event queue.

3. Open services on each context.

To set up a second Natural Access application that shares a context with the first application:

1. Initialize the Natural Access application.

2. Create event queues.

3. Attach the application to the existing context.

## Initializing Natural Access

To register services in the call to ctaInitialize, specify the service (VCE) and service manager (VCEMGR). The application can open only the services initialized in the call to ctaInitialize. Service managers are dynamic link libraries (DLL) in Windows and shared libraries in UNIX that are linked to the application.

## Creating event queues and contexts

After initializing Natural Access, create the event queues and the contexts. To create one or more event queues, call ctaCreateQueue and specify the service manager to attach to each queue. When you attach or bind a service manager to an event queue, you make that service manager available to the event queue.

To create a context, call ctaCreateContext and provide the queue handle (ctaqueuehd) returned from ctaCreateQueue. All events for services on the context are received in the specified queue.

ctaCreateContext returns a context handle (ctahd). The application supplies the context handle when running Voice Message service functions. Events communicated back to the application are also associated with the context.

Refer to the Natural Access Developer's Reference Manual for details on the programming models created by the use of contexts and event queues.

## Opening services

To open services on a context, call ctaOpenServices and pass a context handle and a list of service descriptors. The service descriptor specifies the name of the service, the service manager, and any service-specific arguments. The Voice Message service has no service-specific arguments.

## Linking with the Voice Message service

The Voice Message service contains two components, the Voice Message service interface (vceapi) and the Voice Message service implementation (vcemgr). When building a new Natural Access application that uses the Voice Message service, link to vceapi.lib (under UNIX, libvceapi.so). The vcemgr.lib (under UNIX, libvcemgr.so) is dynamically loaded at runtime.

Earlier releases of Natural Access shipped both the interface and implementation components in a single library, the vcemgr library. It is strongly recommended that you modify source files of existing applications to link with vceapi.lib (libvceapi.so).

Refer to the Natural Access Service Writer's Manual for information about service implementation.