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

Starting an Instant Meeting

startP2PConf

HWMSdk.getOpenApi(getActivity().getApplication()).startP2PConf(StartP2PConfParam createConfParam, HwmCancelableCallBack<ConfInfo> callback);

API Description

This API is used to start an instant meeting.

Precautions

This API is used only when your enterprise enables the new P2P function.

Method Definition

1
2
3
4
5
6
7
/**
* Creates an instant meeting.
*
* @param createConfParam Indicates parameter settings for creating an instant meeting.
* @param callback        Indicates the result callback.
*/
void startP2PConf(StartP2PConfParam createConfParam, HwmCancelableCallBack<ConfInfo> callback);

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Type

Description

createConfParam

Yes

StartP2PConfParam

Parameters for creating an instant meeting.

callback

Yes

HwmCancelableCallBack

Callback for the result of creating the instant meeting.

Return Values

None

Parameter Extension

Table 2 StartP2PConfParam description

Parameter

Mandatory

Type

Description

callerInfo

Yes

CallerInfo

Caller information.

calleeInfo

Yes

CalleeInfo

Called participant information.

meetingType

Yes

MeetingType

Meeting type.

Table 3 CallerInfo description

Parameter

Mandatory

Type

Description

nickName

Yes

String

Caller name.

Table 4 CalleeInfo description

Parameter

Mandatory

Type

Description

nickName

Yes

String

Called participant name.

number

No

String

Called number. If this parameter is set to the SIP number (for example, +99111244216210249) allocated to the account, the Huawei Cloud Meeting app is called. If this parameter is set to a PSTN number (for example, 18700000000), the number is called through the VoIP gateway if the enterprise has enabled PSTN call. This parameter is used for account and password authentication. Either this parameter or thirdUserId must be set.

thirdUserId

No

String

Third-party user ID. This parameter is used for app ID authentication. Either this parameter or number must be set.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
private void startP2PConf() {
    showLoading();
    boolean isVideo = !audioBtn.isChecked();
    StartP2PConfParam startP2PConfParam = new StartP2PConfParam();
    startP2PConfParam.setCallerInfo(genP2PConfCaller());
    startP2PConfParam.setCalleeInfo(genP2PConfCallee());
    startP2PConfParam.setMeetingType(isVideo ? MeetingType.CONF_VIDEO : MeetingType.CONF_AUDIO);
    HWMSdk.getOpenApi(getActivity().getApplication()).startP2PConf(startP2PConfParam, new HwmCancelableCallBack<ConfInfo>() {
        @Override
        public void onSuccess(ConfInfo confInfo) {
            Log.i(TAG, "startP2PConf success");
            doDismissDialogAndFragment();
        }

        @Override
        public void onFailed(int retCode, String desc) {
            HCLog.i(TAG, "startP2PConf onFailed" + retCode + " " + desc);
            dismissLoading();
            DemoUtil.showToast("Failed to start an instant meeting: " + retCode + ", desc: " + desc);
        }

        @Override
        public void onCancel() {
            HCLog.i(TAG, "startP2PConf onCancel");
            dismissLoading();
        }
    });
}