js-apis-call.md 106.1 KB
Newer Older
S
shawn_he 已提交
1 2
# Call

S
shawn_he 已提交
3 4 5 6 7
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**<br>
Z
zengyawen 已提交
8
>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.
S
shawn_he 已提交
9 10 11 12


## Modules to Import

S
shawn_he 已提交
13
```js
S
shawn_he 已提交
14 15 16
import call from '@ohos.telephony.call';
```

S
shawn_he 已提交
17
## call.dial
S
shawn_he 已提交
18 19 20

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

S
shawn_he 已提交
21
Initiates a call. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
22

S
shawn_he 已提交
23 24 25
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)

**System capability**: SystemCapability.Telephony.CallManager
S
shawn_he 已提交
26

S
shawn_he 已提交
27
**Parameters**
S
shawn_he 已提交
28

S
shawn_he 已提交
29 30 31
| Name     | Type                        | Mandatory | Description |
| ----------- | ---------------------------- | ---- | -------------------------------- |
| phoneNumber | string                        | Yes  | Phone number.  |
O
openharmony_ci 已提交
32
| callback    | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result.<br>- **true**: success<br>- **false**: failure |
S
shawn_he 已提交
33 34 35

**Example**

S
shawn_he 已提交
36
```js
S
shawn_he 已提交
37 38 39 40
call.dial("138xxxxxxxx", (err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
41 42


S
shawn_he 已提交
43
## call.dial
S
shawn_he 已提交
44 45 46

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

S
shawn_he 已提交
47
Initiates a call based on the specified options. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
48

S
shawn_he 已提交
49 50 51
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)

**System capability**: SystemCapability.Telephony.CallManager
S
shawn_he 已提交
52

S
shawn_he 已提交
53
**Parameters**
S
shawn_he 已提交
54

S
shawn_he 已提交
55
| Name     | Type                        | Mandatory | Description                             |
S
shawn_he 已提交
56
| ----------- | ---------------------------- | ---- | --------------------------------------- |
O
openharmony_ci 已提交
57
| phoneNumber | string                       | Yes  | Phone number.                           |
S
shawn_he 已提交
58
| options     | [DialOptions](#dialoptions)  | No  | Call option, which indicates whether the call is a voice call or video call. |
O
openharmony_ci 已提交
59
| callback    | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result.<br>- **true**: success<br>- **false**: failure |
S
shawn_he 已提交
60

S
shawn_he 已提交
61
**Example**
S
shawn_he 已提交
62

S
shawn_he 已提交
63
```js
S
shawn_he 已提交
64 65 66 67 68 69
call.dial("138xxxxxxxx", {
    extras: false
}, (err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
70 71


S
shawn_he 已提交
72
## call.dial
S
shawn_he 已提交
73 74 75

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

S
shawn_he 已提交
76
Initiates a call based on the specified options. This API uses a promise to return the result.
S
shawn_he 已提交
77

S
shawn_he 已提交
78 79 80
**Required permission**: ohos.permission.PLACE\_CALL (a system permission)

**System capability**: SystemCapability.Telephony.CallManager
S
shawn_he 已提交
81

S
shawn_he 已提交
82
**Parameters**
S
shawn_he 已提交
83

S
shawn_he 已提交
84
| Name     | Type                       | Mandatory | Description                            |
S
shawn_he 已提交
85
| ----------- | --------------------------- | ---- | -------------------------------------- |
O
openharmony_ci 已提交
86
| phoneNumber | string                      | Yes  | Phone number.                          |
S
shawn_he 已提交
87
| options     | [DialOptions](#dialoptions) | Yes  | Call option, which indicates whether the call is a voice call or video call. |
S
shawn_he 已提交
88

S
shawn_he 已提交
89
**Return value**
S
shawn_he 已提交
90

O
openharmony_ci 已提交
91 92 93
| Type                   | Description                                                       |
| ---------------------- | ---------------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.<br>- **true**: success<br>- **false**: failure |
S
shawn_he 已提交
94

S
shawn_he 已提交
95
**Example**
S
shawn_he 已提交
96

S
shawn_he 已提交
97
```js
S
shawn_he 已提交
98 99 100 101 102 103 104 105 106
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)}`);
});
```
S
shawn_he 已提交
107

S
shawn_he 已提交
108
## call.makeCall<sup>7+</sup>
S
shawn_he 已提交
109

S
shawn_he 已提交
110
makeCall(phoneNumber: string, callback: AsyncCallback\<void\>): void
S
shawn_he 已提交
111

S
shawn_he 已提交
112
Launches the call screen and displays the dialed number. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
113

S
shawn_he 已提交
114
**System capability**: SystemCapability.Applications.Contacts
S
shawn_he 已提交
115 116 117

**Parameters**

S
shawn_he 已提交
118
| Name     | Type                     | Mandatory | Description                                      |
S
shawn_he 已提交
119 120
| ----------- | ------------------------- | ---- | ------------------------------------------ |
| phoneNumber | string                    | Yes  | Phone number.                                |
S
shawn_he 已提交
121
| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result. |
S
shawn_he 已提交
122 123 124

**Example**

S
shawn_he 已提交
125
```js
S
shawn_he 已提交
126 127 128 129 130 131
call.makeCall("138xxxxxxxx", err => { 
    console.log(`makeCall callback: err->${JSON.stringify(err)}`); 
});
```


S
shawn_he 已提交
132
## call.makeCall<sup>7+</sup>
S
shawn_he 已提交
133

S
shawn_he 已提交
134
makeCall(phoneNumber: string): Promise\<void\>
S
shawn_he 已提交
135

S
shawn_he 已提交
136
Launches the call screen and displays the dialed number. This API uses a promise to return the result.
S
shawn_he 已提交
137

S
shawn_he 已提交
138
**System capability**: SystemCapability.Applications.Contacts
S
shawn_he 已提交
139 140 141

**Parameters**

S
shawn_he 已提交
142
| Name     | Type  | Mandatory | Description      |
S
shawn_he 已提交
143
| ----------- | ------ | ---- | ---------- |
S
shawn_he 已提交
144
| phoneNumber | string | Yes  | Phone number. |
S
shawn_he 已提交
145

S
shawn_he 已提交
146
**Return value**
S
shawn_he 已提交
147 148 149

| Type               | Description                             |
| ------------------- | --------------------------------- |
S
shawn_he 已提交
150
| Promise&lt;void&gt; | Promise used to return the result. |
S
shawn_he 已提交
151 152 153

**Example**

S
shawn_he 已提交
154
```js
S
shawn_he 已提交
155 156 157 158 159 160 161 162
let promise = call.makeCall("138xxxxxxxx"); 
promise.then(() => { 
    console.log(`makeCall success`); 
}).catch(err => { 
    console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); 
});
```

S
shawn_he 已提交
163
## call.hasCall
S
shawn_he 已提交
164 165 166

hasCall\(callback: AsyncCallback<boolean\>\): void

S
shawn_he 已提交
167
Checks whether a call is in progress. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
168

S
shawn_he 已提交
169 170
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
171
**Parameters**
S
shawn_he 已提交
172

S
shawn_he 已提交
173
| Name  | Type                        | Mandatory | Description                                                        |
S
shawn_he 已提交
174
| -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
175
| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. Callback used to return the result.<br>- **true**: A call is in progress.<br>- **false**: No call is in progress. |
S
shawn_he 已提交
176

S
shawn_he 已提交
177
**Example**
S
shawn_he 已提交
178

S
shawn_he 已提交
179
```js
S
shawn_he 已提交
180 181 182 183
call.hasCall((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
184 185


S
shawn_he 已提交
186
## call.hasCall
S
shawn_he 已提交
187 188 189

hasCall\(\): Promise<boolean\>

S
shawn_he 已提交
190
Checks whether a call is in progress. This API uses a promise to return the result.
S
shawn_he 已提交
191

S
shawn_he 已提交
192 193
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
194
**Return value**
S
shawn_he 已提交
195

S
shawn_he 已提交
196
| Type                  | Description                                   |
S
shawn_he 已提交
197
| ---------------------- | --------------------------------------- |
S
shawn_he 已提交
198
| Promise&lt;boolean&gt; | Promise used to return the result. |
S
shawn_he 已提交
199

S
shawn_he 已提交
200
**Example**
S
shawn_he 已提交
201

S
shawn_he 已提交
202
```js
S
shawn_he 已提交
203 204 205 206 207 208 209
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)}`);
});
```
S
shawn_he 已提交
210 211


S
shawn_he 已提交
212
## call.getCallState
S
shawn_he 已提交
213 214 215

getCallState\(callback: AsyncCallback<CallState\>\): void

S
shawn_he 已提交
216
Obtains the call status. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
217

S
shawn_he 已提交
218 219
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
220
**Parameters**
S
shawn_he 已提交
221

S
shawn_he 已提交
222
| Name  | Type                                        | Mandatory | Description                                |
S
shawn_he 已提交
223
| -------- | -------------------------------------------- | ---- | ------------------------------------ |
S
shawn_he 已提交
224
| callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes  | Callback used to return the result. |
S
shawn_he 已提交
225

S
shawn_he 已提交
226
**Example**
S
shawn_he 已提交
227

S
shawn_he 已提交
228
```js
S
shawn_he 已提交
229 230 231 232
call.getCallState((err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
233 234


S
shawn_he 已提交
235
## call.getCallState
S
shawn_he 已提交
236 237 238

getCallState\(\): Promise<CallState\>

S
shawn_he 已提交
239
Obtains the call status. This API uses a promise to return the result.
S
shawn_he 已提交
240

S
shawn_he 已提交
241 242
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
243
**Return value**
S
shawn_he 已提交
244

S
shawn_he 已提交
245 246
| Type                                  | Description                                   |
| -------------------------------------- | --------------------------------------- |
S
shawn_he 已提交
247
| Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result. |
S
shawn_he 已提交
248

S
shawn_he 已提交
249
**Example**
S
shawn_he 已提交
250

S
shawn_he 已提交
251
```js
S
shawn_he 已提交
252 253 254 255 256 257 258
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)}`);
});
```
S
shawn_he 已提交
259

S
shawn_he 已提交
260
## call.hasVoiceCapability<sup>7+</sup>
S
shawn_he 已提交
261 262 263

hasVoiceCapability(): boolean

S
shawn_he 已提交
264
Checks whether a device supports voice calls.
S
shawn_he 已提交
265 266 267

**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
268
**Return value**
S
shawn_he 已提交
269 270 271

| Type   | Description                                                        |
| ------- | ------------------------------------------------------------ |
S
shawn_he 已提交
272
| boolean | - **true**: The device supports voice calls.<br>- **false**: The device does not support voice calls. |
S
shawn_he 已提交
273

S
shawn_he 已提交
274
```js
S
shawn_he 已提交
275 276 277 278
let result = call.hasVoiceCapability(); 
console.log(`hasVoiceCapability: ${JSON.stringify(result)}`);
```

S
shawn_he 已提交
279
## call.isEmergencyPhoneNumber<sup>7+</sup>
S
shawn_he 已提交
280 281 282

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

S
shawn_he 已提交
283
Checks whether the called number is an emergency number. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
284

S
shawn_he 已提交
285 286
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
287
**Parameters**
S
shawn_he 已提交
288

S
shawn_he 已提交
289
| Name     | Type                        | Mandatory | Description                                                        |
S
shawn_he 已提交
290
| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
291
| phoneNumber | string                       | Yes  | Phone number.                                                  |
S
shawn_he 已提交
292
| callback    | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. |
S
shawn_he 已提交
293

S
shawn_he 已提交
294
**Example**
S
shawn_he 已提交
295

S
shawn_he 已提交
296
```js
S
shawn_he 已提交
297 298 299 300
call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
301 302


