# isdnStopProtocol

Shuts down a previously started ISDN protocol stack instance and releases all on-board resources and buffers used by the protocol stack instance.

#### Prototype

DWORD isdnStopProtocol ( CTAHD ctahd)

Argument | Description
ctahd | Context handle associated with a D channel, returned by ctaCreateContext.

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_CTAHD | The context handle is invalid.
CTAERR_INVALID_STATE | An ISDN protocol stack instance is: Not started on the specified context handle, Started Stopped, or In the process of stopping.

#### Events

Event name | Description
ISDNEVN_STOP_PROTOCOL | The value field of this event contains the completion status of the protocol stopping operation. If the instance stopped successfully, the value field contains SUCCESS. Otherwise, an error appears here.

#### Details

This function shuts down a previously started ISDN protocol stack instance and releases all HDLC LAPD or Q.931 ACU resources and buffers associated with the instance.

When the ISDN protocol is stopped, the RESTART procedure is initiated. This RESTART procedure implies sending RESTART messages to the remote end (a single RESTART for the entire trunk or one RESTART for each B channel, depending on the variant) and waiting for RESTART ACKNOWLEDGE.

The ISDN stack waits for each RESTART ACKNOWLEDGE message for 20 seconds before declaring the RESTART procedure failed, clearing its part of the state machine, and continuing the stopping procedure. As a result, if the remote end does not respond (for example, the RESTART procedure is not implemented or the line is down), stopping the protocols may take more than 20 seconds (up to 8 minutes for variants that do not support RESTART messages for the entire interface).

A behavior bit, NS_DISABLE_RESTART, can be used to disable the RESTART procedure in the stack. If this bit is set, the stack does not send RESTART messages when it is stopped, but it also does not respond to incoming RESTART messages. Do not set this bit unless you are certain that the remote end does not implement the RESTART procedure.

#### See also

isdnStartProtocol