harmony 鸿蒙@ohos.telephony.call (Call)

2022-08-09 浏览 (896)

@ohos.telephony.call (Call)

The call module provides call management functions, including making calls, redirecting to the dial screen, obtaining the call status, and formatting phone numbers.

To subscribe to call status changes, use observer.on('callStateChange').

NOTE

The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import call from '@ohos.telephony.call';

call.dialCall9+

dialCall(phoneNumber: string, callback: AsyncCallback<void>): void

Initiates a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300005Airplane mode is on.
8300006Network not in service.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.dialCall("138xxxxxxxx", (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.dialCall9+

dialCall(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback<void>): void

Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsDialCallOptionsYesCall options, which carry other configuration information of the call.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300005Airplane mode is on.
8300006Network not in service.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let dialCallOptions: call.DialCallOptions = {
    accountId: 0,
    videoState: 0,
    dialScene: 0,
    dialType: 0,
}
call.dialCall("138xxxxxxxx", dialCallOptions, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.dialCall9+

dialCall(phoneNumber: string, options?: DialCallOptions): Promise<void>

Initiates a call. You can set call options as needed. This API uses a promise to return the result.

System API: This is a system API.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsDialCallOptionsNoCall options, which carry other configuration information of the call.
If this field is not set, the following configuration is used by default. For details, see DialCallOptions.
- accountId: 0 (card slot 1)
- videoState: voice call
- dialScene: common call
- dialType: carrier call

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300005Airplane mode is on.
8300006Network not in service.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let dialCallOptions: call.DialCallOptions = {
    accountId: 0,
    videoState: 0,
    dialScene: 0,
    dialType: 0,
}
call.dialCall("138xxxxxxxx", dialCallOptions).then(() => {
    console.log(`dialCall success.`);
}).catch((err: BusinessError) => {
    console.error(`dialCall fail, promise: err->${JSON.stringify(err)}`);
});

call.dial(deprecated)

dial(phoneNumber: string, callback: AsyncCallback<boolean>): void

Initiates a call. This API uses an asynchronous callback to return the result.

NOTE

This API is supported since API version 6 and deprecated since API version 9. You are advised to use dialCall. The substitute API is available only for system applications.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the operation is successful, and the value false indicates the opposite.

Example

import { BusinessError } from '@ohos.base';

call.dial("138xxxxxxxx", (err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.dial(deprecated)

dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean>): void

Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result.

NOTE

This API is supported since API version 6 and deprecated since API version 9. You are advised to use dialCall. The substitute API is available only for system applications.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsDialOptionsYesCall option, which indicates whether the call is a voice call or video call.
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the operation is successful, and the value false indicates the opposite.

Example

import { BusinessError } from '@ohos.base';

let dialOptions: call.DialOptions = {
    extras: false
}
call.dial("138xxxxxxxx", dialOptions, (err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.dial(deprecated)

dial(phoneNumber: string, options?: DialOptions): Promise<boolean>

Initiates a call. You can set call options as needed. This API uses a promise to return the result.

NOTE

This API is supported since API version 6 and deprecated since API version 9. You are advised to use dialCall. The substitute API is available only for system applications.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsDialOptionsNoCall option, which indicates whether the call is a voice call or video call.

Return value

TypeDescription
Promise<boolean>Promise used to return the result. The value true indicates that the operation is successful, and the value false indicates the opposite.

Example

import { BusinessError } from '@ohos.base';

let dialOptions: call.DialOptions = {
    extras: false
}
call.dial("138xxxxxxxx", dialOptions).then((data: boolean) => {
    console.log(`dial success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`dial fail, promise: err->${JSON.stringify(err)}`);
});

call.makeCall7+

makeCall(phoneNumber: string, callback: AsyncCallback<void>): void

Launches the call screen and displays the dialed number. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Applications.Contacts

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.makeCall("138xxxxxxxx", (err: BusinessError) => {
    console.log(`makeCall callback: err->${JSON.stringify(err)}`);
});

call.makeCall7+

makeCall(phoneNumber: string): Promise<void>

Launches the call screen and displays the dialed number. This API uses a promise to return the result.

System capability: SystemCapability.Applications.Contacts

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.makeCall("138xxxxxxxx").then(() => {
    console.log(`makeCall success`);
}).catch((err: BusinessError) => {
    console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`);
});

call.hasCall

hasCall(callback: AsyncCallback<boolean>): void

Checks whether a call is in progress. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that a call is in progress, and the value false indicates the opposite.

Example

import { BusinessError } from '@ohos.base';

call.hasCall((err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.hasCall

hasCall(): Promise<boolean>

Checks whether a call is in progress. This API uses a promise to return the result.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Example

import { BusinessError } from '@ohos.base';

call.hasCall().then(() => {
    console.log(`hasCall success`);
}).catch((err: BusinessError) => {
    console.error(`hasCall fail, promise: err->${JSON.stringify(err)}`);
});

call.hasCallSync10+

hasCallSync(): boolean

Checks whether a call is in progress.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
booleanPromise used to return the result.

Example

let hasCall: boolean = call.hasCallSync();
console.log(`hasCallSync success, has call is ` + hasCall);

call.getCallState

getCallState(callback: AsyncCallback<CallState>): void

Obtains the call status. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<CallState>YesCallback used to return the result.

Example

import { BusinessError } from '@ohos.base';

call.getCallState((err: BusinessError, data: call.CallState) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getCallState

getCallState(): Promise<CallState>

Obtains the call status. This API uses a promise to return the result.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<CallState>Promise used to return the result.

Example

import { BusinessError } from '@ohos.base';

call.getCallState().then((data: call.CallState) => {
    console.log(`getCallState success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getCallState fail, promise: err->${JSON.stringify(err)}`);
});

call.getCallStateSync10+

getCallStateSync(): CallState

Obtains the call status.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
CallStatePromise used to return the result.

Example

let callState: call.CallState = call.getCallStateSync();
console.log(`the call state is:` + callState);

call.hasVoiceCapability7+

hasVoiceCapability(): boolean

Checks whether a device supports voice calls.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
booleanResult indicating whether the device supports voice calls. The value true indicates yes, and the value false indicates no.
let result: boolean = call.hasVoiceCapability();
console.log(`hasVoiceCapability: ${JSON.stringify(result)}`);

call.isEmergencyPhoneNumber7+

isEmergencyPhoneNumber(phoneNumber: string, callback: AsyncCallback<boolean>): void

Checks whether the called number is an emergency number. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the called number is an emergency number, and the value false indicates the opposite.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isEmergencyPhoneNumber("138xxxxxxxx", (err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.isEmergencyPhoneNumber7+

isEmergencyPhoneNumber(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback<boolean>): void

Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsEmergencyNumberOptionsYesEmergency number options.
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the called number is an emergency number, and the value false indicates the opposite.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let options: call.EmergencyNumberOptions = {slotId: 1}
call.isEmergencyPhoneNumber("112", options, (err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.isEmergencyPhoneNumber7+

isEmergencyPhoneNumber(phoneNumber: string, options?: EmergencyNumberOptions): Promise<boolean>

Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsEmergencyNumberOptionsNoEmergency number options.

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let options: call.EmergencyNumberOptions = {slotId: 1}
call.isEmergencyPhoneNumber("138xxxxxxxx", options).then((data: boolean) => {
    console.log(`isEmergencyPhoneNumber success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`isEmergencyPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
});

call.formatPhoneNumber7+

formatPhoneNumber(phoneNumber: string, callback: AsyncCallback<string>): void

Formats a phone number. This API uses an asynchronous callback to return the result.

A formatted phone number is a standard numeric string, for example, 555 0100.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
callbackAsyncCallback<string>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.formatPhoneNumber("138xxxxxxxx", (err: BusinessError, data: string) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.formatPhoneNumber7+

formatPhoneNumber(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback<string>): void

Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result.

A formatted phone number is a standard numeric string, for example, 555 0100.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsNumberFormatOptionsYesNumber formatting options, for example, country code.
callbackAsyncCallback<string>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let options: call.NumberFormatOptions = {
    countryCode: "CN"
}
call.formatPhoneNumber("138xxxxxxxx", options, (err: BusinessError, data: string) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.formatPhoneNumber7+

formatPhoneNumber(phoneNumber: string, options?: NumberFormatOptions): Promise<string>

Formats a phone number based on specified formatting options. This API uses a promise to return the result.

A formatted phone number is a standard numeric string, for example, 555 0100.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
optionsNumberFormatOptionsNoNumber formatting options, for example, country code.

Return value

TypeDescription
Promise<string>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let options: call.NumberFormatOptions = {
    countryCode: "CN"
}
call.formatPhoneNumber("138xxxxxxxx", options).then((data: string) => {
    console.log(`formatPhoneNumber success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`formatPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
});

call.formatPhoneNumberToE1647+

formatPhoneNumberToE164(phoneNumber: string, countryCode: string, callback: AsyncCallback<string>): void

Converts a phone number into the E.164 format. This API uses an asynchronous callback to return the result.

The phone number must match the specified country code. For example, for a China phone number, the country code must be CN. Otherwise, null will be returned.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
countryCodestringYesCountry code, for example, CN (China). All country codes are supported.
callbackAsyncCallback<string>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.formatPhoneNumberToE164("138xxxxxxxx", "CN", (err: BusinessError, data: string) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.formatPhoneNumberToE1647+

formatPhoneNumberToE164(phoneNumber: string, countryCode: string): Promise<string>

Converts a phone number into the E.164 format. This API uses a promise to return the result.

The phone number must match the specified country code. For example, for a China phone number, the country code must be CN. Otherwise, null will be returned.

All country codes are supported.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
phoneNumberstringYesPhone number.
countryCodestringYesCountry code, for example, CN (China). All country codes are supported.

Return value

TypeDescription
Promise<string>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.formatPhoneNumberToE164("138xxxxxxxx", "CN").then((data: string) => {
    console.log(`formatPhoneNumberToE164 success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`formatPhoneNumberToE164 fail, promise: err->${JSON.stringify(err)}`);
});

call.muteRinger8+

muteRinger(callback: AsyncCallback<void>): void

Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.muteRinger((err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.muteRinger8+

muteRinger(): Promise<void>

Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.muteRinger().then(() => {
    console.log(`muteRinger success.`);
}).catch((err: BusinessError) => {
    console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`);
});

call.answerCall9+

answerCall(callId: number, callback: AsyncCallback<void>): void

Answers a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID. You can obtain the value by subscribing to callDetailsChange events.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.answerCall(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.answerCall9+

answerCall(callId?: number): Promise<void>

Answers a call. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberNoCall ID. You can obtain the value by subscribing to callDetailsChange events. This field is optional from API version 9.
If this field is not set, the latest ringing call will be connected.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.answerCall(1).then(() => {
    console.log(`answerCall success.`);
}).catch((err: BusinessError) => {
    console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`);
});

call.answerCall9+

answerCall(callback: AsyncCallback<void>): void

Answers a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.answerCall((err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.hangUpCall9+

hangUpCall(callId: number, callback: AsyncCallback<void>): void

Ends a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID. You can obtain the value by subscribing to callDetailsChange events.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.hangUpCall(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.hangUpCall9+

hangUpCall(callId?: number): Promise<void>

Ends a call. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberNoCall ID. You can obtain the value by subscribing to callDetailsChange events. This field is optional from API version 9.
If this field is not set, the latest ongoing, dialed, or connected call will be ended.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.hangUpCall(1).then(() => {
    console.log(`hangUpCall success.`);
}).catch((err: BusinessError) => {
    console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`);
});

call.hangUpCall9+

hangUpCall(callback: AsyncCallback<void>): void

Ends a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.hangUpCall((err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.rejectCall9+

rejectCall(callId: number, callback: AsyncCallback<void>): void

Rejects a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID. You can obtain the value by subscribing to callDetailsChange events.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.rejectCall(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.rejectCall9+

rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void

Rejects a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID. You can obtain the value by subscribing to callDetailsChange events.
optionsRejectMessageOptionsYesOptions for the call rejection message.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let rejectMessageOptions : call.RejectMessageOptions = {
    messageContent: "Unknown number blocked"
}
call.rejectCall(1, rejectMessageOptions, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.rejectCall9+

rejectCall(callId?: number, options?: RejectMessageOptions): Promise<void>

Rejects a call. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberNoCall ID. You can obtain the value by subscribing to callDetailsChange events. This field is optional from API version 9.
If this field is not set, the latest ringing call will be rejected.
optionsRejectMessageOptionsNoOptions for the call rejection message. If this field is not set, no call rejection message will be sent.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let rejectMessageOptions: call.RejectMessageOptions = {
    messageContent: "Unknown number blocked"
}
call.rejectCall(1, rejectMessageOptions).then(() => {
    console.log(`rejectCall success.`);
}).catch((err: BusinessError) => {
    console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`);
});

call.rejectCall9+

rejectCall(callback: AsyncCallback<void>): void

Rejects a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.rejectCall((err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.rejectCall9+

rejectCall(options: RejectMessageOptions, callback: AsyncCallback<void>): void

Rejects a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
optionsRejectMessageOptionsYesOptions for the call rejection message.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let rejectMessageOptions: call.RejectMessageOptions = {
    messageContent: "Unknown number blocked"
}
call.rejectCall(rejectMessageOptions, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.holdCall7+

holdCall(callId: number, callback: AsyncCallback<void>): void

Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.holdCall(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.holdCall7+

holdCall(callId: number): Promise<void>

Holds a call based on the specified call ID. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.holdCall(1).then(() => {
    console.log(`holdCall success.`);
}).catch((err: BusinessError) => {
    console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`);
});

call.unHoldCall7+

unHoldCall(callId: number, callback: AsyncCallback<void>): void

Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.unHoldCall(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.unHoldCall7+

unHoldCall(callId: number): Promise<void>

Unholds a call based on the specified call ID. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.unHoldCall(1).then(() => {
    console.log(`unHoldCall success.`);
}).catch((err: BusinessError) => {
    console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`);
});

call.switchCall7+

switchCall(callId: number, callback: AsyncCallback<void>): void

Switches a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.switchCall(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.switchCall7+

switchCall(callId: number): Promise<void>

Switches a call. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.ANSWER_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.switchCall(1).then(() => {
    console.log(`switchCall success.`);
}).catch((err: BusinessError) => {
    console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`);
});

call.combineConference7+

combineConference(callId: number, callback: AsyncCallback<void>): void

Combines two calls into a conference call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.combineConference(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.combineConference7+

combineConference(callId: number): Promise<void>

Combines two calls into a conference call. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.combineConference(1).then(() => {
    console.log(`combineConference success.`);
}).catch((err: BusinessError) => {
    console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`);
});

call.kickOutFromConference10+

kickOutFromConference(callId: number, callback: AsyncCallback<void>): void

Removes a specified call from a conference call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.kickOutFromConference(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.kickOutFromConference10+

kickOutFromConference(callId: number): Promise<void>

Removes a specified call from a conference call. This API uses a promise to return the result.

System API: This is a system API.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.kickOutFromConference(1).then(() => {
    console.log(`kickOutFromConference success.`);
}).catch((err: BusinessError) => {
    console.error(`kickOutFromConference fail, promise: err->${JSON.stringify(err)}`);
});

call.getMainCallId7+

getMainCallId(callId: number, callback: AsyncCallback<number>): void

Obtains the main call ID. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<number>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getMainCallId(1, (err: BusinessError, data: number) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getMainCallId7+

getMainCallId(callId: number): Promise<number>

Obtains the main call ID. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<number>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getMainCallId(1).then((data: number) => {
    console.log(`getMainCallId success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getMainCallId fail, promise: err->${JSON.stringify(err)}`);
});

call.getSubCallIdList7+

getSubCallIdList(callId: number, callback: AsyncCallback<Array<string>>): void

Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<Array<string>>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getSubCallIdList(1, (err: BusinessError, data: Array<string>) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getSubCallIdList7+

getSubCallIdList(callId: number): Promise<Array<string>>

Obtains the list of subcall IDs. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<Array<string>>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getSubCallIdList(1).then((data: Array<string>) => {
    console.log(`getSubCallIdList success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getSubCallIdList fail, promise: err->${JSON.stringify(err)}`);
});

call.getCallIdListForConference7+

getCallIdListForConference(callId: number, callback: AsyncCallback<Array<string>>): void

Obtains the list of call IDs in a conference. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<Array<string>>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallIdListForConference(1, (err: BusinessError, data: Array<string>) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getCallIdListForConference7+

getCallIdListForConference(callId: number): Promise<Array<string>>

Obtains the list of call IDs in a conference. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<Array<string>>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallIdListForConference(1).then((data: Array<string>) => {
    console.log(`getCallIdListForConference success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getCallIdListForConference fail, promise: err->${JSON.stringify(err)}`);
});

call.getCallWaitingStatus7+

getCallWaitingStatus(slotId: number, callback: AsyncCallback<CallWaitingStatus>): void

Obtains the call waiting status. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<CallWaitingStatus>YesCallback used to return the result.
The value can be:
- 0: Call waiting is disabled.
- 1: Call waiting is enabled.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallWaitingStatus(0, (err: BusinessError, data: call.CallWaitingStatus) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getCallWaitingStatus7+

getCallWaitingStatus(slotId: number): Promise<CallWaitingStatus>

Obtains the call waiting status. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<CallWaitingStatus>Promise used to return the result.
- 0: Call waiting is disabled.
- 1: Call waiting is enabled.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallWaitingStatus(0).then((data: call.CallWaitingStatus) => {
    console.log(`getCallWaitingStatus success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getCallWaitingStatus fail, promise: err->${JSON.stringify(err)}`);
});

call.setCallWaiting7+

setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback<void>): void

Specifies whether to enable the call waiting service. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
activatebooleanYesWhether to enable call waiting.
- false: Disable call waiting.
- true: Enable call waiting.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.setCallWaiting(0, true, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.setCallWaiting7+

setCallWaiting(slotId: number, activate: boolean): Promise<void>

Specifies whether to enable the call waiting service. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
activatebooleanYesWhether to enable call waiting.
- false: Disable call waiting.
- true: Enable call waiting.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.setCallWaiting(0, true).then(() => {
    console.log(`setCallWaiting success.`);
}).catch((err: BusinessError) => {
    console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`);
});

call.startDTMF7+

startDTMF(callId: number, character: string, callback: AsyncCallback<void>): void

Starts playing DTMF tones. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
characterstringYesDTMF string.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.startDTMF(1, "0", (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.startDTMF7+

startDTMF(callId: number, character: string): Promise<void>

Starts playing DTMF tones. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
characterstringYesDTMF string.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.startDTMF(1, "0").then(() => {
    console.log(`startDTMF success.`);
}).catch((err: BusinessError) => {
    console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`);
});

call.stopDTMF7+

stopDTMF(callId: number, callback: AsyncCallback<void>): void

Stops playing DTMF tones. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.stopDTMF(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.stopDTMF7+

stopDTMF(callId: number): Promise<void>

Stops playing DTMF tones. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.stopDTMF(1).then(() => {
    console.log(`stopDTMF success.`);
}).catch((err: BusinessError) => {
    console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`);
});

call.postDialProceed11+

postDialProceed(callId: number, proceed: boolean, callback: AsyncCallback<void>): void

Continues a call by playing a post-dial DTMF string. This API uses an asynchronous callback to return the result.

If the called number is in the format of "common phone number + semicolon (;) + DTMF string", for example, 400xxxxxxx;123, and the listening for postDialDelay events is enabled, the system reports a postDialDelay event when the call is connected. The application can then call this API to send DTMF tones.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
proceedbooleanYesWhether to send DTMF tones.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.postDialProceed(1, true, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.postDialProceed11+

postDialProceed(callId: number, proceed: boolean): Promise<void>

Continues a call by playing a post-dial DTMF string. This API uses a promise to return the result.

If the called number is in the format of "common phone number + semicolon (;) + DTMF string", for example, 400xxxxxxx;123, and the listening for postDialDelay events is enabled, the system reports a postDialDelay event when the call is connected. The application can then call this API to send DTMF tones.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
proceedbooleanYesWhether to send DTMF tones.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.postDialProceed(1, true).then(() => {
    console.log(`postDialProceed success.`);
}).catch((err: BusinessError) => {
    console.error(`postDialProceed fail, promise: err->${JSON.stringify(err)}`);
});

call.isInEmergencyCall7+

isInEmergencyCall(callback: AsyncCallback<boolean>): void

Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isInEmergencyCall((err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.isInEmergencyCall7+

isInEmergencyCall(): Promise<boolean>

Checks whether a call is an emergency call. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isInEmergencyCall().then((data: boolean) => {
    console.log(`isInEmergencyCall success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`isInEmergencyCall fail, promise: err->${JSON.stringify(err)}`);
});

call.on('callDetailsChange')7+

on(type: 'callDetailsChange', callback: Callback<CallAttributeOptions>): void

Subscribes to callDetailsChange events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesCall event change. This field has a fixed value of callDetailsChange.
callbackCallback<CallAttributeOptions>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.on('callDetailsChange', (data: call.CallAttributeOptions) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.on('callEventChange')8+

on(type: 'callEventChange', callback: Callback<CallEventOptions>): void

Subscribes to callEventChange events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesCall event change. This field has a fixed value of callEventChange.
callbackCallback<CallEventOptions>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.on('callEventChange', (data: call.CallEventOptions) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.on('callDisconnectedCause')8+

on(type: 'callDisconnectedCause', callback: Callback<DisconnectedDetails>): void

Subscribes to callDisconnectedCause events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesCall disconnection cause. This field has a fixed value of callDisconnectedCause.
callbackCallback<DisconnectedDetails>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.on('callDisconnectedCause', (data: call.DisconnectedDetails) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.on('mmiCodeResult')9+

on(type: 'mmiCodeResult', callback: Callback<MmiCodeResults>): void

Subscribes to mmiCodeResult events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesMMI code result. This field has a fixed value of mmiCodeResult.
callbackCallback<MmiCodeResults>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.on('mmiCodeResult', (data: call.MmiCodeResults) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.off('callDetailsChange')7+

off(type: 'callDetailsChange', callback?: Callback<CallAttributeOptions>): void

Unsubscribes from callDetailsChange events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesCall details change. This field has a fixed value of callDetailsChange.
callbackCallback<CallAttributeOptions>NoCallback used to return the result. If this field is not set, no subscription cancellation result will be received.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.off('callDetailsChange', (data: call.CallAttributeOptions) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.off('callEventChange')8+

off(type: 'callEventChange', callback?: Callback<CallEventOptions>): void

Unsubscribes from callEventChange events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesCall event change. This field has a fixed value of callEventChange.
callbackCallback<CallEventOptions>NoCallback used to return the result. If this field is not set, no subscription cancellation result will be received.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.off('callEventChange', (data: call.CallEventOptions) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.off('callDisconnectedCause')8+

off(type: 'callDisconnectedCause', callback?: Callback<DisconnectedDetails>): void

Unsubscribes from callDisconnectedCause events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesCall disconnection cause. This field has a fixed value of callDisconnectedCause.
callbackCallback<DisconnectedDetails>NoCallback used to return the result. If this field is not set, no subscription cancellation result will be received.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.off('callDisconnectedCause', (data: call.DisconnectedDetails) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.off('mmiCodeResult')9+

off(type: 'mmiCodeResult', callback?: Callback<MmiCodeResults>): void

Unsubscribes from mmiCodeResult events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesMMI code result. This field has a fixed value of mmiCodeResult.
callbackCallback<MmiCodeResults>NoCallback used to return the result. If this field is not set, no subscription cancellation result will be received.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.off('mmiCodeResult', (data: call.MmiCodeResults) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.on('audioDeviceChange')10+

on(type: 'audioDeviceChange', callback: Callback<AudioDeviceCallbackInfo>): void

Subscribes to audio device change events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesAudio device change. This field has a fixed value of audioDeviceChange.
callbackCallback<AudioDeviceCallbackInfo>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.on('audioDeviceChange', (data: call.AudioDeviceCallbackInfo) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.off('audioDeviceChange')10+

off(type: 'audioDeviceChange', callback?: Callback<AudioDeviceCallbackInfo>): void

Unsubscribes from audioDeviceChange events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesAudio device change. This field has a fixed value of audioDeviceChange.
callbackCallback<AudioDeviceCallbackInfo>NoCallback used to return the result. If this field is not set, no subscription cancellation result will be received.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.off('audioDeviceChange', (data: call.AudioDeviceCallbackInfo) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.on('postDialDelay')11+

on(type: 'postDialDelay', callback: Callback<string>): void

Subscribes to postDialDelay events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesPost-dial delay. This field has a fixed value of postDialDelay.
callbackCallback<string>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.on('postDialDelay', (data: string) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.off('postDialDelay')11+

off(type: 'postDialDelay', callback?: Callback<string>): void

Unsubscribes from postDialDelay events. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
typestringYesPost-dial delay. This field has a fixed value of postDialDelay.
callbackCallback<string>NoCallback used to return the result. If this field is not set, no subscription cancellation result will be received.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

call.off('postDialDelay', (data: string) => {
    console.log(`callback: data->${JSON.stringify(data)}`);
});

call.isNewCallAllowed8+

isNewCallAllowed(callback: AsyncCallback<boolean>): void

Checks whether a new call is allowed. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isNewCallAllowed((err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.isNewCallAllowed8+

isNewCallAllowed(): Promise<boolean>

Checks whether a new call is allowed. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isNewCallAllowed().then((data: boolean) => {
    console.log(`isNewCallAllowed success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`isNewCallAllowed fail, promise: err->${JSON.stringify(err)}`);
});

call.separateConference8+

separateConference(callId: number, callback: AsyncCallback<void>): void

Separates calls from a conference call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.separateConference(1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.separateConference8+

separateConference(callId: number): Promise<void>

Separates calls from a conference call. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.separateConference(1).then(() => {
    console.log(`separateConference success.`);
}).catch((err: BusinessError) => {
    console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`);
});

call.getCallRestrictionStatus8+

getCallRestrictionStatus(slotId: number, type: CallRestrictionType, callback: AsyncCallback<RestrictionStatus>): void

Obtains the call restriction status. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
typeCallRestrictionTypeYesCall restriction type.
callbackAsyncCallback<RestrictionStatus>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallRestrictionStatus(0, 1, (err: BusinessError, data: call.RestrictionStatus) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getCallRestrictionStatus8+

getCallRestrictionStatus(slotId: number, type: CallRestrictionType): Promise<RestrictionStatus>

Obtains the call restriction status. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
typeCallRestrictionTypeYesCall restriction type.

Return value

TypeDescription
Promise<RestrictionStatus>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallRestrictionStatus(0, 1).then((data: call.RestrictionStatus) => {
    console.log(`getCallRestrictionStatus success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getCallRestrictionStatus fail, promise: err->${JSON.stringify(err)}`);
});

call.setCallRestriction8+

setCallRestriction(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback<void>): void

Sets the call restriction status. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
infoCallRestrictionInfoYesCall restriction information.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

let callRestrictionInfo: call.CallRestrictionInfo = {
    type: call.CallRestrictionType.RESTRICTION_TYPE_ALL_OUTGOING,
    password: "123456",
    mode: call.CallRestrictionMode.RESTRICTION_MODE_ACTIVATION
}
call.setCallRestriction(0, callRestrictionInfo, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.setCallRestriction8+

setCallRestriction(slotId: number, info: CallRestrictionInfo): Promise<void>

Sets the call restriction status. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
infoCallRestrictionInfoYesCall restriction information.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

let callRestrictionInfo: call.CallRestrictionInfo = {
    type: call.CallRestrictionType.RESTRICTION_TYPE_ALL_INCOMING,
    password: "123456",
    mode: call.CallRestrictionMode.RESTRICTION_MODE_ACTIVATION
}
call.setCallRestriction(0, callRestrictionInfo).then(() => {
    console.log(`setCallRestriction success.`);
}).catch((err: BusinessError) => {
    console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`);
});

call.setCallRestrictionPassword10+

setCallRestrictionPassword(slotId: number, oldPassword: string, newPassword: string, callback: AsyncCallback<void>): void

Changes the call barring password. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
oldPasswordstringYesOld password for call barring.
newPasswordstringYesNew password for call barring.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.setCallRestrictionPassword(0, "123456", "654321", (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.setCallRestrictionPassword10+

setCallRestrictionPassword(slotId: number, oldPassword: string, newPassword: string): Promise<void>

Changes the call barring password. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
oldPasswordstringYesOld password for call barring.
newPasswordstringYesNew password for call barring.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.setCallRestrictionPassword(0, "123456", "654321").then(() => {
    console.log(`setCallRestrictionPassword success.`);
}).catch((err: BusinessError) => {
    console.error(`setCallRestrictionPassword fail, promise: err->${JSON.stringify(err)}`);
});

call.getCallTransferInfo8+

getCallTransferInfo(slotId: number, type: CallTransferType, callback: AsyncCallback<CallTransferResult>): void

Obtains call transfer information. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
typeCallTransferTypeYesCall transfer type.
callbackAsyncCallback<CallTransferResult>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY, (err: BusinessError, data: call.CallTransferResult) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getCallTransferInfo8+

getCallTransferInfo(slotId: number, type: CallTransferType): Promise<CallTransferResult>

Obtains call transfer information. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
typeCallTransferTypeYesCall transfer type.

Return value

TypeDescription
Promise<CallTransferResult>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY).then((data: call.CallTransferResult) => {
    console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getCallTransferInfo fail, promise: err->${JSON.stringify(err)}`);
});

call.setCallTransfer8+

setCallTransfer(slotId: number, info: CallTransferInfo, callback: AsyncCallback<void>): void

Sets call transfer information. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
infoCallTransferInfoYesCall transfer information.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

let callTransferInfo: call.CallTransferInfo = {
    transferNum: "111",
    type: call.CallTransferType.TRANSFER_TYPE_BUSY,
    settingType: call.CallTransferSettingType.CALL_TRANSFER_ENABLE
}
call.setCallTransfer(0, callTransferInfo, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.setCallTransfer8+

setCallTransfer(slotId: number, info: CallTransferInfo): Promise<void>

Sets call transfer information. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
infoCallTransferInfoYesCall transfer information.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
801Capability not supported.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

let callTransferInfo: call.CallTransferInfo = {
    transferNum: "111",
    type: call.CallTransferType.TRANSFER_TYPE_BUSY,
    settingType: call.CallTransferSettingType.CALL_TRANSFER_ENABLE
}
call.setCallTransfer(0, callTransferInfo).then(() => {
    console.log(`setCallTransfer success.`);
}).catch((err: BusinessError) => {
    console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`);
});

call.isRinging8+

isRinging(callback: AsyncCallback<boolean>): void

Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<boolean>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isRinging((err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.isRinging8+

isRinging(): Promise<boolean>

Checks whether the ringtone is playing. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isRinging().then((data: boolean) => {
    console.log(`isRinging success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`isRinging fail, promise: err->${JSON.stringify(err)}`);
});

call.setMuted8+

setMuted(callback: AsyncCallback<void>): void

Sets call muting. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.setMuted((err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.setMuted8+

setMuted(): Promise<void>

Sets call muting. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.setMuted().then(() => {
    console.log(`setMuted success.`);
}).catch((err: BusinessError) => {
    console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`);
});

call.cancelMuted8+

cancelMuted(callback: AsyncCallback<void>): void

Cancels call muting. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.cancelMuted((err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.cancelMuted8+

cancelMuted(): Promise<void>

Cancels call muting. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.cancelMuted().then(() => {
    console.log(`cancelMuted success.`);
}).catch((err: BusinessError) => {
    console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`);
});

call.setAudioDevice8+

setAudioDevice(device: AudioDevice, callback: AsyncCallback<void>): void

Sets the audio device for a call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
deviceAudioDeviceYesAudio device.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let audioDevice: call.AudioDevice = {
    deviceType: call.AudioDeviceType.DEVICE_EARPIECE
}
call.setAudioDevice(audioDevice, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.setAudioDevice10+

setAudioDevice(device: AudioDevice): Promise<void>

Sets the audio device for a call. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
deviceAudioDeviceYesAudio device.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let audioDevice: call.AudioDevice = {
    deviceType: call.AudioDeviceType.DEVICE_EARPIECE
}
call.setAudioDevice(audioDevice).then(() => {
    console.log(`setAudioDevice success.`);
}).catch((err: BusinessError) => {
    console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`);
});

call.joinConference8+

joinConference(mainCallId: number, callNumberList: Array<string>, callback: AsyncCallback<void>): void

Joins a conference call. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
mainCallIdnumberYesMain call ID.
callNumberListArray<string>YesList of call numbers.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let callNumberList: Array<string> = [
    "138XXXXXXXX"
];
call.joinConference(1, callNumberList, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.joinConference8+

joinConference(mainCallId: number, callNumberList: Array<string>): Promise<void>

Joins a conference call. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
mainCallIdnumberYesMain call ID.
callNumberListArray<string>YesList of call numbers.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let callNumberList: Array<string> = [
    "138XXXXXXXX"
];
call.joinConference(1, callNumberList).then(() => {
    console.log(`joinConference success.`);
}).catch((err: BusinessError) => {
    console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`);
});

call.updateImsCallMode8+

updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback<void>): void

Updates the IMS call mode. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
modeImsCallModeYesIMS call mode.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.updateImsCallMode(1, 1, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.updateImsCallMode8+

updateImsCallMode(callId: number, mode: ImsCallMode): Promise<void>

Updates the IMS call mode. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callIdnumberYesCall ID.
modeImsCallModeYesIMS call mode.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.updateImsCallMode(1, 1).then(() => {
    console.log(`updateImsCallMode success.`);
}).catch((err: BusinessError) => {
    console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`);
});

call.enableImsSwitch8+

enableImsSwitch(slotId: number, callback: AsyncCallback<void>): void

Enables the IMS service. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.enableImsSwitch(0, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.enableImsSwitch8+

enableImsSwitch(slotId: number): Promise<void>

Enables the IMS service. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.enableImsSwitch(0).then(() => {
    console.log(`enableImsSwitch success.`);
}).catch((err: BusinessError) => {
    console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});

call.disableImsSwitch8+

disableImsSwitch(slotId: number, callback: AsyncCallback<void>): void

Disables the IMS service. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.disableImsSwitch(0, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.disableImsSwitch8+

disableImsSwitch(slotId: number): Promise<void>

Disables the IMS service. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.disableImsSwitch(0).then(() => {
    console.log(`disableImsSwitch success.`);
}).catch((err: BusinessError) => {
    console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});

call.isImsSwitchEnabled8+

isImsSwitchEnabled(slotId: number, callback: AsyncCallback<boolean>): void

Checks whether the IMS service is enabled. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<boolean>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isImsSwitchEnabled(0, (err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.isImsSwitchEnabled8+

isImsSwitchEnabled(slotId: number): Promise<boolean>

Checks whether the IMS service is enabled. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.isImsSwitchEnabled(0).then((data: boolean) => {
    console.log(`isImsSwitchEnabled success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`isImsSwitchEnabled fail, promise: err->${JSON.stringify(err)}`);
});

call.closeUnfinishedUssd10+

closeUnfinishedUssd(slotId: number, callback: AsyncCallback<void>): void

Cancels the unfinished USSD services. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
call.closeUnfinishedUssd(slotId, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.closeUnfinishedUssd10+

closeUnfinishedUssd(slotId: number): Promise<void>

Cancels the unfinished USSD services. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
call.closeUnfinishedUssd(slotId).then(() => {
    console.log(`closeUnfinishedUssd success.`);
}).catch((err: BusinessError) => {
    console.error(`closeUnfinishedUssd fail, promise: err->${JSON.stringify(err)}`);
});

call.setVoNRState10+

setVoNRState(slotId: number, state: VoNRState, callback: AsyncCallback<void>): void

Sets the status of the VoNR switch. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
stateVoNRStateYesStatus of the VoNR switch.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let state: call.VoNRState = call.VoNRState.VONR_STATE_ON;
call.setVoNRState(slotId, state, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.setVoNRState10+

setVoNRState(slotId: number, state: VoNRState): Promise<void>

Sets the status of the VoNR switch. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
stateVoNRStateYesStatus of the VoNR switch.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let state: call.VoNRState = call.VoNRState.VONR_STATE_ON;
call.setVoNRState(slotId, state).then(() => {
    console.log(`setVoNRState success`);
}).catch((err: BusinessError) => {
    console.error(`setVoNRState fail, promise: err->${JSON.stringify(err)}`);
});

call.getVoNRState10+

getVoNRState(slotId: number, callback: AsyncCallback<VoNRState>): void

Obtains the status of the VoNR switch. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<VoNRState>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
call.getVoNRState(slotId, (err: BusinessError, data: call.VoNRState) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.getVoNRState10+

getVoNRState(slotId: number): Promise<VoNRState>

Obtains the status of the VoNR switch. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<VoNRState>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
call.getVoNRState(slotId).then((data: call.VoNRState) => {
    console.log(`getVoNRState success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getVoNRState fail, promise: err->${JSON.stringify(err)}`);
});

call.canSetCallTransferTime10+

canSetCallTransferTime(slotId: number, callback: AsyncCallback<boolean>): void

Checks whether the call forwarding time can be set. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<boolean>YesCallback used to return the result. The value true indicates that the call forwarding time can be set, and the value false indicates the opposite.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
call.canSetCallTransferTime(slotId, (err: BusinessError, data: boolean) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

call.canSetCallTransferTime10+

canSetCallTransferTime(slotId: number): Promise<boolean>

Checks whether the call forwarding time can be set. This API uses a promise to return the result.

System API: This is a system API.

Required permission: ohos.permission.GET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

let slotId: number = 0;
call.canSetCallTransferTime(slotId).then((data: boolean) => {
    console.log(`canSetCallTransferTime success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`canSetCallTransferTime fail, promise: err->${JSON.stringify(err)}`);
});

call.inputDialerSpecialCode10+

inputDialerSpecialCode(inputCode: string, callback: AsyncCallback<void>): void

Performs a secret code broadcast. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
inputCodestringYesSecret code, for example, 2846579 (project menu).
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

call.inputDialerSpecialCode('2846579', (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.inputDialerSpecialCode10+

inputDialerSpecialCode(inputCode: string): Promise<void>

Performs a secret code broadcast. This API uses a promise to return the result.

System API: This is a system API.

Required Permissions: ohos.permission.PLACE_CALL

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
inputCodestringYesSecret code, for example, 2846579 (project menu).

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.

Example

import { BusinessError } from '@ohos.base';

try {
    call.inputDialerSpecialCode('2846579');
    console.log(`inputDialerSpecialCode success`);
} catch (error) {
    console.log(`inputDialerSpecialCode fail, promise: err->${JSON.stringify(error)}`);
}

call.removeMissedIncomingCallNotification10+

removeMissedIncomingCallNotification(callback: AsyncCallback<void>): void

Removes missed call notifications. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SET_TELEPHONY_STATE, ohos.permission.READ_CALL_LOG, and ohos.permission.WRITE_CALL_LOG

System capability: SystemCapability.Telephony.CallManager

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.removeMissedIncomingCallNotification((err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

call.removeMissedIncomingCallNotification10+

removeMissedIncomingCallNotification(): Promise<void>

Removes missed call notifications. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SET_TELEPHONY_STATE, ohos.permission.READ_CALL_LOG, and ohos.permission.WRITE_CALL_LOG

System capability: SystemCapability.Telephony.CallManager

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import { BusinessError } from '@ohos.base';

call.removeMissedIncomingCallNotification().then(() => {
    console.log(`removeMissedIncomingCallNotification success`);
}).catch((err: BusinessError) => {
    console.log(`removeMissedIncomingCallNotification failed, promise: err->${JSON.stringify(err)}`);
});

DialOptions

Provides an option for determining whether a call is a video call.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
extrasbooleanNoWhether the call is a video call.
- true: video call
- false (default): voice call
accountId 8+numberNoAccount ID.
- 0: card slot 1
- 1: card slot 2
This is a system API.
videoState 8+VideoStateTypeNoVideo state type. This is a system API.
dialScene 8+DialSceneNoDialup scenario. This is a system API.
dialType 8+DialTypeNoDialup type. This is a system API.

DialCallOptions9+

Provides an option for determining whether a call is a video call.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
accountId 9+numberNoAccount ID.
- 0: card slot 1
- 1: card slot 2
videoState 9+VideoStateTypeNoVideo state type.
dialScene 9+DialSceneNoDialup scenario.
dialType 9+DialTypeNoDialup type.

CallState

Enumerates call states.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
CALL_STATE_UNKNOWN-1The call status fails to be obtained and is unknown.
CALL_STATE_IDLE0No call is in progress.
CALL_STATE_RINGING1The call is in the ringing or waiting state.
CALL_STATE_OFFHOOK2At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.

EmergencyNumberOptions7+

Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
slotIdnumberNoCard slot ID.
- 0: card slot 1
- 1: card slot 2

NumberFormatOptions7+

Provides an option for number formatting.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
countryCodestringNoCountry code, for example, CN (China). All country codes are supported. The default value is CN.

ImsCallMode8+

Enumerates IMS call modes.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
CALL_MODE_AUDIO_ONLY0Audio call only.
CALL_MODE_SEND_ONLY1Sending calls only.
CALL_MODE_RECEIVE_ONLY2Receiving calls only.
CALL_MODE_SEND_RECEIVE3Sending and receiving calls.
CALL_MODE_VIDEO_PAUSED4Pausing video calls.

VoNRState10+

Enumerates VoNR switch states.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
VONR_STATE_OFF0Disabled.
VONR_STATE_ON1Enabled.

AudioDevice10+

Enumerates audio devices.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
deviceType 10+AudioDeviceTypeYesAudio device type.
address 10+stringNoAudio device address.

AudioDeviceType10+

Enumerates audio device types.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
DEVICE_EARPIECE0Headset device.
DEVICE_SPEAKER1Speaker device.
DEVICE_WIRED_HEADSET2Wired headset device.
DEVICE_BLUETOOTH_SCO3Bluetooth SCO device.

AudioDeviceCallbackInfo10+

Defines the audio device information.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
audioDeviceList 10+Array<AudioDevice>YesAudio device list.
currentAudioDevice 10+AudioDeviceYesCurrent audio device.
isMuted 10+booleanYesWhether the audio device is muted.

CallRestrictionType8+

Enumerates call restriction types.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
RESTRICTION_TYPE_ALL_INCOMING0Barring of all incoming calls.
RESTRICTION_TYPE_ALL_OUTGOING1Barring of all outgoing calls.
RESTRICTION_TYPE_INTERNATIONAL2Barring of international calls.
RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME3Barring of international calls except those in the home country.
RESTRICTION_TYPE_ROAMING_INCOMING4Barring of incoming roaming calls.
RESTRICTION_TYPE_ALL_CALLS5Barring of all calls.
RESTRICTION_TYPE_OUTGOING_SERVICES6Barring of outgoing services.
RESTRICTION_TYPE_INCOMING_SERVICES7Barring of incoming services.

CallTransferInfo8+

Defines the call transfer information.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
transferNumstringYesCall transfer number.
typeCallTransferTypeYesCall transfer type.
settingTypeCallTransferSettingTypeYesCall transfer setting type.
startHour9+numberNoHour in the start time.
startMinute9+numberNoMinute in the start time.
endHour9+numberNoMinute in the end time.
endMinute9+numberNoMinute in the end time.

CallTransferType8+

Enumerates call transfer types.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
TRANSFER_TYPE_UNCONDITIONAL0Call forwarding unconditional.
TRANSFER_TYPE_BUSY1Call forwarding busy.
TRANSFER_TYPE_NO_REPLY2Call forwarding on no reply.
TRANSFER_TYPE_NOT_REACHABLE3Call forwarding on no user not reachable.

CallTransferSettingType8+

Enumerates call transfer setting types.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
CALL_TRANSFER_DISABLE0Disabling of call transfer.
CALL_TRANSFER_ENABLE1Enabling of call transfer.
CALL_TRANSFER_REGISTRATION3Registration of call transfer.
CALL_TRANSFER_ERASURE4Erasing of call transfer.

CallAttributeOptions7+

Defines the call attribute options.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
accountNumberstringYesAccount number.
speakerphoneOnbooleanYesSpeakerphone on.
accountIdnumberYesAccount ID.
videoStateVideoStateTypeYesVideo state type.
startTimenumberYesStart time.
isEccbooleanYesWhether the call is an ECC.
callTypeCallTypeYesCall type.
callIdnumberYesCall ID.
callStateDetailedCallStateYesDetailed call state.
conferenceStateConferenceStateYesConference state.

ConferenceState7+

Enumerates conference states.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
TEL_CONFERENCE_IDLE0Idle state.
TEL_CONFERENCE_ACTIVE1Active state.
TEL_CONFERENCE_DISCONNECTING2Disconnecting state.
TEL_CONFERENCE_DISCONNECTED3Disconnected state.

CallType7+

Enumerates call types.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
TYPE_CS0CS call.
TYPE_IMS1IMS call.
TYPE_OTT2OTT call.
TYPE_ERR_CALL3Error call type.

VideoStateType7+

Video state type.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
TYPE_VOICE0Voice state.
TYPE_VIDEO1Video state.

DetailedCallState7+

Enumerates detailed call states.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
CALL_STATUS_ACTIVE0Active state.
CALL_STATUS_HOLDING1Hold state.
CALL_STATUS_DIALING2Dialing state.
CALL_STATUS_ALERTING3Alerting state.
CALL_STATUS_INCOMING4Incoming state.
CALL_STATUS_WAITING5Waiting state.
CALL_STATUS_DISCONNECTED6Disconnected state.
CALL_STATUS_DISCONNECTING7Disconnecting state.
CALL_STATUS_IDLE8Idle state.

CallRestrictionInfo8+

Defines the call restriction information.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
typeCallRestrictionTypeYesCall restriction type.
passwordstringYesPassword.
modeCallRestrictionModeYesCall restriction mode.

CallRestrictionMode8+

Enumerates call restriction modes.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
RESTRICTION_MODE_DEACTIVATION0Call restriction deactivated.
RESTRICTION_MODE_ACTIVATION1Call restriction activated.

CallEventOptions8+

Defines the call event options.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
eventIdCallAbilityEventIdYesCall ability event ID.

CallAbilityEventId8+

Enumerates call ability event IDs.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
EVENT_DIAL_NO_CARRIER1No available carrier during dialing.
EVENT_INVALID_FDN_NUMBER2Invalid FDN.
EVENT_HOLD_CALL_FAILED11+3Failed to place the call on hold.
EVENT_SWAP_CALL_FAILED11+4Failed to place the current call on hold and answer the waiting call.

DialScene8+

Enumerates dialup scenarios.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
CALL_NORMAL0Common call.
CALL_PRIVILEGED1Privileged call.
CALL_EMERGENCY2Emergency call.

DialType8+

Enumerates dialup types.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
DIAL_CARRIER_TYPE0Carrier.
DIAL_VOICE_MAIL_TYPE1Voice mail.
DIAL_OTT_TYPE2OTT.

RejectMessageOptions7+

Defines options for the call rejection message.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
messageContentstringYesMessage content.

CallTransferResult8+

Defines the call transfer result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
statusTransferStatusYesCall transfer status.
numberstringYesCall transfer number.
startHour9+numberYesHour in the start time.
startMinute9+numberYesMinute in the start time.
endHour9+numberYesMinute in the end time.
endMinute9+numberYesMinute in the end time.

CallWaitingStatus7+

Enumerates call waiting states.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
CALL_WAITING_DISABLE0Call waiting disabled.
CALL_WAITING_ENABLE1Call waiting enabled.

RestrictionStatus8+

Enumerates call restriction states.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
RESTRICTION_DISABLE0Call restriction disabled.
RESTRICTION_ENABLE1Call restriction enabled.

TransferStatus8+

Enumerates call transfer states.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
TRANSFER_DISABLE0Call transfer disabled.
TRANSFER_ENABLE1Call transfer enabled.

DisconnectedDetails9+

Defines the call disconnection cause.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
reasonDisconnectedReasonYesCall disconnection cause.
messagestringYesCall ending message.

DisconnectedReason8+

Enumerates call disconnection causes.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
UNASSIGNED_NUMBER1Unallocated (unassigned) number.
NO_ROUTE_TO_DESTINATION3No route to destination.
CHANNEL_UNACCEPTABLE6Channel unacceptable.
OPERATOR_DETERMINED_BARRING8Operator determined barring (ODB).
CALL_COMPLETED_ELSEWHERE9+13Call completed elsewhere.
NORMAL_CALL_CLEARING16Normal call clearing.
USER_BUSY17User busy.
NO_USER_RESPONDING18No user responding.
USER_ALERTING_NO_ANSWER19User alerting, no answer.
CALL_REJECTED21Call rejected.
NUMBER_CHANGED22Number changed.
CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION9+24Call rejected due to feature at the destination.
FAILED_PRE_EMPTION9+25Failed preemption.
NON_SELECTED_USER_CLEARING9+26Non-selected user clearing.
DESTINATION_OUT_OF_ORDER27Destination out of order.
INVALID_NUMBER_FORMAT28Invalid number format (incomplete number).
FACILITY_REJECTED9+29Facility rejected.
RESPONSE_TO_STATUS_ENQUIRY9+30Response to status enquiry.
NORMAL_UNSPECIFIED9+31Normal, unspecified.
NO_CIRCUIT_CHANNEL_AVAILABLE9+34No circuit/channel available.
NETWORK_OUT_OF_ORDER38Network fault.
TEMPORARY_FAILURE41Temporary failure.
SWITCHING_EQUIPMENT_CONGESTION9+42Switching equipment congestion.
ACCESS_INFORMATION_DISCARDED9+43Access information discarded.
REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE9+44Requested circuit/channel unavailable
RESOURCES_UNAVAILABLE_UNSPECIFIED9+47Resources unavailable, unspecified.
QUALITY_OF_SERVICE_UNAVAILABLE9+49QoS unavailable.
REQUESTED_FACILITY_NOT_SUBSCRIBED9+50Requested facility not subscribed.
INCOMING_CALLS_BARRED_WITHIN_THE_CUG9+55Incoming calls barred within the CUG.
BEARER_CAPABILITY_NOT_AUTHORIZED9+57Bearer capability not authorized.
BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE9+58Bearer capability presently available.
SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED9+63Service or option not available, unspecified.
BEARER_SERVICE_NOT_IMPLEMENTED9+65Bearer service not implemented.
ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE9+68ACM greater than or equal to the maximum value.
REQUESTED_FACILITY_NOT_IMPLEMENTED9+69Requested facility not implemented.
ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE9+70Only restricted digital information bearer capability available.
SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED9+79Service or option not implemented, unspecified.
INVALID_TRANSACTION_IDENTIFIER_VALUE9+81Invalid transaction identifier value.
USER_NOT_MEMBER_OF_CUG9+87User not member of CUG.
INCOMPATIBLE_DESTINATION9+88Incompatible destination.
INVALID_TRANSIT_NETWORK_SELECTION9+91Invalid transit network selection.
SEMANTICALLY_INCORRECT_MESSAGE9+95Semantically incorrect message.
INVALID_MANDATORY_INFORMATION9+96Invalid mandatory information.
MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED9+97Message type non-existent or not implemented.
MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE9+98Message type not compatible with protocol state.
INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED9+99IE non-existent or not implemented.
CONDITIONAL_IE_ERROR9+100Conditional IE error.
MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE9+101Message not compatible with protocol state.
RECOVERY_ON_TIMER_EXPIRED9+102Recovery on timer expiry.
PROTOCOL_ERROR_UNSPECIFIED9+111Protocol error, unspecified.
INTERWORKING_UNSPECIFIED9+127Interworking, unspecified.
CALL_BARRED9+240Call barred.
FDN_BLOCKED9+241FDN blocked.
IMSI_UNKNOWN_IN_VLR9+242IMSI unknown in VLR.
IMEI_NOT_ACCEPTED9+243IMEI not accepted.
DIAL_MODIFIED_TO_USSD9+244Dial request modified to USSD request.
DIAL_MODIFIED_TO_SS9+245Dial request modified to SS request.
DIAL_MODIFIED_TO_DIAL9+246Dial request modified to dial with different number.
RADIO_OFF9+247Radio off.
OUT_OF_SERVICE9+248Out of service.
NO_VALID_SIM9+249No valid SIM.
RADIO_INTERNAL_ERROR9+250Radio internal error.
NETWORK_RESP_TIMEOUT9+251Network response timeout.
NETWORK_REJECT9+252Request rejected by network.
RADIO_ACCESS_FAILURE9+253Radio access failure.
RADIO_LINK_FAILURE9+254Radio link failure.
RADIO_LINK_LOST9+255Radio link lost.
RADIO_UPLINK_FAILURE9+256Radio uplink failure.
RADIO_SETUP_FAILURE9+257Radio setup failure.
RADIO_RELEASE_NORMAL9+258Radio release normal.
RADIO_RELEASE_ABNORMAL9+259Radio release abnormal.
ACCESS_CLASS_BLOCKED9+260Access class blocked.
NETWORK_DETACH9+261Network detached.
INVALID_PARAMETER1025Invalid parameter.
SIM_NOT_EXIT1026SIM not exit.
SIM_PIN_NEED1027SIM PIN needed.
CALL_NOT_ALLOW1029Call not allowed.
SIM_INVALID1045No valid SIM.
UNKNOWN1279Unknown reason.

MmiCodeResults9+

Defines the MMI code result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameTypeMandatoryDescription
resultMmiCodeResultYesMMI code result.
messagestringYesMMI code message.

MmiCodeResult9+

Defines the MMI code result.

System API: This is a system API.

System capability: SystemCapability.Telephony.CallManager

NameValueDescription
MMI_CODE_SUCCESS0Success.
MMI_CODE_FAILED1Failure.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/1bb3e29c915f4f6682a64a34e6963dac