# NCC API state machines

The NCC API call control model differentiates between line states and call states. This topic describes NCC API line state and call state machines.

## Line states

The following table lists the line states. Associated with each state are one or more transitional events, which indicate transition into the state. These are noted in the table.

An application can use nccGetLineStatus to determine the state of a line.

Line state | Description
--- | ---
Active | Entered through the NCCEVN_SEIZURE_DETECTED event, when a call is coming in. Also can be entered through the NCCEVN_CALL_RETRIEVED event, which means a call has become active and that the line has reentered the active line state.
Blocking | Entered through the NCCEVN_CALLS_BLOCKED event, solicited by nccBlockCalls.
Idle | Entered through the NCCEVN_START_PROTOCOL_DONE event, which is solicited by nccStartProtocol. Entered through the NCCEVN_CALLS_UNBLOCKED event, which is solicited by nccUnblockCalls. Entered through the NCCEVN_LINE_IN_SERVICE event (an unsolicited event). Entered from the active state, through a NCCEVN_CALL_HELD or NCCEVN_CALL_DISCONNECTED event. These events mean that a call has been placed on hold or is disconnected, and is therefore not active. When no calls are active on a line, the line enters the idle line state.
Out of service | Entered through the NCCEVN_LINE_OUT_OF_SERVICE event, which is an unsolicited event.
Uninitialized | Initial state of line. When the NCC API is opened on a context, the line handle (signified by the NaturalAccess handle) is created in an uninitialized state. Entered through the NCCEVN_STOP_PROTOCOL_DONE event, which is solicited by nccStopProtocol.

The following illustration shows the NCC line states and events indicating transitions between them:

## Call states

The following table lists the call states. Associated with each state are one or more transitional events, which indicate transition into the state. These are noted in the table.

The application can use nccGetCallStatus to determine the state of a call.

State | Description
--- | ---
Accepting (optional) | Entered through the NCCEVN_ACCEPTING_CALL event in response to invocation of nccAcceptCall. The NCC_CAP_ACCEPT_CALL indicator in the capabilitymask returned by nccQueryCapability indicates if the protocol supports this state.
Answering | Entered through the NCCEVN_ANSWERING_CALL event in response to invocation of nccAnswerCall.
Connected | Entered through an unsolicited NCCEVN_CALL_CONNECTED event after a call was successfully answered by the remote party, or the NCCEVN_CALL_CONNECTED call control connectmask conditions have occurred on an outbound call. For example, connect on proceeding.
Disconnected | Entered from any state through an unsolicited NCCEVN_CALL_DISCONNECTED event. Entered through a solicited NCCEVN_CALL_DISCONNECTED event, following the invocation of nccDisconnectCall. The NCC_CAP_DISCONNECT_IN_ ANY_STATE indicator in the capabilitymask returned by nccQueryCapability indicates in which call states the application can initiate a disconnect.
Incoming | Entered through the NCCEVN_INCOMING_CALL event.
Outbound initiated | Entered by attempting to place a call using nccPlaceCall. Transition into this state is not indicated by any event.
Placing | Entered through NCCEVN_PLACING_CALL event in response to invocation of nccPlaceCall.
Proceeding | An NCCEVN_CALL_PROCEEDING event indicates that the call has entered this state.
Receiving digits (optional) | Entered through an unsolicited NCCEVN_RECEIVED_DIGIT event. This event is generated only if the NCC.START.overlappedreceiving parameter is set. See the Natural Call Control Service Developer's Reference Manual for more information. The OVERLAPPED_RECEIVING bit in the capabilitymask returned by nccQueryCapability indicates if the protocol supports this state.
Rejecting | Entered through NCCEVN_REJECTING_CALL event in response to invocation of nccRejectCall, or as a result of not responding in time to an NCCEVN_INCOMING_CALL.
Seizure | Entered through an unsolicited NCCEVN_SEIZURE_DETECTED event.

Some call states are optional. A call only enters an optional call state, and the event indicating the transition is generated only if the proper parameter enabling or disabling the event is set. For more information about parameters, see the Natural Call Control Service Developer's Reference Manual.

The following illustration shows the inbound and outbound NCC call states and events indicating transitions between them: