hang upΒΆ

class UASCallChannel
hang_up()

Hang up a call.

This function causes a currently connected call (a call that is not IDLE) to be released. It is safe to call this function on a channel that is already IDLE.

The NORMAL clearing cause will be used. This function will block until the call is actually cleared and the call state has returned to IDLE, or a timeout has been reached. The timeout for this function is 60 seconds.

Note that an inbound call might take quite a while to clear, as it is only actually fully released when the caller hangs up (or the network times out waiting for the caller to do so). Accordingly, if this function times out, the call channel will still not be available for another call until after the call state has returned to IDLE. The application can wait for this by calling the wait_for_idle function.

This function will return the current call state.

Usage example:

# hang-up the call
if channel.hang_up() != channel.State.IDLE:
    # wait for channel to go to idle
    channel.wait_for_idle()