1# @ohos.telephony.call (Call) 2 3The **call** module provides call management functions, including making calls, redirecting to the dial screen, obtaining the call status, and formatting phone numbers. 4 5To subscribe to call status changes, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange). 6 7>**NOTE** 8> 9>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. 10 11## Modules to Import 12 13```ts 14import call from '@ohos.telephony.call'; 15``` 16 17 18## call.dial<sup>(deprecated)</sup> 19 20dial\(phoneNumber: string, callback: AsyncCallback\<boolean\>\): void 21 22Initiates a call. This API uses an asynchronous callback to return the result. 23 24> **NOTE** 25> 26> This API is supported since API version 6 and deprecated since API version 9. The substitute API is available only for system applications. 27 28**Required Permissions**: ohos.permission.PLACE_CALL 29 30**System capability**: SystemCapability.Telephony.CallManager 31 32**Parameters** 33 34| Name | Type | Mandatory| Description | 35| ----------- | ---------------------------- | ---- | --------------------------------------- | 36| phoneNumber | string | Yes | Phone number. | 37| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.| 38 39**Example** 40 41```ts 42import { BusinessError } from '@ohos.base'; 43 44call.dial("138xxxxxxxx", (err: BusinessError, data: boolean) => { 45 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 46}); 47``` 48 49 50## call.dial<sup>(deprecated)</sup> 51 52dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\<boolean\>\): void 53 54Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. 55 56> **NOTE** 57> 58> This API is supported since API version 6 and deprecated since API version 9. The substitute API is available only for system applications. 59 60**Required Permissions**: ohos.permission.PLACE_CALL 61 62**System capability**: SystemCapability.Telephony.CallManager 63 64**Parameters** 65 66| Name | Type | Mandatory| Description | 67| ----------- | ---------------------------- | ---- | --------------------------------------- | 68| phoneNumber | string | Yes | Phone number. | 69| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | 70| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.| 71 72**Example** 73 74```ts 75import { BusinessError } from '@ohos.base'; 76 77let dialOptions: call.DialOptions = { 78 extras: false 79} 80call.dial("138xxxxxxxx", dialOptions, (err: BusinessError, data: boolean) => { 81 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 82}); 83``` 84 85## call.dial<sup>(deprecated)</sup> 86 87dial\(phoneNumber: string, options?: DialOptions\): Promise\<boolean\> 88 89Initiates a call. You can set call options as needed. This API uses a promise to return the result. 90 91> **NOTE** 92> 93> This API is supported since API version 6 and deprecated since API version 9. The substitute API is available only for system applications. 94 95**Required Permissions**: ohos.permission.PLACE_CALL 96 97**System capability**: SystemCapability.Telephony.CallManager 98 99**Parameters** 100 101| Name | Type | Mandatory| Description | 102| ----------- | --------------------------- | ---- | -------------------------------------- | 103| phoneNumber | string | Yes | Phone number. | 104| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call.| 105 106**Return value** 107 108| Type | Description | 109| ---------------------- | ------------------------------------------------------------ | 110| Promise<boolean> | Promise used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.| 111 112**Example** 113 114```ts 115import { BusinessError } from '@ohos.base'; 116 117let dialOptions: call.DialOptions = { 118 extras: false 119} 120call.dial("138xxxxxxxx", dialOptions).then((data: boolean) => { 121 console.log(`dial success, promise: data->${JSON.stringify(data)}`); 122}).catch((err: BusinessError) => { 123 console.error(`dial fail, promise: err->${JSON.stringify(err)}`); 124}); 125``` 126 127## call.makeCall<sup>7+</sup> 128 129makeCall\(phoneNumber: string, callback: AsyncCallback\<void\>\): void 130 131Launches the call screen and displays the dialed number. This API uses an asynchronous callback to return the result. 132 133**System capability**: SystemCapability.Applications.Contacts 134 135**Parameters** 136 137| Name | Type | Mandatory| Description | 138| ----------- | ------------------------- | ---- | ------------------------------------------ | 139| phoneNumber | string | Yes | Phone number. | 140| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 141 142**Error codes** 143 144For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 145 146| ID| Error Message | 147| -------- | -------------------------------------------- | 148| 401 | Parameter error. | 149| 8300001 | Invalid parameter value. | 150| 8300002 | Operation failed. Cannot connect to service. | 151| 8300003 | System internal error. | 152| 8300999 | Unknown error code. | 153 154**Example** 155 156```ts 157import { BusinessError } from '@ohos.base'; 158 159call.makeCall("138xxxxxxxx", (err: BusinessError) => { 160 if (err) { 161 console.error(`makeCall fail, err->${JSON.stringify(err)}`); 162 } else { 163 console.log(`makeCall success`); 164 } 165}); 166``` 167 168 169## call.makeCall<sup>7+</sup> 170 171makeCall\(phoneNumber: string\): Promise\<void\> 172 173Launches the call screen and displays the dialed number. This API uses a promise to return the result. 174 175**System capability**: SystemCapability.Applications.Contacts 176 177**Parameters** 178 179| Name | Type | Mandatory| Description | 180| ----------- | ------ | ---- | ---------- | 181| phoneNumber | string | Yes | Phone number.| 182 183**Return value** 184 185| Type | Description | 186| ------------------- | --------------------------------- | 187| Promise<void> | Promise used to return the result.| 188 189**Error codes** 190 191For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 192 193| ID| Error Message | 194| -------- | -------------------------------------------- | 195| 401 | Parameter error. | 196| 8300001 | Invalid parameter value. | 197| 8300002 | Operation failed. Cannot connect to service. | 198| 8300003 | System internal error. | 199| 8300999 | Unknown error code. | 200 201**Example** 202 203```ts 204import { BusinessError } from '@ohos.base'; 205 206call.makeCall("138xxxxxxxx").then(() => { 207 console.log(`makeCall success`); 208}).catch((err: BusinessError) => { 209 console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); 210}); 211``` 212 213## call.hasCall 214 215hasCall\(callback: AsyncCallback\<boolean\>\): void 216 217Checks whether a call is in progress. This API uses an asynchronous callback to return the result. 218 219**System capability**: SystemCapability.Telephony.CallManager 220 221**Parameters** 222 223| Name | Type | Mandatory| Description | 224| -------- | ---------------------------- | ---- | ------------------------------------------------------------ | 225| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that a call is in progress, and the value **false** indicates the opposite.| 226 227**Example** 228 229```ts 230import { BusinessError } from '@ohos.base'; 231 232call.hasCall((err: BusinessError, data: boolean) => { 233 if (err) { 234 console.error(`hasCall fail, err->${JSON.stringify(err)}`); 235 } else { 236 console.log(`hasCall success, data->${JSON.stringify(data)}`); 237 } 238}); 239``` 240 241 242## call.hasCall 243 244hasCall\(\): Promise\<boolean\> 245 246Checks whether a call is in progress. This API uses a promise to return the result. 247 248**System capability**: SystemCapability.Telephony.CallManager 249 250**Return value** 251 252| Type | Description | 253| ---------------------- | --------------------------------------- | 254| Promise<boolean> | Promise used to return the result. The value **true** indicates that a call is in progress, and the value **false** indicates the opposite.| 255 256**Example** 257 258```ts 259import { BusinessError } from '@ohos.base'; 260 261call.hasCall().then(() => { 262 console.log(`hasCall success`); 263}).catch((err: BusinessError) => { 264 console.error(`hasCall fail, promise: err->${JSON.stringify(err)}`); 265}); 266``` 267 268## call.hasCallSync<sup>10+</sup> 269 270hasCallSync\(\): boolean 271 272Checks whether a call is in progress. 273 274**System capability**: SystemCapability.Telephony.CallManager 275 276**Return value** 277 278| Type | Description | 279| ---------------------- |-------------| 280| boolean | Promise used to return the result. The value **true** indicates that a call is in progress, and the value **false** indicates the opposite.| 281 282**Example** 283 284```ts 285let hasCall: boolean = call.hasCallSync(); 286console.log(`hasCallSync success, has call is ` + hasCall); 287``` 288 289 290## call.getCallState 291 292getCallState\(callback: AsyncCallback\<CallState\>\): void 293 294Obtains the call status. This API uses an asynchronous callback to return the result. 295 296**System capability**: SystemCapability.Telephony.CallManager 297 298**Parameters** 299 300| Name | Type | Mandatory| Description | 301| -------- | -------------------------------------------- | ---- | ------------------------------------ | 302| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result.| 303 304**Example** 305 306```ts 307import { BusinessError } from '@ohos.base'; 308 309call.getCallState((err: BusinessError, data: call.CallState) => { 310 if (err) { 311 console.error(`getCallState fail, err->${JSON.stringify(err)}`); 312 } else { 313 console.log(`getCallState success, data->${JSON.stringify(data)}`); 314 } 315}); 316``` 317 318 319## call.getCallState 320 321getCallState\(\): Promise\<CallState\> 322 323Obtains the call status. This API uses a promise to return the result. 324 325**System capability**: SystemCapability.Telephony.CallManager 326 327**Return value** 328 329| Type | Description | 330| -------------------------------------- | --------------------------------------- | 331| Promise<[CallState](#callstate)> | Promise used to return the result.| 332 333**Example** 334 335```ts 336import { BusinessError } from '@ohos.base'; 337 338call.getCallState().then((data: call.CallState) => { 339 console.log(`getCallState success, promise: data->${JSON.stringify(data)}`); 340}).catch((err: BusinessError) => { 341 console.error(`getCallState fail, promise: err->${JSON.stringify(err)}`); 342}); 343``` 344 345## call.getCallStateSync<sup>10+</sup> 346 347getCallStateSync\(\): CallState 348 349Obtains the call status. 350 351**System capability**: SystemCapability.Telephony.CallManager 352 353**Return value** 354 355| Type | Description | 356| ------------------------------------- |-------------| 357| [CallState](#callstate) | Promise used to return the result.| 358 359**Example** 360 361```ts 362let callState: call.CallState = call.getCallStateSync(); 363console.log(`the call state is:` + callState); 364``` 365 366## call.hasVoiceCapability<sup>7+</sup> 367 368hasVoiceCapability\(\): boolean 369 370Checks whether a device supports voice calls. 371 372**System capability**: SystemCapability.Telephony.CallManager 373 374**Return value** 375 376| Type | Description | 377| ------- | ------------------------------------------------------------ | 378| boolean | Result indicating whether the device supports voice calls. The value **true** indicates yes, and the value **false** indicates no.| 379 380```ts 381let result: boolean = call.hasVoiceCapability(); 382console.log(`hasVoiceCapability: ${JSON.stringify(result)}`); 383``` 384 385## call.isEmergencyPhoneNumber<sup>7+</sup> 386 387isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\<boolean\>\): void 388 389Checks whether the called number is an emergency number. This API uses an asynchronous callback to return the result. 390 391**System capability**: SystemCapability.Telephony.CallManager 392 393**Parameters** 394 395| Name | Type | Mandatory| Description | 396| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ | 397| phoneNumber | string | Yes | Phone number. | 398| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the called number is an emergency number, and the value **false** indicates the opposite.| 399 400**Error codes** 401 402For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 403 404| ID| Error Message | 405| -------- | -------------------------------------------- | 406| 401 | Parameter error. | 407| 8300001 | Invalid parameter value. | 408| 8300002 | Operation failed. Cannot connect to service. | 409| 8300003 | System internal error. | 410| 8300999 | Unknown error code. | 411 412**Example** 413 414```ts 415import { BusinessError } from '@ohos.base'; 416 417call.isEmergencyPhoneNumber("138xxxxxxxx", (err: BusinessError, data: boolean) => { 418 if (err) { 419 console.error(`isEmergencyPhoneNumber fail, err->${JSON.stringify(err)}`); 420 } else { 421 console.log(`isEmergencyPhoneNumber success, data->${JSON.stringify(data)}`); 422 } 423}); 424``` 425 426 427## call.isEmergencyPhoneNumber<sup>7+</sup> 428 429isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\<boolean\>\): void 430 431Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result. 432 433**System capability**: SystemCapability.Telephony.CallManager 434 435**Parameters** 436 437| Name | Type | Mandatory| Description | 438| ----------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | 439| phoneNumber | string | Yes | Phone number. | 440| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Emergency number options. | 441| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the called number is an emergency number, and the value **false** indicates the opposite.| 442 443**Error codes** 444 445For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 446 447| ID| Error Message | 448| -------- | -------------------------------------------- | 449| 401 | Parameter error. | 450| 8300001 | Invalid parameter value. | 451| 8300002 | Operation failed. Cannot connect to service. | 452| 8300003 | System internal error. | 453| 8300999 | Unknown error code. | 454 455**Example** 456 457```ts 458import { BusinessError } from '@ohos.base'; 459 460let options: call.EmergencyNumberOptions = {slotId: 1} 461call.isEmergencyPhoneNumber("112", options, (err: BusinessError, data: boolean) => { 462 if (err) { 463 console.error(`isEmergencyPhoneNumber fail, err->${JSON.stringify(err)}`); 464 } else { 465 console.log(`isEmergencyPhoneNumber success, data->${JSON.stringify(data)}`); 466 } 467}); 468``` 469 470 471## call.isEmergencyPhoneNumber<sup>7+</sup> 472 473isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise\<boolean\> 474 475Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result. 476 477**System capability**: SystemCapability.Telephony.CallManager 478 479**Parameters** 480 481| Name | Type | Mandatory| Description | 482| ----------- | -------------------------------------------------- | ---- | -------------- | 483| phoneNumber | string | Yes | Phone number. | 484| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Emergency number options.| 485 486**Return value** 487 488| Type | Description | 489| ---------------------- | --------------------------------------------------- | 490| Promise<boolean> | Promise used to return the result. The value **true** indicates that the called number is an emergency number, and the value **false** indicates the opposite.| 491 492**Error codes** 493 494For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 495 496| ID| Error Message | 497| -------- | -------------------------------------------- | 498| 401 | Parameter error. | 499| 8300001 | Invalid parameter value. | 500| 8300002 | Operation failed. Cannot connect to service. | 501| 8300003 | System internal error. | 502| 8300999 | Unknown error code. | 503 504**Example** 505 506```ts 507import { BusinessError } from '@ohos.base'; 508 509let options: call.EmergencyNumberOptions = {slotId: 1} 510call.isEmergencyPhoneNumber("138xxxxxxxx", options).then((data: boolean) => { 511 console.log(`isEmergencyPhoneNumber success, promise: data->${JSON.stringify(data)}`); 512}).catch((err: BusinessError) => { 513 console.error(`isEmergencyPhoneNumber fail, promise: err->${JSON.stringify(err)}`); 514}); 515``` 516 517## call.formatPhoneNumber<sup>7+</sup> 518 519formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\<string\>\): void 520 521Formats a phone number. This API uses an asynchronous callback to return the result. 522 523A formatted phone number is a standard numeric string, for example, 555 0100. 524 525**System capability**: SystemCapability.Telephony.CallManager 526 527**Parameters** 528 529| Name | Type | Mandatory| Description | 530| ----------- | --------------------------- | ---- | ------------------------------------ | 531| phoneNumber | string | Yes | Phone number. | 532| callback | AsyncCallback<string> | Yes | Callback used to return the result.| 533 534**Error codes** 535 536For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 537 538| ID| Error Message | 539| -------- | -------------------------------------------- | 540| 401 | Parameter error. | 541| 8300001 | Invalid parameter value. | 542| 8300002 | Operation failed. Cannot connect to service. | 543| 8300003 | System internal error. | 544| 8300999 | Unknown error code. | 545 546**Example** 547 548```ts 549import { BusinessError } from '@ohos.base'; 550 551call.formatPhoneNumber("138xxxxxxxx", (err: BusinessError, data: string) => { 552 if (err) { 553 console.error(`formatPhoneNumber fail, err->${JSON.stringify(err)}`); 554 } else { 555 console.log(`formatPhoneNumber success, data->${JSON.stringify(data)}`); 556 } 557}); 558``` 559 560## call.formatPhoneNumber<sup>7+</sup> 561 562formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\<string\>\): void 563 564Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result. 565 566A formatted phone number is a standard numeric string, for example, 555 0100. 567 568**System capability**: SystemCapability.Telephony.CallManager 569 570**Parameters** 571 572| Name | Type | Mandatory| Description | 573| ----------- | -------------------------------------------- | ---- | ------------------------------------ | 574| phoneNumber | string | Yes | Phone number. | 575| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | 576| callback | AsyncCallback<string> | Yes | Callback used to return the result.| 577 578**Error codes** 579 580For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 581 582| ID| Error Message | 583| -------- | -------------------------------------------- | 584| 401 | Parameter error. | 585| 8300001 | Invalid parameter value. | 586| 8300002 | Operation failed. Cannot connect to service. | 587| 8300003 | System internal error. | 588| 8300999 | Unknown error code. | 589 590**Example** 591 592```ts 593import { BusinessError } from '@ohos.base'; 594 595let options: call.NumberFormatOptions = { 596 countryCode: "CN" 597} 598call.formatPhoneNumber("138xxxxxxxx", options, (err: BusinessError, data: string) => { 599 if (err) { 600 console.error(`formatPhoneNumber fail, err->${JSON.stringify(err)}`); 601 } else { 602 console.log(`formatPhoneNumber success, data->${JSON.stringify(data)}`); 603 } 604}); 605``` 606 607 608## call.formatPhoneNumber<sup>7+</sup> 609 610formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise\<string\> 611 612Formats a phone number based on specified formatting options. This API uses a promise to return the result. 613 614A formatted phone number is a standard numeric string, for example, 555 0100. 615 616**System capability**: SystemCapability.Telephony.CallManager 617 618**Parameters** 619 620| Name | Type | Mandatory| Description | 621| ----------- | -------------------------------------------- | ---- | ---------------------- | 622| phoneNumber | string | Yes | Phone number. | 623| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code.| 624 625**Return value** 626 627| Type | Description | 628| --------------------- | ------------------------------------------- | 629| Promise<string> | Promise used to return the result.| 630 631**Error codes** 632 633For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 634 635| ID| Error Message | 636| -------- | -------------------------------------------- | 637| 401 | Parameter error. | 638| 8300001 | Invalid parameter value. | 639| 8300002 | Operation failed. Cannot connect to service. | 640| 8300003 | System internal error. | 641| 8300999 | Unknown error code. | 642 643**Example** 644 645```ts 646import { BusinessError } from '@ohos.base'; 647 648let options: call.NumberFormatOptions = { 649 countryCode: "CN" 650} 651call.formatPhoneNumber("138xxxxxxxx", options).then((data: string) => { 652 console.log(`formatPhoneNumber success, promise: data->${JSON.stringify(data)}`); 653}).catch((err: BusinessError) => { 654 console.error(`formatPhoneNumber fail, promise: err->${JSON.stringify(err)}`); 655}); 656``` 657 658## call.formatPhoneNumberToE164<sup>7+</sup> 659 660formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: AsyncCallback\<string\>\): void 661 662Converts a phone number into the E.164 format. This API uses an asynchronous callback to return the result. 663 664The 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. 665 666**System capability**: SystemCapability.Telephony.CallManager 667 668**Parameters** 669 670| Name | Type | Mandatory| Description | 671| ----------- | --------------------------- | ---- | ----------------------------------------------------- | 672| phoneNumber | string | Yes | Phone number. | 673| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | 674| callback | AsyncCallback<string> | Yes | Callback used to return the result.| 675 676**Error codes** 677 678For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 679 680| ID| Error Message | 681| -------- | -------------------------------------------- | 682| 401 | Parameter error. | 683| 8300001 | Invalid parameter value. | 684| 8300002 | Operation failed. Cannot connect to service. | 685| 8300003 | System internal error. | 686| 8300999 | Unknown error code. | 687 688**Example** 689 690```ts 691import { BusinessError } from '@ohos.base'; 692 693call.formatPhoneNumberToE164("138xxxxxxxx", "CN", (err: BusinessError, data: string) => { 694 if (err) { 695 console.error(`formatPhoneNumberToE164 fail, err->${JSON.stringify(err)}`); 696 } else { 697 console.log(`formatPhoneNumberToE164 success, data->${JSON.stringify(data)}`); 698 } 699}); 700``` 701 702 703## call.formatPhoneNumberToE164<sup>7+</sup> 704 705formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise\<string\> 706 707Converts a phone number into the E.164 format. This API uses a promise to return the result. 708 709The 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. 710 711All country codes are supported. 712 713**System capability**: SystemCapability.Telephony.CallManager 714 715**Parameters** 716 717| Name | Type | Mandatory| Description | 718| ----------- | ------ | ---- | ---------------------------------------- | 719| phoneNumber | string | Yes | Phone number. | 720| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported.| 721 722**Return value** 723 724| Type | Description | 725| --------------------- | ------------------------------------------------------------ | 726| Promise<string> | Promise used to return the result.| 727 728**Error codes** 729 730For details about the error codes, see [ohos.telephony (Telephony) Error Codes](errorcode-telephony.md) and [Universal Error Codes](../errorcode-universal.md). 731 732| ID| Error Message | 733| -------- | -------------------------------------------- | 734| 401 | Parameter error. | 735| 8300001 | Invalid parameter value. | 736| 8300002 | Operation failed. Cannot connect to service. | 737| 8300003 | System internal error. | 738| 8300999 | Unknown error code. | 739 740**Example** 741 742```ts 743import { BusinessError } from '@ohos.base'; 744 745call.formatPhoneNumberToE164("138xxxxxxxx", "CN").then((data: string) => { 746 console.log(`formatPhoneNumberToE164 success, promise: data->${JSON.stringify(data)}`); 747}).catch((err: BusinessError) => { 748 console.error(`formatPhoneNumberToE164 fail, promise: err->${JSON.stringify(err)}`); 749}); 750``` 751 752## DialOptions 753 754Provides an option for determining whether a call is a video call. 755 756**System capability**: SystemCapability.Telephony.CallManager 757 758| Name | Type | Mandatory| Description | 759| ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- | 760| extras | boolean | No | Whether the call is a video call. <br>- **true**: video call<br>- **false** (default): voice call | 761 762## CallState 763 764Enumerates call states. 765 766**System capability**: SystemCapability.Telephony.CallManager 767 768| Name | Value | Description | 769| ------------------ | ---- | ------------------------------------------------------------ | 770| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. | 771| CALL_STATE_IDLE | 0 | No call is in progress. | 772| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. | 773| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.| 774 775## EmergencyNumberOptions<sup>7+</sup> 776 777Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot. 778 779**System capability**: SystemCapability.Telephony.CallManager 780 781| Name | Type | Mandatory| Description | 782| ------ | ------ | ---- | ---------------------------------------------- | 783| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 784 785## NumberFormatOptions<sup>7+</sup> 786 787Provides an option for number formatting. 788 789**System capability**: SystemCapability.Telephony.CallManager 790 791| Name | Type | Mandatory| Description | 792| ----------- | ------ | ---- | ---------------------------------------------------------- | 793| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.| 794