# nccBlockCalls

Blocks incoming calls.

#### Prototype

DWORD nccBlockCalls ( CTAHD linehd, unsigned blockmode,
void *blockparms )

Argument | Description
linehd | Line handle used to open the NCC API instance.
blockmode | Method used to block calls.
blockparms | Pointer to a protocol-specific NaturalAccess call blocking parameter structure. Specify NULL to use default values. See the protocol-specific documentation for details.

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_HANDLE | The NCC API is not open on the specified handle.
CTAERR_INVALID_STATE | The current line state does not allow this function to be called.
CTAERR_SVR_COMM | A server communication error occurred.

#### Events

Event | Description
NCCEVN_BLOCK_FAILED | The request to block calls failed. The event value field contains the reason. For a list of reason codes, see NCCEVN_BLOCK_FAILED.
NCCEVN_CALLS_BLOCKED | The block calls request completed successfully. The line state changed to blocking.

#### Details

nccBlockCalls blocks calls on the specified line handle. nccBlockCalls can be invoked from the active, idle, or out of service line states. However, incoming calls are not blocked until there are no calls on the line and the line has returned to the idle state.

The method used to block calls is specified with the function invocation. Two methods are valid:

Method | Description
--- | ---
NCC_BLOCK_REJECTALL | Do not answer subsequent calls
NCC_BLOCK_OUT_OF_SERVICE | Place the line out of service

When the line state changes to blocking, the application receives NCCEVN_CALLS_BLOCKED. The value returned with this event contains the chosen blocking method. The line remains in the blocking state until nccUnblockCalls is invoked.

The application may receive NCCEVN_INCOMING_CALL after invoking nccBlockCalls and before receiving NCCEVN_CALLS_BLOCKED. The application must accept or answer the incoming call. The application does not receive NCCEVN_CALLS_BLOCKED until it releases all calls.

If the blocking request fails, the application receives NCCEVN_BLOCK_FAILED. The line remains in the current state.

Use nccUnBlockCalls to cancel a blocking request initiated using nccBlockCalls. You can cancel a blocking request any time before NCCEVN_CALLS_BLOCKED is received.