# Disconnecting calls

When a call is torn down, the application can process it in one of two ways:

- Disconnect the call

- Release the call

## Disconnecting a call

When a call is disconnected, a connection no longer exists between the local party and the remote party, but the call remains in the disconnected call state.

You can disconnect a call in any of the following ways:

- The application invokes nccDisconnectCall.

If the NCC_CAP_DISCONNECT_IN_ANY_STATE indicator is set in the capabilitymask returned by nccQueryCapability, the application can invoke this function in any call state. Otherwise, the function can be invoked from the outbound initiated, placing, and connected call states only.

- The remote party hangs up. This can occur in almost any call state.

- The call is inbound, and the application rejects the call.

- (ADIMGR NCC implementation only) The call is outbound, the remote party answers, and the call fails to meet the criteria specified by the NCC_X_ADI_PLACECALL_PARMS connectmask passed with nccPlaceCall, or meets the criteria specified by the disconnectmask.

- A call is successfully transferred using nccTransferCall or nccAutomaticTransfer. For more information, refer to Transferring calls.

After the call is disconnected, the NCC API generates NCCEVN_CALL_DISCONNECTED. The call is now in the disconnected state. It is no longer active.

In this state, no connection exists between the local party and remote party. However, the call still exists logically; for example, the application can still invoke nccGetCallStatus to get information about the call or send protocol-specific call messages with nccSendCallMessage. With some protocols, the call can still be placed on hold. The application can invoke nccQueryCapability to determine if the protocol supports this feature.

## Releasing call resources

Once a call is in the disconnected state, the application can invoke nccReleaseCall to release resources associated with the call, and destroy the call handle. The call no longer exists in any state.

When the call is released, NCCEVN_CALL_RELEASED is passed to the application. All internal resources allocated to the call are released. After the application receives this event, no more DSP-related events are generated for this call handle. The application can no longer retrieve call status information using nccGetCallStatus or nccGetExtendedCallStatus.

An outbound call can also be released if a glare (call collision) situation is detected while the call is in outbound initiated call state. In this case, the event value field contains NCC_RELEASED_GLARE.

If no other calls exist on the line after a call is released, the line state falls back to idle.