Updated on 2023-03-23 GMT+08:00

Joining a Meeting Randomly

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 parameters

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 information. 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, you must enter this name or set the site name in advance.

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
19
20
21
22
// 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.
    string meetingID = CTools::UNICODE2UTF(CString("988148352"));
    string accessCode = CTools::UNICODE2UTF(CString("c4f92bc34e685bbba6c23589741be0431997f30da5d6e47b"));
    string participantName = CTools::UNICODE2UTF(CString("Hangzhou site"));
 
    hwmsdkagent::HwmJoinConfByRandomInfo data;
    memset(&data, 0, sizeof(hwmsdkagent::HwmJoinConfByRandomInfo));
 
    strncpy_s(data.confId, meetingID.c_str(), HWM_MAX_CONF_ID_LEN);
    strncpy_s(data.random, accessCode.c_str(), HWM_MAX_RANDOM_LEN);
    strncpy_s(data.name, participantName.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.