Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Query group call room

Retrieve the active calling room associated with a group ID.

Copy

Query whether a specific group has an ongoing audio or video call session:

Code example

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

const request: SignalingGetRoomByGroupIDReq = { groupID: groupID };
const response: SignalingGetRoomByGroupIDResp = await sdk.signalingGetRoomByGroupID(request);
if (response.roomID.length > 0) {
  restoreGroupCall(response.roomID, response.invitation, response.participants);
}

Parameters

ParameterTypeRequiredDescription
groupIDstringYesTarget group identifier.

Return value

Returns a Promise that resolves to a SignalingGetRoomByGroupIDResp object:

PropertyTypeDescription
roomIDstringRoom identifier. An empty string indicates no call is currently active in this group.
invitationSignalingInvitationInfoComplete call invitation object for the active session.
participantsSignalingParticipantMetaData[]List of participants currently present in the room.

State changes after the call

An empty roomID confirms that there is no active call in the specified group. When a non-empty roomID is returned, call Get call room credentials to obtain the credentials required to join the RTC channel. If the query rejects due to network failure, do not treat the error as an empty room state; retry when the network is restored.