S
shawn_he 已提交
303
## call.isEmergencyPhoneNumber<sup>7+</sup>
S
shawn_he 已提交
304 305 306

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

S
shawn_he 已提交
307
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.
S
shawn_he 已提交
308

S
shawn_he 已提交
309 310
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
311
**Parameters**
S
shawn_he 已提交
312

S
shawn_he 已提交
313
| Name     | Type                                              | Mandatory | Description                                                       |
S
shawn_he 已提交
314 315
| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- |
| phoneNumber | string                                             | Yes  | Phone number.                                                 |
S
shawn_he 已提交
316
| options     | [EmergencyNumberOptions](#emergencynumberoptions7) | No  | Phone number options.        |
S
shawn_he 已提交
317
| callback    | AsyncCallback&lt;boolean&gt;                       | Yes  | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. |
S
shawn_he 已提交
318

S
shawn_he 已提交
319
**Example**
S
shawn_he 已提交
320

S
shawn_he 已提交
321
```js
S
shawn_he 已提交
322
call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => {
S
shawn_he 已提交
323 324 325
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
326 327


S
shawn_he 已提交
328
## call.isEmergencyPhoneNumber<sup>7+</sup>
S
shawn_he 已提交
329 330 331

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

S
shawn_he 已提交
332
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.
S
shawn_he 已提交
333

S
shawn_he 已提交
334 335
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
336
**Parameters**
S
shawn_he 已提交
337

S
shawn_he 已提交
338
| Name     | Type                                              | Mandatory | Description          |
S
shawn_he 已提交
339 340
| ----------- | -------------------------------------------------- | ---- | -------------- |
| phoneNumber | string                                             | Yes  | Phone number.    |
S
shawn_he 已提交
341
| options     | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes  | Phone number options. |
S
shawn_he 已提交
342

S
shawn_he 已提交
343
**Return value**
S
shawn_he 已提交
344

S
shawn_he 已提交
345
| Type                  | Description                                               |
S
shawn_he 已提交
346
| ---------------------- | --------------------------------------------------- |
S
shawn_he 已提交
347
| Promise&lt;boolean&gt; | Promise used to return the result. |
S
shawn_he 已提交
348

S
shawn_he 已提交
349
**Example**
S
shawn_he 已提交
350

S
shawn_he 已提交
351
```js
S
shawn_he 已提交
352 353 354 355 356 357 358
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)}`);
});
```
S
shawn_he 已提交
359

