Skip to content

Hang Up Emergency Call ​

Terminates an active emergency call. This method gracefully ends the voice connection by disabling the media stream and deleting the emergency call session from the server.

Signature ​

// Callback version
fun hangUpEmergencyCall(
  callId: EmergencyCallId,
  callback: (Exception?) -> Unit
)

// Suspend version
suspend fun hangUpEmergencyCall(
  callId: EmergencyCallId
)

Parameters ​

ParameterTypeRequiredDescription
callIdstringYesUnique identifier of the emergency call to end

Return Type ​

Returns void (or Promise<void> for JavaScript/TypeScript). The method completes successfully when the call is terminated, or throws an error if the operation fails.

Usage Example ​

// Callback

client.hangupEmergencyCall("callId") { err ->
    err?.let {
        // Handle Error in hanging up emergency call
        println("Error in hanging up emergency call: $err")
    } ?: run {
        println("Emergency call hung up successfully")
    }
}

// Coroutine
try {
    client.hangupEmergencyCall("callId")
    println("Emergency call hung up successfully")
} catch (e: Exception) {
    // Handle Error in hanging up emergency call
}

Errors ​

Error TypeError CodeDescription
CS_ERRORVarious CS error codesBackend error returned when attempting to delete the emergency call session
NETWORK_ERRORinternal:error:serviceNotAvailableNetwork-level errors including connection failures, timeouts (HTTP 503 service unavailable), or HTTP 500+ server errors
INTERNAL_ERRORvoice:error:no_call_foundNo emergency call found with the specified call ID
INTERNAL_ERRORinternal:error:parsing_exceptionFailed to parse the response from the server
INTERNAL_ERRORinternal:error:unsanitized_input_errorRequest contains unsanitized input and was rejected
UNKNOWN_ERRORN/AUnexpected error that should be reported to support

For complete error reference and handling guidelines, see Error Reference.

Notes ​

  • The method first disables the media stream before deleting the call session
  • If both media disable and call deletion fail, the deletion error is returned
  • The call is marked as locally hung up to prevent unexpected disconnect notifications
  • After successful hangup, the call will be cleaned up from the local state

Built with VitePress.