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
| Parameter | Type | Required | Description |
|---|---|---|---|
callId | string | Yes | Unique 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 Type | Error Code | Description |
|---|---|---|
CS_ERROR | Various CS error codes | Backend error returned when attempting to delete the emergency call session |
NETWORK_ERROR | internal:error:serviceNotAvailable | Network-level errors including connection failures, timeouts (HTTP 503 service unavailable), or HTTP 500+ server errors |
INTERNAL_ERROR | voice:error:no_call_found | No emergency call found with the specified call ID |
INTERNAL_ERROR | internal:error:parsing_exception | Failed to parse the response from the server |
INTERNAL_ERROR | internal:error:unsanitized_input_error | Request contains unsanitized input and was rejected |
UNKNOWN_ERROR | N/A | Unexpected 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
Related Actions
emergencyCall- Initiate an emergency callreconnectEmergencyCall- Reconnect a disconnected emergency call