Updated on 2024-07-30 GMT+08:00

Joining a Meeting Using a Random Code

JoinConfByRandom

API Description

The meeting link (for example, https://bmeeting.huaweicloud.com/#/j/981924330/e11ddec62ee760734fcf2ba55b79937eac2aa68677caf659) in the notification email contains the meeting ID (981924330) and random code (e11ddec62ee760734fcf2ba55b79937eac2aa68677caf659). A third-party app calls this API to join a meeting.

If you do not specify a guest password when scheduling a meeting, the meeting link contains only the meeting ID but not the random code.

Precautions

  1. This API can be called regardless of whether you have logged in.
  2. This API is an asynchronous API. The return value only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding callback function.

Method Definition

1
HWM_SDK_AGENT_API hwmsdk::HwmErrCode JoinConfByRandom(HwmJoinConfByRandomInfo *joinConfByRandomInfo);

Callback Function

1
virtual void OnJoinConfByRandomResult(hwmsdk::HwmErrCode ret, const char* reason) {};

Parameter Description

Table 1 HwmJoinConfByRandomInfo description

Parameter

Mandatory

Type

Description

confId

Yes

char[]

Meeting ID.

random

No

char[]

Mapping value of a 48-digit meeting password. The value comes from the end of the meeting link in the shared meeting details. If a meeting does not require a guest password, this parameter can be left blank.

name

No

char[]

Display name in the meeting. If you have logged in, this parameter can be left blank. In such a case, the login username is used as the display name in the meeting. To join a meeting anonymously, enter this name or set the site name in advance.

domain

No

char[]

Domain name. This parameter is used when you join the meeting offline.

isCloseSpk

No

bool

Whether to disable the speaker. Enter true to disable the speaker or false to enable it.

Return Values

Table 2 Return values

Type

Description

HwmErrCode

If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
// Join a meeting using the meeting ID and random code.
int demoJoinConfByRandomDlg::clickJoinConfByRandom()
{
    // Enter the meeting ID and password mapping value. If you join the meeting using the random code, you can configure the display name.
    hwmsdkagent::HwmJoinConfByRandomInfo data;
    memset(&data, 0, sizeof(hwmsdkagent::HwmJoinConfByRandomInfo));
 
    strncpy_s(data.confId, GetMeetingID().c_str(), HWM_MAX_CONF_ID_LEN);
    strncpy_s(data.random, GetAccessCode().c_str(), HWM_MAX_RANDOM_LEN);
    strncpy_s(data.name, GetParticipantName().c_str(), HWM_MAX_DISPLAY_NAME_LEN);
    data.isCloseSpk = false;
    
    // Enable or disable the microphone and camera.
    int ret = EnableFeature(hwmsdkagent::HWM_ENABLE_FEATURE_TYPE_MIC_SWITCH, true);
    ret = EnableFeature(hwmsdkagent::HWM_ENABLE_FEATURE_TYPE_CAM_SWITCH, false);
    ret = hwmsdkagent::JoinConfByRandom(&data);
    return ret;
}

Before joining a meeting, you can call EnableFeature to change the microphone and camera status.