S
shawn_he 已提交
360
## call.formatPhoneNumber<sup>7+</sup>
S
shawn_he 已提交
361 362 363

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

S
shawn_he 已提交
364 365 366
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.
S
shawn_he 已提交
367

S
shawn_he 已提交
368 369
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
370
**Parameters**
S
shawn_he 已提交
371

S
shawn_he 已提交
372
| Name     | Type                       | Mandatory | Description                                |
S
shawn_he 已提交
373
| ----------- | --------------------------- | ---- | ------------------------------------ |
S
shawn_he 已提交
374
| phoneNumber | string                      | Yes  | Phone number.                          |
S
shawn_he 已提交
375
| callback    | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the result. |
S
shawn_he 已提交
376

S
shawn_he 已提交
377
**Example**
S
shawn_he 已提交
378

S
shawn_he 已提交
379
```js
S
shawn_he 已提交
380 381 382 383
call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
384

S
shawn_he 已提交
385
## call.formatPhoneNumber<sup>7+</sup>
S
shawn_he 已提交
386 387 388

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

S
shawn_he 已提交
389
Formats a phone number based on the specified formatting options. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
390

S
shawn_he 已提交
391 392
A formatted phone number is a standard numeric string, for example, 555 0100.

S
shawn_he 已提交
393 394
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
395
**Parameters**
S
shawn_he 已提交
396

S
shawn_he 已提交
397
| Name     | Type                                        | Mandatory | Description                                |
S
shawn_he 已提交
398 399
| ----------- | -------------------------------------------- | ---- | ------------------------------------ |
| phoneNumber | string                                       | Yes  | Phone number.                          |
S
shawn_he 已提交
400
| options     | [NumberFormatOptions](#numberformatoptions7) | No  | Number formatting options, for example, country code.              |
S
shawn_he 已提交
401
| callback    | AsyncCallback&lt;string&gt;                  | Yes  | Callback used to return the result. |
S
shawn_he 已提交
402

S
shawn_he 已提交
403
**Example**
S
shawn_he 已提交
404

S
shawn_he 已提交
405
```js
S
shawn_he 已提交
406
call.formatPhoneNumber("138xxxxxxxx", {
S
shawn_he 已提交
407 408 409 410 411
    countryCode: "CN"
}, (err, data) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
412 413


S
shawn_he 已提交
414
## call.formatPhoneNumber<sup>7+</sup>
S
shawn_he 已提交
415 416 417

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

S
shawn_he 已提交
418
Formats a phone number based on the specified formatting options. This API uses a promise to return the result.
S
shawn_he 已提交
419

S
shawn_he 已提交
420 421
A formatted phone number is a standard numeric string, for example, 555 0100.

S
shawn_he 已提交
422 423
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
424
**Parameters**
S
shawn_he 已提交
425

S
shawn_he 已提交
426
| Name     | Type                                        | Mandatory | Description                  |
S
shawn_he 已提交
427 428
| ----------- | -------------------------------------------- | ---- | ---------------------- |
| phoneNumber | string                                       | Yes  | Phone number.            |
S
shawn_he 已提交
429
| options     | [NumberFormatOptions](#numberformatoptions7) | Yes  | Number formatting options, for example, country code. |
S
shawn_he 已提交
430

S
shawn_he 已提交
431
**Return value**
S
shawn_he 已提交
432

S
shawn_he 已提交
433
| Type                 | Description                                       |
S
shawn_he 已提交
434
| --------------------- | ------------------------------------------- |
S
shawn_he 已提交
435
| Promise&lt;string&gt; | Promise used to return the result. |
S
shawn_he 已提交
436

S
shawn_he 已提交
437
**Example**
S
shawn_he 已提交
438

S
shawn_he 已提交
439
```js
S
shawn_he 已提交
440 441 442 443 444 445 446 447 448
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)}`);
});
```
S
shawn_he 已提交
449

S
shawn_he 已提交
450
## call.formatPhoneNumberToE164<sup>7+</sup>
S
shawn_he 已提交
451 452 453

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

S
shawn_he 已提交
454
Converts a phone number into the E.164 format. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
455 456 457

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.

S
shawn_he 已提交
458 459
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
460
**Parameters**
S
shawn_he 已提交
461

S
shawn_he 已提交
462
| Name     | Type                       | Mandatory | Description                                                 |
S
shawn_he 已提交
463
| ----------- | --------------------------- | ---- | ----------------------------------------------------- |
S
shawn_he 已提交
464 465
| phoneNumber | string                      | Yes  | Phone number.                                           |
| countryCode | string                      | Yes  | Country code, for example, **CN** (China). All country codes are supported.             |
S
shawn_he 已提交
466
| callback    | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the result. |
S
shawn_he 已提交
467

S
shawn_he 已提交
468
**Example**
S
shawn_he 已提交
469

S
shawn_he 已提交
470
```js
S
shawn_he 已提交
471
call.formatPhoneNumberToE164("138xxxxxxxx", "CN", (err, data) => {
S
shawn_he 已提交
472 473 474
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
S
shawn_he 已提交
475 476


S
shawn_he 已提交
477
## call.formatPhoneNumberToE164<sup>7+</sup>
S
shawn_he 已提交
478 479 480

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

S
shawn_he 已提交
481
Converts a phone number into the E.164 format. This API uses a promise to return the result.
S
shawn_he 已提交
482 483 484 485 486

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.

S
shawn_he 已提交
487 488
**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
489
**Parameters**
S
shawn_he 已提交
490

S
shawn_he 已提交
491
| Name     | Type  | Mandatory | Description                                    |
S
shawn_he 已提交
492
| ----------- | ------ | ---- | ---------------------------------------- |
S
shawn_he 已提交
493
| phoneNumber | string | Yes  | Phone number.                              |
S
shawn_he 已提交
494
| countryCode | string | Yes  | Country code, for example, **CN** (China). All country codes are supported. |
S
shawn_he 已提交
495

S
shawn_he 已提交
496
**Return value**
S
shawn_he 已提交
497

S
shawn_he 已提交
498
| Type                 | Description                                                        |
S
shawn_he 已提交
499
| --------------------- | ------------------------------------------------------------ |
S
shawn_he 已提交
500
| Promise&lt;string&gt; | Promise used to return the result. |
S
shawn_he 已提交
501

S
shawn_he 已提交
502
**Example**
S
shawn_he 已提交
503

S
shawn_he 已提交
504
```js
S
shawn_he 已提交
505
let promise = call.formatPhoneNumberToE164("138xxxxxxxx", "CN");
S
shawn_he 已提交
506 507 508 509 510 511
promise.then(data => {
    console.log(`formatPhoneNumberToE164 success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
    console.error(`formatPhoneNumberToE164 fail, promise: err->${JSON.stringify(err)}`);
});
```
S
shawn_he 已提交
512

S
shawn_he 已提交
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
## call.muteRinger<sup>8+</sup>

muteRinger\(callback: AsyncCallback<void\>\): 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&lt;void&gt; | 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.muteRinger<sup>8+</sup>

muteRinger\(\): Promise<void\>

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&lt;void&gt; | 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.answer<sup>7+</sup>

answer\(callId: number, callback: AsyncCallback<void\>\): 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&lt;void&gt; | 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.answer<sup>7+</sup>

answer(callId?: number\): Promise<void\>

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&lt;void&gt; | 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.hangup<sup>7+</sup>

S
shawn_he 已提交
634
hangup\(callId: number, callback: AsyncCallback<void\>\): void
S
shawn_he 已提交
635 636 637 638 639

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

This is a system API.

S
shawn_he 已提交
640 641
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
642 643 644 645 646 647
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description      |
| -------- | ------------------------- | ---- | ---------- |
S
shawn_he 已提交
648
| callId   | number                    | Yes  | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
S
shawn_he 已提交
649 650 651 652 653
| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|

**Example**

```js
S
shawn_he 已提交
654
call.hangup(1, (err, data) => {
S
shawn_he 已提交
655 656 657 658 659
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```


S
shawn_he 已提交
660
## call.answer<sup>9+</sup>
S
shawn_he 已提交
661

S
shawn_he 已提交
662
answer\(callback: AsyncCallback<void\>\): void
S
shawn_he 已提交
663

S
shawn_he 已提交
664
Answers a call.This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
665 666 667

This is a system API.

S
shawn_he 已提交
668 669
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
670 671 672 673 674 675 676 677 678 679 680
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description                                           |
| -------- | ------------------------- | ---- | ----------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                     |

**Example**

```js
S
shawn_he 已提交
681
call.answer((err, data) => {
S
shawn_he 已提交
682 683 684 685 686 687 688 689 690 691 692 693 694
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```


## call.hangup<sup>7+</sup>

hangup\(callId?: number\): Promise<void\>

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

This is a system API.

S
shawn_he 已提交
695 696
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721
**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&lt;void&gt; | 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)}`);
});
```

S
shawn_he 已提交
722
## call.hangup<sup>9+</sup>
S
shawn_he 已提交
723

S
shawn_he 已提交
724
hangup\(callback: AsyncCallback<void\>\): void
S
shawn_he 已提交
725

S
shawn_he 已提交
726
Ends a call. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
727 728 729

This is a system API.

S
shawn_he 已提交
730 731
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
732 733 734 735 736 737 738 739 740 741 742
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description      |
| -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|

**Example**

```js
S
shawn_he 已提交
743
call.hangup((err, data) => {
S
shawn_he 已提交
744 745 746 747 748 749 750
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```


## call.reject<sup>7+</sup>

S
shawn_he 已提交
751
reject(callId: number, callback: AsyncCallback\<void>): void
S
shawn_he 已提交
752 753 754 755 756

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

This is a system API.

S
shawn_he 已提交
757 758
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
759 760 761 762 763 764 765 766 767 768 769 770 771
**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&lt;void&gt; | Yes  | Callback used to return the result.                                     |


**Example**

```js
S
shawn_he 已提交
772
call.reject(1, (err, data) => {
W
sms  
w00636648 已提交
773
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
S
shawn_he 已提交
774 775 776 777 778
});
```

## call.reject<sup>7+</sup>

S
shawn_he 已提交
779
reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void\>\): void
S
shawn_he 已提交
780 781 782 783 784

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.

S
shawn_he 已提交
785 786
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816
**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&lt;void&gt;                      | 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.reject<sup>7+</sup>

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

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.

S
shawn_he 已提交
817 818
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847
**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&lt;void&gt; | 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)}`);
});
```

S
shawn_he 已提交
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906

## call.reject<sup>9+</sup>

reject\(callback: AsyncCallback<void\>\): 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&lt;void&gt; | 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.reject<sup>9+</sup>

reject\(options: RejectMessageOptions, callback: AsyncCallback<void\>\): 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&lt;void&gt;                      | 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)}`);
});
```


S
shawn_he 已提交
907 908 909 910 911 912 913 914
## call.holdCall<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
915 916
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description      |
| -------- | ------------------------- | ---- | ---------- |
| callId   | number                    | Yes  | Call ID.  |
| callback | AsyncCallback&lt;void&gt; | 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.holdCall<sup>7+</sup>

holdCall\(callId: number\): Promise<void\>

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

This is a system API.

S
shawn_he 已提交
943 944
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type  | Mandatory| Description    |
| ------ | ------ | ---- | -------- |
| callId | number | Yes  | Call ID.|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.unHoldCall<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
978 979
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description      |
| -------- | ------------------------- | ---- | ---------- |
| callId   | number                    | Yes  | Call ID.  |
| callback | AsyncCallback&lt;void&gt; | 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.unHoldCall<sup>7+</sup>

unHoldCall\(callId: number\): Promise<void\>

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

This is a system API.

S
shawn_he 已提交
1006 1007
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type  | Mandatory| Description    |
| ------ | ------ | ---- | -------- |
| callId | number | Yes  | Call ID.|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.switchCall<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1041 1042
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description      |
| -------- | ------------------------- | ---- | ---------- |
| callId   | number                    | Yes  | Call ID.  |
| callback | AsyncCallback&lt;void&gt; | 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.switchCall<sup>7+</sup>

switchCall\(callId: number\): Promise<void\>

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

This is a system API.

S
shawn_he 已提交
1069 1070
**Required permission**: ohos.permission.ANSWER_CALL

S
shawn_he 已提交
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type  | Mandatory| Description    |
| ------ | ------ | ---- | -------- |
| callId | number | Yes  | Call ID.|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.combineConference<sup>7+</sup>

combineConference\(callId: number, callback: AsyncCallback<void\>\): 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&lt;void&gt; | 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.combineConference<sup>7+</sup>

combineConference\(callId: number\): Promise<void\>

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&lt;void&gt; | 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.getMainCallId<sup>7+</sup>

getMainCallId\(callId: number, callback: AsyncCallback<number\>\): 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&lt;number&gt; | 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.getMainCallId<sup>7+</sup>

getMainCallId\(callId: number\): Promise<number\>

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&lt;void&gt; | 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.getSubCallIdList<sup>7+</sup>

getSubCallIdList\(callId: number, callback: AsyncCallback<Array<string\>\>\): 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<Array<string\>\> | 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.getSubCallIdList<sup>7+</sup>

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

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&lt;Array<string\>&gt; | 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.getCallIdListForConference<sup>7+</sup>

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

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

This is a system API.

**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                               | Mandatory| Description                            |
| -------- | ----------------------------------- | ---- | -------------------------------- |
| callId   | number                              | Yes  | Call ID.                        |
| callback | AsyncCallback&lt;Array<string\>&gt; | 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.getCallIdListForConference<sup>7+</sup>

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

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&lt;Array<string\>&gt; | 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.getCallWaitingStatus<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1340 1341
**Required permission**: ohos.permission.GET_TELEPHONY_STATE

S
shawn_he 已提交
1342 1343 1344 1345 1346 1347
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                                                       | Mandatory| Description                                                        |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
1348 1349
| slotId   | number                                                      | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2               |
| callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | Yes  | Callback used to return the result.<br>- **0**: Call waiting is disabled.<br>- **1**: Call waiting is enabled.|
S
shawn_he 已提交
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367

**Example**

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


## call.getCallWaitingStatus<sup>7+</sup>

getCallWaitingStatus\(slotId: number\): Promise<CallWaitingStatus\>

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

This is a system API.

S
shawn_he 已提交
1368 1369
**Required permission**: ohos.permission.GET_TELEPHONY_STATE

S
shawn_he 已提交
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type  | Mandatory| Description                                  |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|

**Return value**

| Type                                                   | Description                                                        |
| ------------------------------------------------------- | ------------------------------------------------------------ |
| Promise&lt;[CallWaitingStatus](#callwaitingstatus7)&gt; | Promise used to return the result.<br>- **0**: Call waiting is disabled.<br>- **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.setCallWaiting<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1403 1404
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                | Mandatory| Description                                                        |
| -------- | -------------------- | ---- | ------------------------------------------------------------ |
| slotId   | number               | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2                      |
| activate | boolean              | Yes  | Whether to enable call waiting.<br>- **false**: Disable call waiting.<br>- **true**: Enable call waiting.|
| callback | AsyncCallback<void\> | 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.setCallWaiting<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1432 1433
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type   | Mandatory| Description                                                        |
| -------- | ------- | ---- | ------------------------------------------------------------ |
| slotId   | number  | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2                      |
| activate | boolean | Yes  | Whether to enable call waiting.<br>- **false**: Disable call waiting.<br>- **true**: Enable call waiting.|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.startDTMF<sup>7+</sup>

startDTMF\(callId: number, character: string, callback: AsyncCallback<void\>\): 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<void\> | 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.startDTMF<sup>7+</sup>

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

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&lt;void&gt; | 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.stopDTMF<sup>7+</sup>

stopDTMF\(callId: number, callback: AsyncCallback<void\>\): 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&lt;void&gt; | 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.stopDTMF<sup>7+</sup>

stopDTMF\(callId: number\): Promise<void\>

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&lt;void&gt; | 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.isInEmergencyCall<sup>7+</sup>

isInEmergencyCall\(callback: AsyncCallback<boolean\>\): 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&lt;boolean&gt; | 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.isInEmergencyCall<sup>7+</sup>

isInEmergencyCall\(\): Promise<boolean\>

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&lt;boolean&gt; | 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')<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1644 1645
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657
**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
S
shawn_he 已提交
1658 1659
call.on('callDetailsChange', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670
});
```

