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

Initiating a Call

Function

This API is used to initiate a call by calling a number or a third-party account. Call this API only after login.

Function Prototype

startCall(startCallInfo: StartCallInfo, onStartCallResult?: (ret: SDKERR, reason: string) => void): voidstartCall(startCallInfo: StartCallInfo, onStartCallResult?: (ret: SDKERR, reason: string) => void): void

Request Parameters

Table 1 Input parameter description
Parameter Mandatory Type Description
startCallInfo Y StartCallInfo Parameters for initiating a call.
onStartCallResult Y (ret: SDKERR, reason: string) => void Callback of initiating the call.
Table 2 StartCallInfo
Parameter Mandatory Type Description
callerInfo Y CallerInfo Caller information.
calleeInfo Y CalleeInfo Called participant information.
mediaType Y MediaType Media type.
Table 3 CallerInfo
Parameter Mandatory Type Description
nickName N string Caller name.
Table 4 CalleeInfo
Parameter Mandatory Type Description
nickName N string Called participant name.
number Y 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 (number is prior to thirdUserId).
thirdUserId Y string Third-party account of the called participant. Either this parameter or number is used. The priority is as follows: number > thirdUserId. This parameter is used for app ID authentication.
Table 5 Enumerated values of MediaType
Enumeration Name Enumerated Value Description
HWM_MEDIA_TYPE_AUDIO 0 Audio.
HWM_MEDIA_TYPE_VIDEO 1 Video.

Return Values

void

Callback Method Parameters

(ret: SDKERR, reason: string) => void

Table 6 Input parameter description
Parameter Type Description
ret For details about SDKERR, see Error Code Reference. Error code.
reason string Error description.