# @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 the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange).
>**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
```js
import call from '@ohos.telephony.call';
```
## call.dial
dial\(phoneNumber: string, callback: AsyncCallback\): void
Initiates a call. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | -------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure |
**Example**
```js
call.dial("138xxxxxxxx", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.dial
dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void
Initiates a call based on the specified options. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | --------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure |
**Example**
```js
call.dial("138xxxxxxxx", {
extras: false
}, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.dial
dial\(phoneNumber: string, options?: DialOptions\): Promise
Initiates a call based on the specified options. This API uses a promise to return the result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | -------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. |
**Return value**
| Type | Description |
| ---------------------- | ---------------------------------------------------------------- |
| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure |
**Example**
```js
let promise = call.dial("138xxxxxxxx", {
extras: false
});
promise.then(data => {
console.log(`dial success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`dial fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.makeCall7+
makeCall(phoneNumber: string, callback: AsyncCallback\): 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**
| Name | Type | Mandatory | Description |
| ----------- | ------------------------- | ---- | ------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
call.makeCall("138xxxxxxxx", err => {
console.log(`makeCall callback: err->${JSON.stringify(err)}`);
});
```
## call.makeCall7+
makeCall(phoneNumber: string): Promise\
Launches the call screen and displays the dialed number. This API uses a promise to return the result.
**System capability**: SystemCapability.Applications.Contacts
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------- |
| phoneNumber | string | Yes | Phone number. |
**Return value**
| Type | Description |
| ------------------- | --------------------------------- |
| Promise<void> | Promise used to return the result. |
**Example**
```js
let promise = call.makeCall("138xxxxxxxx");
promise.then(() => {
console.log(`makeCall success`);
}).catch(err => {
console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.hasCall
hasCall\(callback: AsyncCallback\): void
Checks whether a call is in progress. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result.
- **true**: A call is in progress.
- **false**: No call is in progress. |
**Example**
```js
call.hasCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.hasCall
hasCall\(\): Promise
Checks whether a call is in progress. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ---------------------- | --------------------------------------- |
| Promise<boolean> | Promise used to return the result. |
**Example**
```js
let promise = call.hasCall();
promise.then(data => {
console.log(`hasCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`hasCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallState
getCallState\(callback: AsyncCallback\): void
Obtains the call status. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result. |
**Example**
```js
call.getCallState((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallState
getCallState\(\): Promise
Obtains the call status. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| -------------------------------------- | --------------------------------------- |
| Promise<[CallState](#callstate)> | Promise used to return the result. |
**Example**
```js
let promise = call.getCallState();
promise.then(data => {
console.log(`getCallState success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallState fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.hasVoiceCapability7+
hasVoiceCapability(): boolean
Checks whether a device supports voice calls.
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ------- | ------------------------------------------------------------ |
| boolean | - **true**: The device supports voice calls.
- **false**: The device does not support voice calls. |
```js
let result = call.hasVoiceCapability();
console.log(`hasVoiceCapability: ${JSON.stringify(result)}`);
```
## call.isEmergencyPhoneNumber7+
isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): 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**
| Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. |
**Example**
```js
call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isEmergencyPhoneNumber7+
isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\): void
Checks whether the called number is an emergency number based on the specified phone number options. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number options. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. |
**Example**
```js
call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isEmergencyPhoneNumber7+
isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise
Checks whether the called number is an emergency number based on the specified phone number options. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. |
**Return value**
| Type | Description |
| ---------------------- | --------------------------------------------------- |
| Promise<boolean> | Promise used to return the result. |
**Example**
```js
let promise = call.isEmergencyPhoneNumber("138xxxxxxxx", {slotId: 1});
promise.then(data => {
console.log(`isEmergencyPhoneNumber success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isEmergencyPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.formatPhoneNumber7+
formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): 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**
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback<string> | Yes | Callback used to return the result. |
**Example**
```js
call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.formatPhoneNumber7+
formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\): void
Formats a phone number based on the 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**
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code. |
| callback | AsyncCallback<string> | Yes | Callback used to return the result. |
**Example**
```js
call.formatPhoneNumber("138xxxxxxxx", {
countryCode: "CN"
}, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.formatPhoneNumber7+
formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise
Formats a phone number based on the 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**
| Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------- | ---- | ---------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. |
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------- |
| Promise<string> | Promise used to return the result. |
**Example**
```js
let promise = call.formatPhoneNumber("138xxxxxxxx", {
countryCode: "CN"
});
promise.then(data => {
console.log(`formatPhoneNumber success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`formatPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.formatPhoneNumberToE1647+
formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: AsyncCallback\): 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**
| Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ----------------------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. |
| callback | AsyncCallback<string> | Yes | Callback used to return the result. |
**Example**
```js
call.formatPhoneNumberToE164("138xxxxxxxx", "CN", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.formatPhoneNumberToE1647+
formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise
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**
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. |
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| Promise<string> | Promise used to return the result. |
**Example**
```js
let promise = call.formatPhoneNumberToE164("138xxxxxxxx", "CN");
promise.then(data => {
console.log(`formatPhoneNumberToE164 success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`formatPhoneNumberToE164 fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.muteRinger8+
muteRinger\(callback: AsyncCallback\): void
Mutes the ringtone while it is playing. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.muteRinger((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.muteRinger8+
muteRinger\(\): Promise
Mutes the ringtone while it is playing. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.muteRinger();
promise.then(data => {
console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.answer7+
answer\(callId: number, callback: AsyncCallback\): void
Answers a call based on the specified call ID. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------------------------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
call.answer(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.answer7+
answer(callId?: number\): Promise
Answers a call based on the specified call ID. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.answer(1);
promise.then(data => {
console.log(`answer success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`answer fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.hangup7+
hangup\(callId: number, callback: AsyncCallback\): void
Ends a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.hangup(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.answer9+
answer\(callback: AsyncCallback\): void
Answers a call.This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------------------------- |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
call.answer((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.hangup7+
hangup\(callId?: number\): Promise
Ends a call based on the specified call ID. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.hangup(1);
promise.then(data => {
console.log(`hangup success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`hangup fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.hangup9+
hangup\(callback: AsyncCallback\): void
Ends a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.hangup((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject7+
reject(callId: number, callback: AsyncCallback\): void
Rejects a call based on the specified call ID. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------------------------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
call.reject(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject7+
reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void
Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
call.reject(1, rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject7+
reject(callId?: number, options?: RejectMessageOptions\): Promise
Rejects a call based on the specified call ID and options. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
| options | [RejectMessageOptions](#rejectmessageoptions7) | No | Options for the call rejection message. |
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
let promise = call.reject(1, rejectMessageOptions);
promise.then(data => {
console.log(`reject success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.reject9+
reject\(callback: AsyncCallback\): void
Rejects a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example:**
```js
call.reject((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.reject9+
reject\(options: RejectMessageOptions, callback: AsyncCallback\): void
Rejects a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | -------------- |
| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example:**
```js
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
call.reject(rejectMessageOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.holdCall7+
holdCall\(callId: number, callback: AsyncCallback\): void
Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.holdCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.holdCall7+
holdCall\(callId: number\): Promise
Holds a call based on the specified call ID. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.holdCall(1);
promise.then(data => {
console.log(`holdCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.unHoldCall7+
unHoldCall\(callId: number, callback: AsyncCallback\): void
Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.unHoldCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.unHoldCall7+
unHoldCall\(callId: number\): Promise
Unholds a call based on the specified call ID. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.unHoldCall(1);
promise.then(data => {
console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.switchCall7+
switchCall\(callId: number, callback: AsyncCallback\): void
Switches a call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.switchCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.switchCall7+
switchCall\(callId: number\): Promise
Switches a call. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.switchCall(1);
promise.then(data => {
console.log(`switchCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.combineConference7+
combineConference\(callId: number, callback: AsyncCallback\): void
Combines two calls into a conference call. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.combineConference(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.combineConference7+
combineConference\(callId: number\): Promise
Combines two calls into a conference call. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.combineConference(1);
promise.then(data => {
console.log(`combineConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getMainCallId7+
getMainCallId\(callId: number, callback: AsyncCallback\): void
Obtains the main call ID. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------ |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<number> | Yes | Callback used to return the result. |
**Example**
```js
call.getMainCallId(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getMainCallId7+
getMainCallId\(callId: number\): Promise
Obtains the main call ID. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ------------------- | ------------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.getMainCallId(1);
promise.then(data => {
console.log(`getMainCallId success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getMainCallId fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getSubCallIdList7+
getSubCallIdList\(callId: number, callback: AsyncCallback\>\): void
Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------ | ---- | ---------------------------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback\> | Yes | Callback used to return the result. |
**Example**
```js
call.getSubCallIdList(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getSubCallIdList7+
getSubCallIdList\(callId: number\): Promise\>
Obtains the list of subcall IDs. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ----------------------------- | ----------------------------------- |
| Promise<Array> | Promise used to return the result.|
**Example**
```js
let promise = call.getSubCallIdList(1);
promise.then(data => {
console.log(`getSubCallIdList success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getSubCallIdList fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallIdListForConference7+
getCallIdListForConference\(callId: number, callback: AsyncCallback>\): void
Obtains the list of call IDs in a conference. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | -------------------------------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<Array> | Yes | Callback used to return the result. |
**Example**
```js
call.getCallIdListForConference(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallIdListForConference7+
getCallIdListForConference\(callId: number\): Promise\>
Obtains the list of call IDs in a conference. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ----------------------------- | --------------------------------------- |
| Promise<Array> | Promise used to return the result.|
**Example**
```js
let promise = call.getCallIdListForConference(1);
promise.then(data => {
console.log(`getCallIdListForConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallIdListForConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallWaitingStatus7+
getCallWaitingStatus\(slotId: number, callback: AsyncCallback\): void
Obtains the call waiting status. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.|
**Example**
```js
call.getCallWaitingStatus(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallWaitingStatus7+
getCallWaitingStatus\(slotId: number\): Promise
Obtains the call waiting status. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
**Return value**
| Type | Description |
| ------------------------------------------------------- | ------------------------------------------------------------ |
| Promise<[CallWaitingStatus](#callwaitingstatus7)> | Promise used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.|
**Example**
```js
let promise = call.getCallWaitingStatus(0);
promise.then(data => {
console.log(`getCallWaitingStatus success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallWaitingStatus fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setCallWaiting7+
setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\): void
Sets the call waiting switch. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
| activate | boolean | Yes | Whether to enable call waiting.
- **false**: Disable call waiting.
- **true**: Enable call waiting.|
| callback | AsyncCallback | Yes | Callback used to return the result. |
**Example**
```js
call.setCallWaiting(0, true, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setCallWaiting7+
setCallWaiting\(slotId: number, activate: boolean\): Promise
Sets the call waiting switch. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
| activate | boolean | Yes | Whether to enable call waiting.
- **false**: Disable call waiting.
- **true**: Enable call waiting.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.setCallWaiting(0, true);
promise.then(data => {
console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.startDTMF7+
startDTMF\(callId: number, character: string, callback: AsyncCallback\): void
Enables dual-tone multifrequency (DTMF). This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | -------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. |
| character | string | Yes | DTMF code. |
| callback | AsyncCallback | Yes | Callback used to return the result.|
**Example**
```js
call.startDTMF(1, "0", (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.startDTMF7+
startDTMF\(callId: number, character: string\): Promise
Enables DTMF. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
| character | string | Yes | DTMF code.|
**Return value**
| Type | Description |
| ------------------- | ----------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.startDTMF(1, "0");
promise.then(data => {
console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.stopDTMF7+
stopDTMF\(callId: number, callback: AsyncCallback\): void
Stops DTMF. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.stopDTMF(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.stopDTMF7+
stopDTMF\(callId: number\): Promise
Stops DTMF. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.stopDTMF(1);
promise.then(data => {
console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.isInEmergencyCall7+
isInEmergencyCall\(callback: AsyncCallback\): void
Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
**Example**
```js
call.isInEmergencyCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isInEmergencyCall7+
isInEmergencyCall\(\): Promise
Checks whether a call is an emergency call. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ---------------------- | --------------------------- |
| Promise<boolean> | Promise used to return the result.|
**Example**
```js
let promise = call.isInEmergencyCall();
promise.then(data => {
console.log(`isInEmergencyCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isInEmergencyCall fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.on('callDetailsChange')7+
on\(type: 'callDetailsChange', callback: Callback\): void
Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | -------------------------- |
| type | string | Yes | Call details change during a call.|
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. |
**Example**
```js
call.on('callDetailsChange', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.on('callEventChange')8+
on\(type: 'callEventChange', callback: Callback\): void
Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | -------------------------- |
| type | string | Yes | Call event change during a call.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | Yes | Callback used to return the result. |
**Example**
```js
call.on('callEventChange', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.on('callDisconnectedCause')8+
on\(type: 'callDisconnectedCause', callback: Callback): void
Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------ | ---- | -------------------------- |
| type | string | Yes | Cause of the call disconnection.|
| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | Yes | Callback used to return the result. |
**Example**
```js
call.on('callDisconnectedCause', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.on('mmiCodeResult')9+
on\(type: 'mmiCodeResult', callback: Callback\): void
Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | --------------------- |
| type | string | Yes | Man-machine interface (MMI) code result.|
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | Yes | Callback used to return the result. |
**Example**
```js
call.on('mmiCodeResult', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.off('callDetailsChange')7+
off\(type: 'callDetailsChange', callback?: Callback\): void
Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------------- | ---- | ---------------------------------- |
| type | string | Yes | Unsubscription from call details changes when a call ends.|
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. |
**Example**
```js
call.off('callDetailsChange', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.off('callEventChange')8+
off\(type: 'callEventChange', callback?: Callback\): void
Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ---------------------------------- |
| type | string | Yes | Unsubscription from call event changes when a call ends.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. |
**Example**
```js
call.off('callEventChange', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.off('callDisconnectedCause')8+
off\(type: 'callDisconnectedCause', callback?: Callback\): void
Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------------- | ---- | -------------------- |
| type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.|
| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. |
**Example**
```js
call.off('callDisconnectedCause', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.off('mmiCodeResult')9+
off\(type: 'mmiCodeResult', callback?: Callback\): void
Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ----------- |
| type | 'mmiCodeResult' | Yes | MMI code result.|
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. |
**Example**
```js
call.off('mmiCodeResult', data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
```
## call.isNewCallAllowed8+
isNewCallAllowed\(callback: AsyncCallback\): void
Checks whether a new call is allowed. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
**Example**
```js
call.isNewCallAllowed((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isNewCallAllowed8+
isNewCallAllowed\(\): Promise
Checks whether a new call is allowed. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ---------------------- | --------------------------- |
| Promise<boolean> | Promise used to return the result.|
**Example**
```js
let promise = call.isNewCallAllowed();
promise.then(data => {
console.log(`isNewCallAllowed success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isNewCallAllowed fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.separateConference8+
separateConference\(callId: number, callback: AsyncCallback\): void
Separates a conference call. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.separateConference(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.separateConference8+
separateConference\(callId: number\): Promise
Separates a conference call. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| callId | number | Yes | Call ID.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.separateConference(1);
promise.then(data => {
console.log(`separateConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallRestrictionStatus8+
getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback\): void
Obtains the call restriction status. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. |
| callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | Yes | Callback used to return the result. |
**Example**
```js
call.getCallRestrictionStatus(0, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallRestrictionStatus8+
getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise
Obtains the call restriction status. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | -------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. |
**Return value**
| Type | Description |
| ------------------------------------------------------- | --------------------------- |
| Promise<[RestrictionStatus](#restrictionstatus8)> | Promise used to return the result.|
**Example**
```js
let promise = call.getCallRestrictionStatus(0, 1);
promise.then(data => {
console.log(`getCallRestrictionStatus success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallRestrictionStatus fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setCallRestriction8+
setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\): void
Sets the call restriction status. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| info | [CallRestrictionInfo](#callrestrictioninfo8) | Yes | Call restriction information. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
let callRestrictionInfo={
type: 1,
password: "123456",
mode: 1
}
call.setCallRestriction(0, callRestrictionInfo, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setCallRestriction8+
setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise
Sets the call restriction status. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | -------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| info | [CallRestrictionInfo](#callrestrictioninfo8) | Yes | Call restriction information. |
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let callRestrictionInfo={
type: 1,
password: "123456",
mode: 1
}
let promise = call.setCallRestriction(0, callRestrictionInfo);
promise.then(data => {
console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.getCallTransferInfo8+
getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback\): void
Obtains call transfer information. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
| callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | Yes | Callback used to return the result. |
**Example**
```js
call.getCallTransferInfo(0, callTransferTyp, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.getCallTransferInfo8+
getCallTransferInfo\(slotId: number, type: CallTransferType): Promise
Obtains call transfer information. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | -------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
**Return value**
| Type | Description |
| --------------------------------------------------------- | --------------------------- |
| Promise<[CallTransferResult](#calltransferresult8)> | Promise used to return the result.|
**Example**
```js
let promise = call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY);
promise.then(data => {
console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getCallTransferInfo fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setCallTransfer8+
setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback\): void
Sets call transfer information. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| info | [CallTransferInfo](#calltransferinfo8) | Yes | Call transfer information. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
let callTransferInfo={
transferNum: "111",
type: 1,
settingType: 1
}
call.setCallTransfer(0, callTransferInfo, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setCallTransfer8+
setCallTransfer\(slotId: number, info: CallTransferInfo): Promise
Sets call transfer information. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| info | [CallTransferInfo](#calltransferinfo8) | Yes | Call transfer information. |
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let callTransferInfo={
transferNum: "111",
type: 1,
settingType: 1
}
let promise = call.setCallTransfer(0, callTransferInfo);
promise.then(data => {
console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.isRinging8+
isRinging\(callback: AsyncCallback\): void
Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
**Example**
```js
call.isRinging((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isRinging8+
isRinging\(\): Promise
Checks whether the ringtone is playing. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ---------------------- | --------------------------- |
| Promise<boolean> | Promise used to return the result.|
**Example**
```js
let promise = call.isRinging();
promise.then(data => {
console.log(`isRinging success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isRinging fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setMuted8+
setMuted\(callback: AsyncCallback\): void
Sets call muting. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.setMuted((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setMuted8+
setMuted\(\): Promise
Sets call muting. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.setMuted();
promise.then(data => {
console.log(`setMuted success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.cancelMuted8+
cancelMuted(callback: AsyncCallback): void
Cancels call muting. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.cancelMuted((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.cancelMuted8+
cancelMuted(): Promise
Cancels call muting. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.cancelMuted();
promise.then(data => {
console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.setAudioDevice9+
setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void
Sets the audio device for a call. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------- |
| device | [AudioDevice](#audiodevice8) | Yes | Audio device.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```js
call.setAudioDevice(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setAudioDevice9+
setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\): void
Sets the audio device for a call based on the specified options. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------ | ---- | -------------- |
| device | [AudioDevice](#audiodevice8) | Yes | Audio device. |
| options | [AudioDeviceOptions](#audiodeviceoptions9) | Yes | Audio device parameters.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
let audioDeviceOptions={
bluetoothAddress: "IEEE 802-2014"
}
call.setAudioDevice(1, audioDeviceOptions, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.setAudioDevice8+
setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise
Sets the audio device for a call based on the specified options. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------ | ---- | ------------------ |
| device | [AudioDevice](#audiodevice8) | Yes | Audio device. |
| options | [AudioDeviceOptions](#audiodeviceoptions9) | No | Audio device parameters.|
**Return value**
| Type | Description |
| ------------------- | ------------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let audioDeviceOptions={
bluetoothAddress: "IEEE 802-2014"
}
let promise = call.setAudioDevice(1, audioDeviceOptions);
promise.then(data => {
console.log(`setAudioDevice success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.joinConference8+
joinConference(mainCallId: number, callNumberList: Array, callback: AsyncCallback): void
Joins a conference call. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------------- | ---- | --------------- |
| mainCallId | number | Yes | Main call ID. |
| callNumberList | Array | Yes | List of call numbers.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
let callNumberList: Array = [
"138XXXXXXXX"
];
call.joinConference(1, callNumberList, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.joinConference8+
joinConference(mainCallId: number, callNumberList: Array): Promise
Joins a conference call. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | -------------- | ---- | --------------- |
| mainCallId | number | Yes | Main call ID. |
| callNumberList | Array | Yes | List of call numbers.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let callNumberList: Array = [
"138XXXXXXXX"
];
let promise = call.joinConference(1, callNumberList);
promise.then(data => {
console.log(`joinConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.updateImsCallMode8+
updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback): void
Updates the IMS call mode. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | -------------- |
| callId | number | Yes | Call ID. |
| mode | [ImsCallMode](#imscallmode8) | Yes | IMS call mode.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
call.updateImsCallMode(1, 1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.updateImsCallMode8+
updateImsCallMode(callId: number, mode: ImsCallMode): Promise
Updates the IMS call mode. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ---------------------------- | ---- | -------------- |
| callId | number | Yes | Call ID. |
| mode | [ImsCallMode](#imscallmode8) | Yes | IMS call mode.|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.updateImsCallMode(1, 1);
promise.then(data => {
console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.enableImsSwitch8+
enableImsSwitch(slotId: number, callback: AsyncCallback): void
Enables the IMS switch. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
call.enableImsSwitch(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.enableImsSwitch8+
enableImsSwitch(slotId: number): Promise
Enables the IMS switch. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.enableImsSwitch(0);
promise.then(data => {
console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.disableImsSwitch8+
disableImsSwitch(slotId: number, callback: AsyncCallback): void
Disables the IMS switch. This API uses an asynchronous callback to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
call.disableImsSwitch(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.disableImsSwitch8+
disableImsSwitch(slotId: number): Promise
Disables the IMS switch. This API uses a promise to return the result.
This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.disableImsSwitch(0);
promise.then(data => {
console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});
```
## call.isImsSwitchEnabled8+
isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void
Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. |
**Example**
```js
call.isImsSwitchEnabled(0, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## call.isImsSwitchEnabled8+
isImsSwitchEnabled(slotId: number): Promise
Checks whether the IMS switch is enabled. This API uses a promise to return the result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
**Return value**
| Type | Description |
| ------------------- | --------------------------- |
| Promise<void> | Promise used to return the result.|
**Example**
```js
let promise = call.isImsSwitchEnabled(0);
promise.then(data => {
console.log(`isImsSwitchEnabled success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`isImsSwitchEnabled fail, promise: err->${JSON.stringify(err)}`);
});
```
## DialOptions
Defines the dialup options.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ |
| extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call|
| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API. |
| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. |
| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. |
| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. |
## CallState
Enumerates call states.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ------------------ | ---- | ------------------------------------------------------------ |
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. |
| CALL_STATE_IDLE | 0 | No call is in progress. |
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. |
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. |
## EmergencyNumberOptions7+
Defines options for determining whether a number is an emergency number.
**System capability**: SystemCapability.Telephony.CallManager
| Name| Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------------- |
| slotId | number | No | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2|
## NumberFormatOptions7+
Defines the number formatting options.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. |
## ImsCallMode8+
Enumerates IMS call modes.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ---------------------- | ---- | ------------------ |
| CALL_MODE_AUDIO_ONLY | 0 | Audio call only. |
| CALL_MODE_SEND_ONLY | 1 | Sending calls only. |
| CALL_MODE_RECEIVE_ONLY | 2 | Receiving calls only. |
| CALL_MODE_SEND_RECEIVE | 3 | Sending and receiving calls.|
| CALL_MODE_VIDEO_PAUSED | 4 | Pausing video calls. |
## AudioDevice8+
Enumerates audio devices.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| -------------------- | ---- | ------------ |
| DEVICE_EARPIECE | 0 | Earpiece. |
| DEVICE_SPEAKER | 1 | Speaker.|
| DEVICE_WIRED_HEADSET | 2 | Wired headset.|
| DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. |
| DEVICE_MIC | 4 | Microphone. |
## CallRestrictionType8+
Enumerates call restriction types.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| --------------------------------------------- | ---- | -------------------------- |
| RESTRICTION_TYPE_ALL_INCOMING | 0 | Barring of all incoming calls. |
| RESTRICTION_TYPE_ALL_OUTGOING | 1 | Barring of all outgoing calls. |
| RESTRICTION_TYPE_INTERNATIONAL | 2 | Barring of international calls. |
| RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME | 3 | Barring of international calls except those in the home country.|
| RESTRICTION_TYPE_ROAMING_INCOMING | 4 | Barring of incoming roaming calls. |
| RESTRICTION_TYPE_ALL_CALLS | 5 | Barring of all calls. |
| RESTRICTION_TYPE_OUTGOING_SERVICES | 6 | Barring of outgoing services. |
| RESTRICTION_TYPE_INCOMING_SERVICES | 7 | Barring of incoming services. |
## CallTransferInfo8+
Defines the call transfer information.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------------------------- | ---- | ---------------- |
| transferNum | string | Yes | Call transfer number. |
| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
| settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.|
| startHour9+ | number | No | Hour in the start time.|
| startMinute9+ | number | No | Minute in the start time.|
| endHour9+ | number | No | Hour in the end time.|
| endMinute9+ | number | No | Minute in the end time.|
## CallTransferType8+
Enumerates call transfer types.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| --------------------------- | ---- | ------------ |
| TRANSFER_TYPE_UNCONDITIONAL | 0 | Call forwarding unconditional. |
| TRANSFER_TYPE_BUSY | 1 | Call forwarding busy. |
| TRANSFER_TYPE_NO_REPLY | 2 | Call forwarding on no reply. |
| TRANSFER_TYPE_NOT_REACHABLE | 3 | Call forwarding on no user not reachable.|
## CallTransferSettingType8+
Enumerates call transfer setting types.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| -------------------------- | ---- | ------------ |
| CALL_TRANSFER_DISABLE | 0 | Disabling of call transfer.|
| CALL_TRANSFER_ENABLE | 1 | Enabling of call transfer.|
| CALL_TRANSFER_REGISTRATION | 3 | Registration of call transfer.|
| CALL_TRANSFER_ERASURE | 4 | Erasing of call transfer.|
## CallAttributeOptions7+
Defines the call attribute options.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| --------------- | ---------------------------------------- | ---- | -------------- |
| accountNumber | string | Yes | Account number. |
| speakerphoneOn | boolean | Yes | Speakerphone on.|
| accountId | number | Yes | Account ID. |
| videoState | [VideoStateType](#videostatetype7) | Yes | Video state type. |
| startTime | number | Yes | Start time. |
| isEcc | boolean | Yes | Whether the call is an ECC. |
| callType | [CallType](#calltype7) | Yes | Call type. |
| callId | number | Yes | Call ID. |
| callState | [DetailedCallState](#detailedcallstate7) | Yes | Detailed call state. |
| conferenceState | [ConferenceState](#conferencestate7) | Yes | Conference state. |
## ConferenceState7+
Enumerates conference states.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ---------------------------- | ---- | -------------- |
| TEL_CONFERENCE_IDLE | 0 | Idle state. |
| TEL_CONFERENCE_ACTIVE | 1 | Active state. |
| TEL_CONFERENCE_DISCONNECTING | 2 | Disconnecting state. |
| TEL_CONFERENCE_DISCONNECTED | 3 | Disconnected state.|
## CallType7+
Enumerates call types.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ------------- | ---- | ------------ |
| TYPE_CS | 0 | CS call. |
| TYPE_IMS | 1 | IMS call. |
| TYPE_OTT | 2 | OTT call. |
| TYPE_ERR_CALL | 3 | Error call type.|
## VideoStateType7+
Enumerates video state types.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ---------- | ---- | -------- |
| TYPE_VOICE | 0 | Voice state.|
| TYPE_VIDEO | 1 | Video state.|
## DetailedCallState7+
Enumerates detailed call states.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ------------------------- | ---- | -------------- |
| CALL_STATUS_ACTIVE | 0 | Active state. |
| CALL_STATUS_HOLDING | 1 | Hold state. |
| CALL_STATUS_DIALING | 2 | Dialing state. |
| CALL_STATUS_ALERTING | 3 | Alerting state. |
| CALL_STATUS_INCOMING | 4 | Incoming state. |
| CALL_STATUS_WAITING | 5 | Waiting state. |
| CALL_STATUS_DISCONNECTED | 6 | Disconnected state.|
| CALL_STATUS_DISCONNECTING | 7 | Disconnecting state. |
| CALL_STATUS_IDLE | 8 | Idle state. |
## CallRestrictionInfo8+
Defines the call restriction information.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ------------ |
| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type.|
| password | string | Yes | Password. |
| mode | [CallRestrictionMode](#callrestrictionmode8) | Yes | Call restriction mode.|
## CallRestrictionMode8+
Enumerates call restriction modes.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ----------------------------- | ---- | ------------ |
| RESTRICTION_MODE_DEACTIVATION | 0 | Call restriction deactivated.|
| RESTRICTION_MODE_ACTIVATION | 1 | Call restriction activated.|
## CallEventOptions8+
Defines the call event options.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------ | ---- | -------------- |
| eventId | [CallAbilityEventId](#callabilityeventid8) | Yes | Call ability event ID.|
## CallAbilityEventId8+
Enumerates call ability event IDs.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ------------------------ | ---- | --------------- |
| EVENT_DIAL_NO_CARRIER | 1 | No available carrier during dialing. |
| EVENT_INVALID_FDN_NUMBER | 2 | Invalid FDN.|
## DialScene8+
Enumerates dialup scenarios.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| --------------- | ---- | ------------ |
| CALL_NORMAL | 0 | Common call. |
| CALL_PRIVILEGED | 1 | Privileged call. |
| CALL_EMERGENCY | 2 | Emergency call.|
## DialType8+
Enumerates dialup types.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| -------------------- | ---- | ---------------- |
| DIAL_CARRIER_TYPE | 0 | Carrier. |
| DIAL_VOICE_MAIL_TYPE | 1 | Voice mail.|
| DIAL_OTT_TYPE | 2 | OTT. |
## RejectMessageOptions7+
Defines options for the call rejection message.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | -------- |
| messageContent | string | Yes | Message content.|
## CallTransferResult8+
Defines the call transfer result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ---------------- |
| status | [TransferStatus](#transferstatus8) | Yes | Call transfer status. |
| number | string | Yes | Call transfer number. |
| startHour9+ | number | Yes | Hour in the start time.|
| startMinute9+ | number | Yes | Minute in the start time.|
| endHour9+ | number | Yes | Hour in the end time.|
| endMinute9+ | number | Yes | Minute in the end time.|
## CallWaitingStatus7+
Enumerates call waiting states.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| -------------------- | ---- | ------------ |
| CALL_WAITING_DISABLE | 0 | Call waiting disabled.|
| CALL_WAITING_ENABLE | 1 | Call waiting enabled.|
## RestrictionStatus8+
Enumerates call restriction states.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ------------------- | ---- | -------- |
| RESTRICTION_DISABLE | 0 | Call restriction disabled.|
| RESTRICTION_ENABLE | 1 | Call restriction enabled.|
## TransferStatus8+
Enumerates call transfer states.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ---------------- | ---- | -------- |
| TRANSFER_DISABLE | 0 | Call transfer disabled.|
| TRANSFER_ENABLE | 1 | Call transfer enabled.|
## DisconnectedDetails9+
Defines the cause of a call disconnection.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------ | ---- | --------------- |
| reason | [DisconnectedReason](#disconnectedreason8) | Yes | Cause of the call disconnection. |
| message | string | Yes | Message indicating the call disconnection.|
## DisconnectedReason8+
Enumerates causes of call disconnection.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ------------------------------------------------------------ | ---- | --------------------------------------- |
| UNASSIGNED_NUMBER | 1 | Unallocated (unassigned) number. |
| NO_ROUTE_TO_DESTINATION | 3 | No route to destination. |
| CHANNEL_UNACCEPTABLE | 6 | Channel unacceptable. |
| OPERATOR_DETERMINED_BARRING | 8 | Operator determined barring (ODB). |
| CALL_COMPLETED_ELSEWHERE9+ | 13 | Call completed elsewhere. |
| NORMAL_CALL_CLEARING | 16 | Normal call clearing. |
| USER_BUSY | 17 | User busy. |
| NO_USER_RESPONDING | 18 | No user responding. |
| USER_ALERTING_NO_ANSWER | 19 | User alerting, no answer. |
| CALL_REJECTED | 21 | Call rejected. |
| NUMBER_CHANGED | 22 | Number changed. |
| CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION9+ | 24 | Call rejected due to feature at the destination.|
| FAILED_PRE_EMPTION9+ | 25 | Failed preemption. |
| NON_SELECTED_USER_CLEARING9+ | 26 | Non-selected user clearing. |
| DESTINATION_OUT_OF_ORDER | 27 | Destination out of order. |
| INVALID_NUMBER_FORMAT | 28 | Invalid number format (incomplete number). |
| FACILITY_REJECTED9+ | 29 | Facility rejected. |
| RESPONSE_TO_STATUS_ENQUIRY9+ | 30 | Response to status enquiry. |
| NORMAL_UNSPECIFIED9+ | 31 | Normal, unspecified. |
| NO_CIRCUIT_CHANNEL_AVAILABLE9+ | 34 | No circuit/channel available. |
| NETWORK_OUT_OF_ORDER | 38 | Network fault. |
| TEMPORARY_FAILURE | 41 | Temporary failure. |
| SWITCHING_EQUIPMENT_CONGESTION9+ | 42 | Switching equipment congestion. |
| ACCESS_INFORMATION_DISCARDED9+ | 43 | Access information discarded. |
| REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE9+ | 44 | Requested circuit/channel unavailable |
| RESOURCES_UNAVAILABLE_UNSPECIFIED9+ | 47 | Resources unavailable, unspecified. |
| QUALITY_OF_SERVICE_UNAVAILABLE9+ | 49 | QoS unavailable. |
| REQUESTED_FACILITY_NOT_SUBSCRIBED9+ | 50 | Requested facility not subscribed. |
| INCOMING_CALLS_BARRED_WITHIN_THE_CUG9+ | 55 | Incoming calls barred within the CUG. |
| BEARER_CAPABILITY_NOT_AUTHORIZED9+ | 57 | Bearer capability not authorized. |
| BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE9+ | 58 | Bearer capability presently available. |
| SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED9+ | 63 | Service or option not available, unspecified. |
| BEARER_SERVICE_NOT_IMPLEMENTED9+ | 65 | Bearer service not implemented. |
| ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE9+ | 68 | ACM greater than or equal to the maximum value. |
| REQUESTED_FACILITY_NOT_IMPLEMENTED9+ | 69 | Requested facility not implemented. |
| ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE9+ | 70 | Only restricted digital information capability available. |
| SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED9+ | 79 | Service or option not implemented, unspecified. |
| INVALID_TRANSACTION_IDENTIFIER_VALUE9+ | 81 | Invalid transaction identifier value. |
| USER_NOT_MEMBER_OF_CUG9+ | 87 | User not member of CUG. |
| INCOMPATIBLE_DESTINATION9+ | 88 | Incompatible destination. |
| INVALID_TRANSIT_NETWORK_SELECTION9+ | 91 | Invalid transit network selection. |
| SEMANTICALLY_INCORRECT_MESSAGE9+ | 95 | Semantically incorrect message. |
| INVALID_MANDATORY_INFORMATION9+ | 96 | Invalid mandatory information. |
| MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED9+ | 97 | Message type non-existent or not implemented. |
| MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE9+ | 98 | Message type not compatible with protocol state. |
| INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED9+ | 99 | IE non-existent or not implemented. |
| CONDITIONAL_IE_ERROR9+ | 100 | Conditional IE error. |
| MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE9+ | 101 | Message not compatible with protocol state. |
| RECOVERY_ON_TIMER_EXPIRED9+ | 102 | Recovery on timer expiry. |
| PROTOCOL_ERROR_UNSPECIFIED9+ | 111 | Protocol error, unspecified. |
| INTERWORKING_UNSPECIFIED9+ | 127 | Interworking, unspecified. |
| CALL_BARRED9+ | 240 | Call barred. |
| FDN_BLOCKED9+ | 241 | FDN blocked. |
| IMSI_UNKNOWN_IN_VLR9+ | 242 | IMSI unknown in VLR. |
| IMEI_NOT_ACCEPTED9+ | 243 | IMEI not accepted. |
| DIAL_MODIFIED_TO_USSD9+ | 244 | Dial request modified to USSD request. |
| DIAL_MODIFIED_TO_SS9+ | 245 | Dial request modified to SS request. |
| DIAL_MODIFIED_TO_DIAL9+ | 246 | Dial request modified to dial with different number. |
| RADIO_OFF9+ | 247 | Radio off. |
| OUT_OF_SERVICE9+ | 248 | Out of service. |
| NO_VALID_SIM9+ | 249 | No valid SIM. |
| RADIO_INTERNAL_ERROR9+ | 250 | Radio internal error. |
| NETWORK_RESP_TIMEOUT9+ | 251 | Network response timeout. |
| NETWORK_REJECT9+ | 252 | Request rejected by network. |
| RADIO_ACCESS_FAILURE9+ | 253 | Radio access failure. |
| RADIO_LINK_FAILURE9+ | 254 | Radio link failure. |
| RADIO_LINK_LOST9+ | 255 | Radio link lost. |
| RADIO_UPLINK_FAILURE9+ | 256 | Radio uplink failure. |
| RADIO_SETUP_FAILURE9+ | 257 | Radio setup failure. |
| RADIO_RELEASE_NORMAL9+ | 258 | Radio release normal. |
| RADIO_RELEASE_ABNORMAL9+ | 259 | Radio release abnormal. |
| ACCESS_CLASS_BLOCKED9+ | 260 | Access class blocked. |
| NETWORK_DETACH9+ | 261 | Network detached. |
| INVALID_PARAMETER | 1025 | Invalid parameter. |
| SIM_NOT_EXIT | 1026 | SIM not exit. |
| SIM_PIN_NEED | 1027 | SIM PIN needed. |
| CALL_NOT_ALLOW | 1029 | Call not allowed. |
| SIM_INVALID | 1045 | No valid SIM. |
| UNKNOWN | 1279 | Unknown reason. |
## MmiCodeResults9+
Defines the MMI code result.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------- | -------------------------------- | ---- | --------------- |
| result | [MmiCodeResult](#mmicoderesult9) | Yes | MMI code result.|
| message | string | Yes | MMI code message.|
## MmiCodeResult9+
Enumerates MMI code results.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| ---------------- | ---- | ------------- |
| MMI_CODE_SUCCESS | 0 | Success.|
| MMI_CODE_FAILED | 1 | Failure.|
## AudioDeviceOptions9+
Defines audio device options.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ---------------- | ------ | ---- | -------- |
| bluetoothAddress | string | No | Bluetooth address.|