## call.on('callEventChange')<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1671 1672
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
**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
S
shawn_he 已提交
1685 1686
call.on('callEventChange', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697
});
```

## call.on('callDisconnectedCause')<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1698 1699
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                                                  | Mandatory| Description                      |
| -------- | ------------------------------------------------------ | ---- | -------------------------- |
| type     | string                                                 | Yes  | Cause of the call disconnection.|
| callback | Callback<[DisconnectedDetails](#disconnecteddetails8)> | Yes  | Callback used to return the result.                |

**Example**

```js
S
shawn_he 已提交
1712 1713
call.on('callDisconnectedCause', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724
});
```

## call.on('mmiCodeResult')<sup>9+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1725 1726
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738
**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
S
shawn_he 已提交
1739 1740
call.on('mmiCodeResult', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751
});
```

## call.off('callDetailsChange')<sup>7+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1752 1753
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765
**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
S
shawn_he 已提交
1766 1767
call.off('callDetailsChange', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778
});
```

## call.off('callEventChange')<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1779 1780
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792
**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
S
shawn_he 已提交
1793 1794
call.off('callEventChange', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805
});
```

## call.off('callDisconnectedCause')<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1806 1807
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819
**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](#disconnecteddetails8)> | No  | Callback used to return the result.          |

**Example**

```js
S
shawn_he 已提交
1820 1821
call.off('callDisconnectedCause', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832
});
```

## call.off('mmiCodeResult')<sup>9+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1833 1834
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846
**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
S
shawn_he 已提交
1847 1848
call.off('mmiCodeResult', data => {
    console.log(`callback: data->${JSON.stringify(data)}`);
S
shawn_he 已提交
1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907
});
```

## call.isNewCallAllowed<sup>8+</sup>

isNewCallAllowed\(callback: AsyncCallback<boolean\>\): 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&lt;boolean&gt; | 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.isNewCallAllowed<sup>8+</sup>

isNewCallAllowed\(\): Promise<boolean\>

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&lt;boolean&gt; | 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.separateConference<sup>8+</sup>

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

S
shawn_he 已提交
1908
Separates a conference call. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933

This is a system API.

**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description      |
| -------- | ------------------------- | ---- | ---------- |
| callId   | number                    | Yes  | Call ID.  |
| callback | AsyncCallback&lt;void&gt; | 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.separateConference<sup>8+</sup>

separateConference\(callId: number\): Promise<void\>

S
shawn_he 已提交
1934
Separates a conference call. This API uses a promise to return the result.
S
shawn_he 已提交
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970

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&lt;void&gt; | 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.getCallRestrictionStatus<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
1971 1972
**Required permission**: ohos.permission.GET_TELEPHONY_STATE

S
shawn_he 已提交
1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                                                        | Mandatory| Description                                  |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId   | number                                                       | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| type     | [CallRestrictionType](#callrestrictiontype8)                 | Yes  | Call restriction type.                       |
| callback | AsyncCallback&lt;[RestrictionStatus](#restrictionstatus8)&gt; | 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.getCallRestrictionStatus<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2000 2001
**Required permission**: ohos.permission.GET_TELEPHONY_STATE

S
shawn_he 已提交
2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type                                        | Mandatory| Description                                  |
| ------ | -------------------------------------------- | ---- | -------------------------------------- |
| slotId | number                                       | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| type   | [CallRestrictionType](#callrestrictiontype8) | Yes  | Call restriction type.                       |

**Return value**

| Type                                                   | Description                       |
| ------------------------------------------------------- | --------------------------- |
| Promise&lt;[RestrictionStatus](#restrictionstatus8)&gt; | 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.setCallRestriction<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2036 2037
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                                       | Mandatory| Description                                  |
| -------- | ------------------------------------------- | ---- | -------------------------------------- |
| slotId   | number                                      | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| info     | [CallRestrictionInfo](#callrestrictioninfo8) | Yes  | Call restriction information.                        |
| callback | AsyncCallback&lt;void&gt;                   | 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.setCallRestriction<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2070 2071
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type                                        | Mandatory| Description                                  |
| ------ | -------------------------------------------- | ---- | -------------------------------------- |
| slotId | number                                       | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| info   | [CallRestrictionInfo](#callrestrictioninfo8) | Yes  | Call restriction information.                        |

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.getCallTransferInfo<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2111 2112
**Required permission**: ohos.permission.GET_TELEPHONY_STATE

S
shawn_he 已提交
2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                                                        | Mandatory| Description                                  |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId   | number                                                       | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| type     | [CallTransferType](#calltransfertype8)                       | Yes  | Call transfer type.                        |
| callback | AsyncCallback&lt;[CallTransferResult](#calltransferresult8)&gt; | 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.getCallTransferInfo<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2140 2141
**Required permission**: ohos.permission.GET_TELEPHONY_STATE

S
shawn_he 已提交
2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type                                  | Mandatory| Description                                  |
| ------ | -------------------------------------- | ---- | -------------------------------------- |
| slotId | number                                 | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| type   | [CallTransferType](#calltransfertype8) | Yes  | Call transfer type.                        |

**Return value**

| Type                                                     | Description                       |
| --------------------------------------------------------- | --------------------------- |
| Promise&lt;[CallTransferResult](#calltransferresult8)&gt; | Promise used to return the result.|

**Example**

```js
S
shawn_he 已提交
2160
let promise = call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY);
S
shawn_he 已提交
2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175
promise.then(data => {
    console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
    console.error(`getCallTransferInfo fail, promise: err->${JSON.stringify(err)}`);
});
```

## call.setCallTransfer<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2176 2177
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                                 | Mandatory| Description                                  |
| -------- | ------------------------------------- | ---- | -------------------------------------- |
| slotId   | number                                | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| info     | [CallTransferInfo](#calltransferinfo8) | Yes  | Call transfer information.                       |
| callback | AsyncCallback&lt;void&gt;             | 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.setCallTransfer<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2210 2211
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type                                 | Mandatory| Description                                  |
| ------ | ------------------------------------- | ---- | -------------------------------------- |
| slotId | number                                | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| info   | [CallTransferInfo](#calltransferinfo8) | Yes  | Call transfer information.                       |

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.isRinging<sup>8+</sup>

isRinging\(callback: AsyncCallback<boolean\>\): 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&lt;boolean&gt; | 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.isRinging<sup>8+</sup>

isRinging\(\): Promise<boolean\>

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&lt;boolean&gt; | 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.setMuted<sup>8+</sup>

setMuted\(callback: AsyncCallback<void\>\): 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&lt;void&gt; | 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.setMuted<sup>8+</sup>

setMuted\(\): Promise<void\>

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&lt;void&gt; | 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.cancelMuted<sup>8+</sup>

cancelMuted(callback: AsyncCallback<void\>): 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&lt;void&gt; | 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.cancelMuted<sup>8+</sup>

cancelMuted(): Promise<void\>

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&lt;void&gt; | 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)}`);
});
```

S
shawn_he 已提交
2403
## call.setAudioDevice<sup>9+</sup>
S
shawn_he 已提交
2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428

setAudioDevice\(device: AudioDevice, callback: AsyncCallback<void\>\): 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&lt;void&gt;    | 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)}`);
});
```


S
shawn_he 已提交
2429
## call.setAudioDevice<sup>9+</sup>
S
shawn_he 已提交
2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452

setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback<void\>\): 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&lt;void&gt;                  | Yes  | Callback used to return the result.    |

**Example**

```js
let audioDeviceOptions={
    bluetoothAddress: "IEEE 802-2014"
}
S
shawn_he 已提交
2453
call.setAudioDevice(1, audioDeviceOptions, (err, data) => {
S
shawn_he 已提交
2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```


## call.setAudioDevice<sup>8+</sup>

setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise<void\>

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&lt;void&gt; | 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.joinConference<sup>8+</sup>

joinConference(mainCallId: number, callNumberList: Array<string\>, callback: AsyncCallback<void\>): 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<string\>            | Yes  | List of call numbers.|
| callback       | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.     |

**Example**

```js
S
shawn_he 已提交
2517 2518 2519 2520
let callNumberList: Array<string> = [
    "138XXXXXXXX"
];
call.joinConference(1, callNumberList, (err, data) => {
S
shawn_he 已提交
2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```

## call.joinConference<sup>8+</sup>

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

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<string\> | Yes  | List of call numbers.|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|

**Example**

```js
S
shawn_he 已提交
2551 2552 2553 2554
let callNumberList: Array<string> = [
    "138XXXXXXXX"
];
let promise = call.joinConference(1, callNumberList);
S
shawn_he 已提交
2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629
promise.then(data => {
    console.log(`joinConference success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
    console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`);
});
```

## call.updateImsCallMode<sup>8+</sup>

updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback<void\>): 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&lt;void&gt;    | 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.updateImsCallMode<sup>8+</sup>

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

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&lt;void&gt; | 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.enableImsSwitch<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2630 2631
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description                                  |
| -------- | ------------------------- | ---- | -------------------------------------- |
| slotId   | number                    | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;void&gt; | 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.enableImsSwitch<sup>8+</sup>

enableImsSwitch(slotId: number): Promise<void\>

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

This is a system API.

S
shawn_he 已提交
2657 2658
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type  | Mandatory| Description                                  |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.disableImsSwitch<sup>8+</sup>

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

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

This is a system API.

S
shawn_he 已提交
2692 2693
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name  | Type                     | Mandatory| Description                                  |
| -------- | ------------------------- | ---- | -------------------------------------- |
| slotId   | number                    | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;void&gt; | 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.disableImsSwitch<sup>8+</sup>

disableImsSwitch(slotId: number): Promise<void\>

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

This is a system API.

S
shawn_he 已提交
2719 2720
**Required permission**: ohos.permission.SET_TELEPHONY_STATE

S
shawn_he 已提交
2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804
**System capability**: SystemCapability.Telephony.CallManager

**Parameters**

| Name| Type  | Mandatory| Description                                  |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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.isImsSwitchEnabled<sup>8+</sup>

isImsSwitchEnabled(slotId: number, callback: AsyncCallback<boolean\>): 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.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;boolean&gt; | 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.isImsSwitchEnabled<sup>8+</sup>

isImsSwitchEnabled(slotId: number): Promise<boolean\>

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.<br>- **0**: card slot 1<br>- **1**: card slot 2|

**Return value**

| Type               | Description                       |
| ------------------- | --------------------------- |
| Promise&lt;void&gt; | 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)}`);
});
```


S
shawn_he 已提交
2805
## DialOptions
S
shawn_he 已提交
2806

S
shawn_he 已提交
2807
Defines the dialup options.
S
shawn_he 已提交
2808 2809 2810

**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
2811 2812 2813
| Name                  | Type                              | Mandatory| Description                                                        |
| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ |
| extras                   | boolean                            | No  | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call|
S
shawn_he 已提交
2814
| accountId <sup>8+</sup>  | number                             | No  | Account ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>This is a system API.         |
S
shawn_he 已提交
2815 2816 2817
| videoState <sup>8+</sup> | [VideoStateType](#videostatetype7) | No  | Video state type. This is a system API.                            |
| dialScene <sup>8+</sup>  | [DialScene](#dialscene8)           | No  | Dialup scenario. This is a system API.                                |
| dialType <sup>8+</sup>   | [DialType](#dialtype8)             | No  | Dialup type. This is a system API.                                |
S
shawn_he 已提交
2818

S
shawn_he 已提交
2819
## CallState
S
shawn_he 已提交
2820 2821

Enumerates call states.
S
shawn_he 已提交
2822

S
shawn_he 已提交
2823 2824 2825
**System capability**: SystemCapability.Telephony.CallManager

| Name              | Value  | Description                                                        |
S
shawn_he 已提交
2826
| ------------------ | ---- | ------------------------------------------------------------ |
S
shawn_he 已提交
2827 2828 2829
| 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.                                    |
S
shawn_he 已提交
2830
| CALL_STATE_OFFHOOK | 2    | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. |
S
shawn_he 已提交
2831

S
shawn_he 已提交
2832
## EmergencyNumberOptions<sup>7+</sup>
S
shawn_he 已提交
2833

S
shawn_he 已提交
2834
Defines options for determining whether a number is an emergency number.
S
shawn_he 已提交
2835 2836 2837

**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
2838
| Name| Type  | Mandatory | Description                                          |
S
shawn_he 已提交
2839 2840
| ------ | ------ | ---- | ---------------------------------------------- |
| slotId | number | No  | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
S
shawn_he 已提交
2841

S
shawn_he 已提交
2842
## NumberFormatOptions<sup>7+</sup>
S
shawn_he 已提交
2843

S
shawn_he 已提交
2844
Defines the number formatting options.
S
shawn_he 已提交
2845 2846 2847

**System capability**: SystemCapability.Telephony.CallManager

S
shawn_he 已提交
2848
| Name     | Type  | Mandatory | Description                                                      |
S
shawn_he 已提交
2849
| ----------- | ------ | ---- | ---------------------------------------------------------- |
S
shawn_he 已提交
2850
| countryCode | string | No  | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. |
S
shawn_he 已提交
2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877

## ImsCallMode<sup>8+</sup>

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.      |

## AudioDevice<sup>8+</sup>

Enumerates audio devices.

This is a system API.

**System capability**: SystemCapability.Telephony.CallManager

| Name                | Value  | Description        |
| -------------------- | ---- | ------------ |
S
shawn_he 已提交
2878 2879 2880
| DEVICE_EARPIECE      | 0    | Earpiece.    |
| DEVICE_SPEAKER       | 1    | Speaker.|
| DEVICE_WIRED_HEADSET | 2    | Wired headset.|
S
shawn_he 已提交
2881
| DEVICE_BLUETOOTH_SCO | 3    | Bluetooth SCO device. |
S
shawn_he 已提交
2882
| DEVICE_MIC           | 4    | Microphone. |
S
shawn_he 已提交
2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242

## CallRestrictionType<sup>8+</sup>

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.              |

## CallTransferInfo<sup>8+</sup>

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.|

## CallTransferType<sup>8+</sup>

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.|

## CallTransferSettingType<sup>8+</sup>

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.|

## CallAttributeOptions<sup>7+</sup>

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.      |

## ConferenceState<sup>7+</sup>

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.|

## CallType<sup>7+</sup>

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.|

## VideoStateType<sup>7+</sup>

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.|

## DetailedCallState<sup>7+</sup>

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.  |

## CallRestrictionInfo<sup>8+</sup>

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.|

## CallRestrictionMode<sup>8+</sup>

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.|

## CallEventOptions<sup>8+</sup>

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.|

## CallAbilityEventId<sup>8+</sup>

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.|

## DialScene<sup>8+</sup>

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.|

## DialType<sup>8+</sup>

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.     |

## RejectMessageOptions<sup>7+</sup>

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.|

## CallTransferResult<sup>8+</sup>

Defines the call transfer result.

This is a system API.

**System capability**: SystemCapability.Telephony.CallManager

| Name| Type                              | Mandatory| Description    |
| ------ | ---------------------------------- | ---- | -------- |
| status | [TransferStatus](#transferstatus8) | Yes  | Transfer status.|
| number | string                             | Yes  | Number.    |

## CallWaitingStatus<sup>7+</sup>

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.|

## RestrictionStatus<sup>8+</sup>

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.|

## TransferStatus<sup>8+</sup>

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.|

## DisconnectedDetails<sup>8+</sup>

Enumerates causes of call disconnection.

This is a system API.

**System capability**: SystemCapability.Telephony.CallManager

| Name                       | Value  | Description                  |
| --------------------------- | ---- | ---------------------- |
| UNASSIGNED_NUMBER           | 1    | Unallocated number.    |
| NO_ROUTE_TO_DESTINATION     | 3    | No route to the destination.      |
| CHANNEL_UNACCEPTABLE        | 6    | Unacceptable channel.        |
| OPERATOR_DETERMINED_BARRING | 8    | Operator determined barring (ODB).            |
| NORMAL_CALL_CLEARING        | 16   | Normal call clearing.          |
| USER_BUSY                   | 17   | User busy.                |
| NO_USER_RESPONDING          | 18   | No user response.            |
| USER_ALERTING_NO_ANSWER     | 19   | Alerting but no answer.|
| CALL_REJECTED               | 21   | Call rejected.              |
| NUMBER_CHANGED              | 22   | Number changed.              |
| DESTINATION_OUT_OF_ORDER    | 27   | Destination fault.              |
| INVALID_NUMBER_FORMAT       | 28   | Invalid number format.          |
| NETWORK_OUT_OF_ORDER        | 38   | Network fault.              |
| TEMPORARY_FAILURE           | 41   | Temporary fault.              |
| INVALID_PARAMETER           | 1025 | Invalid parameter.              |
| SIM_NOT_EXIT                | 1026 | SIM card not exit.           |
| SIM_PIN_NEED                | 1027 | SIM card PIN required.        |
| CALL_NOT_ALLOW              | 1029 | Call not allowed.            |
| SIM_INVALID                 | 1045 | Invalid SIM card.             |
| UNKNOWN                     | 1279 | Unknown reason.              |

## MmiCodeResults<sup>9+</sup>

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.|

## MmiCodeResult<sup>9+</sup>

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.|

## AudioDeviceOptions<sup>9+</sup>

Defines audio device options.

This is a system API.

**System capability**: SystemCapability.Telephony.CallManager

| Name            | Type  | Mandatory| Description    |
| ---------------- | ------ | ---- | -------- |
| bluetoothAddress | string | No  | Bluetooth address.|