Updated on 2025-07-28 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
/**
* Create 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

Definition

Meeting media type.

CONF_AUDIO(0, "Voice meeting")

CONF_VIDEO(1, "Video meeting")

Constraints

N/A

Default Value

CONF_AUDIO

isGuestJoinConfWithoutPwd

No

boolean

Definition

Whether guests can join the meeting without a password.

Constraints

N/A

Default Value

false

confAllowJoinUser

No

JoinConfPermissionType

Definition

Types of users allowed to join the meeting.

PERMIT_EVERYONE(0, "Everyone")

PERMIT_ENTERPRISE_USER(2, "Corporate users only")

PERMIT_INVITED_USER(3, "Invited users only")

Constraints

N/A

Default Value

PERMIT_EVERYONE

isSpeakerOff

No

boolean

Definition

Whether to disable the speakers and switch to earpieces.

Constraints

N/A

Default Value

false

Table 3 CallerInfo description

Parameter

Mandatory

Type

Description

nickName

Yes

String

Definition

Caller name.

Constraints

N/A

Range

0 to 256 characters.

Default Value

N/A

orgId

No

String

Definition

Enterprise ID.

Constraints

N/A

Default Value

N/A

Table 4 CalleeInfo description

Parameter

Mandatory

Type

Description

nickName

Yes

String

Definition

Name of the called participant.

Constraints

N/A

Range

0 to 256 characters.

Default Value

N/A

number

No

String

Definition

Called number.

Constraints

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.

Default Value

N/A

thirdUserId

No

String

Definition

Third-party user ID.

Constraints

For app ID authentication. Either this parameter or number must be set.

Default Value

N/A

orgId

No

String

Definition

Enterprise ID.

Constraints

N/A

Default Value

N/A

hwmP2PAttendeeType

No

HwmP2PAttendeeType

Definition

Called participant type.

ATTENDEE_TYPE_NORMAL(0, "Client")

ATTENDEE_TYPE_MOBILE(5, "Mobile number")

Constraints

N/A

Default Value

HWM_ATTENDEE_TYPE_NORMAL

Table 5 HwmP2PAttendeeType description

Enumerated Value

Description

ATTENDEE_TYPE_NORMAL

Client.

ATTENDEE_TYPE_MOBILE

Mobile number.

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();
        }
    });
}