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

Starting an Instant Meeting

startP2PConf

API Description

This API is used to start an instant meeting.

Precautions

1. The actual service processing result can be obtained by calling the corresponding callback API.

Method Definition

- (void)startP2PConf:(HWMStartP2PConfParam *)param callback:(_Nonnull HWMSDKCreateConfCompleteHandler)callback;

Parameter Description

Parameter

Mandatory

Type

Description

param

Yes

HWMStartP2PConfParam *

Instant meeting details.

Table 1 HWMStartP2PConfParam description

Parameter

Mandatory

Type

Description

calleeInfo

Yes

HWMCalleeInfo *

Called participant information.

callerInfo

Yes

HWMCallerInfo *

Caller information.

mediaType

Yes

HWMMediaType

Media type.

Table 2 HWMCallerInfo description

Parameter

Mandatory

Type

Description

nickName

No

NSString *

Caller name.

Table 3 HWMCalleeInfo description

Parameter

Mandatory

Type

Description

nickName

No

NSString *

Called participant name.

number

Yes

NSString *

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

Yes

NSString *

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

Return Values

None

Sample Code

- (void)startP2PConf {
    // Set the information about the called participant.
    HWMCalleeInfo *calleeInfo = [[HWMCalleeInfo alloc] init];
    calleeInfo.nickName = @"Called participant name";
    calleeInfo.number = @"123456";
    calleeInfo.thirdUserId = @"123456";
    
    // Set the caller information.
    HWMCallerInfo *callerInfo = [[HWMCallerInfo alloc] init];
    callerInfo.nickName = @"Caller name";
    
    HWMStartP2PConfParam *param = [[HWMStartP2PConfParam alloc] init];
    // Set the media type.
    param.mediaType = HWMMediaTypeVideo;
    param.calleeInfo = calleeInfo;
    param.callerInfo = callerInfo;
    // Call the SDK API.
    [[HWMSdk getOpenApi] startP2PConf:param callback:^(NSError * _Nullable error, HWMCreateConfResult * _Nullable result) {
        if (error) {
            [UIUtil showMessageWithError:error];
        } else {
            [UIUtil showMessage:[NSString stringWithFormat:@"Meeting ID:%@, isP2PConf:%@", result.confId, result.isP2PConf?@"YES":@"NO"]];
        }
    }];
}