Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Hang up call

Terminate an active audio or video call session.

Copy

End an active call session by sending a hangup signal to the remote participant:

Code example

import sdk, { SignalingHungUpReq } from '@openimsdk/imsdk';

const request: SignalingHungUpReq = {
  invitation: invitation,
  offlinePush: offlinePush,
  userID: peerUserID,
};
await sdk.signalingHungUp(request);

Parameters

ParameterTypeRequiredDescription
invitationSignalingInvitationInfoYesComplete call invitation object representing the current active room.
offlinePushOfflinePushInfoYesPush notification configuration for offline participants.
userIDstringYesUser ID of the participant receiving the hangup signal.

Return value

Returns a Promise that resolves to void when the hangup signal is sent.

State changes after the call

The roomID inside invitation must match the active media session. Once the Promise resolves, terminate the local call session identified by roomID, stop camera/microphone capture, depart the RTC room, and release media hardware. Remote peers receive a hangup event and exit their media channels. We recommend implementing an idempotent cleanup helper shared across cancel, reject, timeout, and hangup flows. For peer event listeners, see Handle call events.