# CDI service and Natural Access

This topic describes:

- Natural Access services

- Contexts and event queues

- Natural Access programming model

- Managing parameters in Natural Access

Natural Access is a development environment that provides standard programming interfaces for hardware independent telephony functions. You must have Natural Access installed on your system to build applications using the CDI service. This topic provides background information about Natural Access and describes how the CDI service fits into the Natural Access environment. For detailed information about Natural Access, refer to the Natural Access Developer's Reference Manual.

## Natural Access services

A Natural Access service is a group of logically related telephony functions. The CDI service is a Natural Access device service that provides station call control-related functions for CX products (refer to the following illustration). Other services address other aspects of a telephony application.

Natural Access and the CDI service

## Contexts and event queues

Natural Access organizes services and accompanying resources around a single processing context. A context usually represents an application instance controlling a single telephone call.

Natural Access provides multi-processing support. Multiple Natural Access application processes can perform tasks on behalf of the same context. This is called context sharing. Natural Access applications can transfer control of contexts, such as contexts associated with individual telephone calls, to other Natural Access applications. This is called context hand-off.

An event queue is the communication path from a Natural Access service to an application. The Natural Access service generates events indicating certain conditions or state changes and sends them to applications through the event queue.

## Natural Access programming model

Natural Access employs an asynchronous programming model to take advantage of concurrent processing. When called, most functions return immediately, indicating the operation was initiated. The application can then call other functions while Natural Access is processing the command.

Natural Access functions can be synchronous or asynchronous.

- Synchronous functions indicate completion by sending a return value. The return value is either SUCCESS or an error code.

- Asynchronous functions return SUCCESS if the function was successfully initiated. The execution result arrives later in an event. Asynchronous functions that return a non-zero value were never initiated; therefore, no subsequent events are generated. If an asynchronous function fails after being initiated, Natural Access delivers a DONE event to the application with an error code in the event value field.

Refer to CDI service errors and CDI service events for more information.

## Managing parameters in Natural Access

You can alter the characteristics of Natural Access services by modifying associated parameters. Most CDI service parameter structures have default values that are sufficient for most configurations.

Natural Access manages parameters for services on a context basis. The context maintains a copy of the parameters for all services opened on the context.

Use the following Natural Access functions to obtain or change parameter information:

Function | Description
--- | ---
ctaGetParmByName | Retrieves a single field for a given parameter name.
ctaSetParmByName | Modifies a single field for a given parameter name.
ctaGetParmID | Retrieves the parameter ID for a given parameter descriptor name.
ctaGetParmInfo | Retrieves a parameter field definition.
ctaGetParms | Returns parameter values for a given parameter structure.
ctaRefreshParms | Resets the values of all context parameters on a context to the global defaults.

Refer to the Natural Access Developer's Reference Manual for information about the parameter functions.