Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Cancel call

Cancel an unanswered call invitation by the calling initiator.

Copy

Use signalingCancel() to cancel an outgoing call invitation before the callee answers:

Code example

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

const request: SignalingCancelReq = {
  invitation: invitation,
  offlinePush: offlinePush,
  participant: participant,
  userID: peerUserID,
};
await sdk.signalingCancel(request);

Parameters

ParameterTypeRequiredDescription
invitationSignalingInvitationInfoYesThe complete invitation object originally sent by the caller.
offlinePushOfflinePushInfoYesPush notification payload delivered to offline devices.
participantSignalingParticipantMetaDataYesUser metadata of the caller.
userIDstringYesUser ID of the invitee receiving the cancellation signal.

Return value

Returns a Promise that resolves to void upon cancellation delivery.

State changes after the call

Once the Promise resolves, terminate the outgoing ringing view identified by roomID and release calling media resources. The callee receives an invitation cancelled event and dismisses their incoming call screen. For active calls that are already connected, use Hang up call instead. To handle remote cancellation notifications, see Handle call events.