1/* 2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import {AsyncCallback, Callback} from "./basic"; 17 18/** 19 * Provides methods related to call management. 20 * 21 * @since 6 22 * @syscap SystemCapability.Telephony.CallManager 23 */ 24declare namespace call { 25 /** 26 * Makes a call. 27 * 28 * @param phoneNumber Indicates the called number. 29 * @param options Indicates additional information carried in the call. 30 * @param callback Returns {@code true} if the call request is successful; returns {@code false} otherwise. 31 * Note that the value {@code true} indicates only the successful processing of the request; it does not mean 32 * that the call is or can be connected. 33 * @permission ohos.permission.PLACE_CALL 34 * @deprecated since 9 35 * @useinstead telephony.call#dialCall 36 */ 37 function dial(phoneNumber: string, callback: AsyncCallback<boolean>): void; 38 function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean>): void; 39 function dial(phoneNumber: string, options?: DialOptions): Promise<boolean>; 40 41 /** 42 * Makes a call. 43 * 44 * @permission ohos.permission.PLACE_CALL 45 * @param phoneNumber Indicates the called number. 46 * @throws {BusinessError} 201 - Permission denied. 47 * @throws {BusinessError} 401 - Parameter error. 48 * @throws {BusinessError} 8300001 - Invalid parameter value. 49 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 50 * @throws {BusinessError} 8300003 - System internal error. 51 * @throws {BusinessError} 8300999 - Unknown error code. 52 * @systemapi Hide this for inner system use. 53 * @since 9 54 */ 55 function dialCall(phoneNumber: string, callback: AsyncCallback<void>): void; 56 57 /** 58 * Makes a call. 59 * 60 * @permission ohos.permission.PLACE_CALL 61 * @param phoneNumber Indicates the called number. 62 * @param options Indicates additional information carried in the call. 63 * @param callback - the callback of dialCall. 64 * @throws {BusinessError} 201 - Permission denied. 65 * @throws {BusinessError} 401 - Parameter error. 66 * @throws {BusinessError} 8300001 - Invalid parameter value. 67 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 68 * @throws {BusinessError} 8300003 - System internal error. 69 * @throws {BusinessError} 8300999 - Unknown error code. 70 * @systemapi Hide this for inner system use. 71 * @since 9 72 */ 73 function dialCall(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback<void>): void; 74 75 /** 76 * Makes a call. 77 * 78 * @permission ohos.permission.PLACE_CALL 79 * @param phoneNumber Indicates the called number. 80 * @param options Indicates additional information carried in the call. 81 * @returns { void | Promise<void> } No callback return Promise otherwise return void. 82 * @throws {BusinessError} 201 - Permission denied. 83 * @throws {BusinessError} 401 - Parameter error. 84 * @throws {BusinessError} 8300001 - Invalid parameter value. 85 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 86 * @throws {BusinessError} 8300003 - System internal error. 87 * @throws {BusinessError} 8300999 - Unknown error code. 88 * @systemapi Hide this for inner system use. 89 * @since 9 90 */ 91 function dialCall(phoneNumber: string, options?: DialCallOptions): Promise<void>; 92 93 /** 94 * Go to the dial screen and the called number is displayed. 95 * 96 * @param phoneNumber Indicates the called number. 97 * @param callback - the callback of makeCall. 98 * @throws {BusinessError} 401 - Parameter error. 99 * @throws {BusinessError} 8300001 - Invalid parameter value. 100 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 101 * @throws {BusinessError} 8300003 - System internal error. 102 * @throws {BusinessError} 8300999 - Unknown error code. 103 * @syscap SystemCapability.Applications.Contacts 104 * @since 7 105 */ 106 function makeCall(phoneNumber: string, callback: AsyncCallback<void>): void; 107 function makeCall(phoneNumber: string): Promise<void>; 108 109 /** 110 * Checks whether a call is ongoing. 111 * 112 * @param callback Returns {@code true} if at least one call is not in the {@link CallState#CALL_STATE_IDLE} 113 * state; returns {@code false} otherwise. 114 */ 115 function hasCall(callback: AsyncCallback<boolean>): void; 116 function hasCall(): Promise<boolean>; 117 118 /** 119 * Obtains the call state. 120 * 121 * <p>If an incoming call is ringing or waiting, the system returns {@code CallState#CALL_STATE_RINGING}. 122 * If at least one call is in the active, hold, or dialing state, the system returns 123 * {@code CallState#CALL_STATE_OFFHOOK}. 124 * In other cases, the system returns {@code CallState#CALL_STATE_IDLE}. 125 * 126 * @param callback Returns the call state. 127 */ 128 function getCallState(callback: AsyncCallback<CallState>): void; 129 function getCallState(): Promise<CallState>; 130 131 /** 132 * Stops the ringtone. 133 * 134 * <p>If an incoming call is ringing, the phone stops ringing. Otherwise, this method does not function. 135 * 136 * @permission ohos.permission.SET_TELEPHONY_STATE 137 * @throws {BusinessError} 201 - Permission denied. 138 * @throws {BusinessError} 401 - Parameter error. 139 * @throws {BusinessError} 8300001 - Invalid parameter value. 140 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 141 * @throws {BusinessError} 8300003 - System internal error. 142 * @throws {BusinessError} 8300999 - Unknown error code. 143 * @systemapi Hide this for inner system use. 144 * @since 8 145 */ 146 function muteRinger(callback: AsyncCallback<void>): void; 147 function muteRinger(): Promise<void>; 148 149 /** 150 * Checks whether a device supports voice calls. 151 * 152 * <p>The system checks whether the device has the capability to initiate a circuit switching (CS) or IP multimedia 153 * subsystem domain (IMS) call on a telephone service network. If the device supports only packet switching 154 * (even if the device supports OTT calls), {@code false} is returned. 155 * 156 * @returns Returns {@code true} if the device supports voice calls; returns {@code false} otherwise. 157 * @since 7 158 */ 159 function hasVoiceCapability(): boolean; 160 161 /** 162 * Checks whether a phone number is on the emergency number list. 163 * 164 * @param phoneNumber Indicates the phone number to check. 165 * @param callback Returns {@code true} if the phone number is on the emergency number list; 166 * returns {@code false} otherwise. 167 * @throws {BusinessError} 401 - Parameter error. 168 * @throws {BusinessError} 8300001 - Invalid parameter value. 169 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 170 * @throws {BusinessError} 8300003 - System internal error. 171 * @throws {BusinessError} 8300999 - Unknown error code. 172 * @since 7 173 */ 174 function isEmergencyPhoneNumber(phoneNumber: string, callback: AsyncCallback<boolean>): void; 175 function isEmergencyPhoneNumber(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback<boolean>): void; 176 function isEmergencyPhoneNumber(phoneNumber: string, options?: EmergencyNumberOptions): Promise<boolean>; 177 178 /** 179 * Formats a phone number according to the Chinese Telephone Code Plan. Before the formatting, 180 * a phone number is in the format of country code (if any) + 3-digit service provider code 181 * + 4-digit area code + 4-digit subscriber number. After the formatting, 182 * each part is separated by a space. 183 * 184 * @param phoneNumber Indicates the phone number to format. 185 * @param options countryCode option 186 * @param callback Returns the phone number after being formatted; returns an empty string if the input phone number is invalid. 187 * @throws {BusinessError} 401 - Parameter error. 188 * @throws {BusinessError} 8300001 - Invalid parameter value. 189 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 190 * @throws {BusinessError} 8300003 - System internal error. 191 * @throws {BusinessError} 8300999 - Unknown error code. 192 * @since 7 193 */ 194 function formatPhoneNumber(phoneNumber: string, callback: AsyncCallback<string>): void; 195 function formatPhoneNumber(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback<string>): void; 196 function formatPhoneNumber(phoneNumber: string, options?: NumberFormatOptions): Promise<string>; 197 198 /** 199 * Formats a phone number into an E.164 representation. 200 * 201 * @param phoneNumber Indicates the phone number to format. 202 * @param countryCode Indicates a two-digit country code defined in ISO 3166-1. 203 * @param callback Returns an E.164 number; returns an empty string if the input phone number is invalid. 204 * @throws {BusinessError} 401 - Parameter error. 205 * @throws {BusinessError} 8300001 - Invalid parameter value. 206 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 207 * @throws {BusinessError} 8300003 - System internal error. 208 * @throws {BusinessError} 8300999 - Unknown error code. 209 * @since 7 210 */ 211 function formatPhoneNumberToE164(phoneNumber: string, countryCode: string, callback: AsyncCallback<string>): void; 212 function formatPhoneNumberToE164(phoneNumber: string, countryCode: string): Promise<string>; 213 214 /** 215 * Answers the incoming call. 216 * 217 * @param callId Indicates the identifier of the call to answer. 218 * @permission ohos.permission.ANSWER_CALL 219 * @throws {BusinessError} 201 - Permission denied. 220 * @throws {BusinessError} 401 - Parameter error. 221 * @throws {BusinessError} 8300001 - Invalid parameter value. 222 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 223 * @throws {BusinessError} 8300003 - System internal error. 224 * @throws {BusinessError} 8300999 - Unknown error code. 225 * @systemapi Hide this for inner system use. 226 * @since 7 227 */ 228 function answer(callId: number, callback: AsyncCallback<void>): void; 229 function answer(callId?: number): Promise<void>; 230 function answerCall(callId: number, callback: AsyncCallback<void>): void; 231 function answerCall(callId?: number): Promise<void>; 232 233 /** 234 * Answers the incoming call without callId. 235 * 236 * @permission ohos.permission.ANSWER_CALL 237 * @throws {BusinessError} 201 - Permission denied. 238 * @throws {BusinessError} 401 - Parameter error. 239 * @throws {BusinessError} 8300001 - Invalid parameter value. 240 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 241 * @throws {BusinessError} 8300003 - System internal error. 242 * @throws {BusinessError} 8300999 - Unknown error code. 243 * @systemapi Hide this for inner system use. 244 * @since 9 245 */ 246 function answer(callback: AsyncCallback<void>): void; 247 function answerCall(callback: AsyncCallback<void>): void; 248 249 /** 250 * Hang up the foreground call. 251 * 252 * @param callId Indicates the identifier of the call to hangup. 253 * @permission ohos.permission.ANSWER_CALL 254 * @throws {BusinessError} 201 - Permission denied. 255 * @throws {BusinessError} 401 - Parameter error. 256 * @throws {BusinessError} 8300001 - Invalid parameter value. 257 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 258 * @throws {BusinessError} 8300003 - System internal error. 259 * @throws {BusinessError} 8300999 - Unknown error code. 260 * @systemapi Hide this for inner system use. 261 * @since 7 262 */ 263 function hangup(callId: number, callback: AsyncCallback<void>): void; 264 function hangup(callId?: number): Promise<void>; 265 function hangUpCall(callId: number, callback: AsyncCallback<void>): void; 266 function hangUpCall(callId?: number): Promise<void>; 267 268 /** 269 * Hang up the foreground call without callId. 270 * 271 * @permission ohos.permission.ANSWER_CALL 272 * @throws {BusinessError} 201 - Permission denied. 273 * @throws {BusinessError} 401 - Parameter error. 274 * @throws {BusinessError} 8300001 - Invalid parameter value. 275 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 276 * @throws {BusinessError} 8300003 - System internal error. 277 * @throws {BusinessError} 8300999 - Unknown error code. 278 * @systemapi Hide this for inner system use. 279 * @since 9 280 */ 281 function hangup(callback: AsyncCallback<void>): void; 282 function hangUpCall(callback: AsyncCallback<void>): void; 283 284 /** 285 * Reject the incoming call. 286 * 287 * @param callId Indicates the identifier of the call to reject. 288 * @param options Indicates the text message to reject. 289 * @permission ohos.permission.ANSWER_CALL 290 * @throws {BusinessError} 201 - Permission denied. 291 * @throws {BusinessError} 401 - Parameter error. 292 * @throws {BusinessError} 8300001 - Invalid parameter value. 293 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 294 * @throws {BusinessError} 8300003 - System internal error. 295 * @throws {BusinessError} 8300999 - Unknown error code. 296 * @systemapi Hide this for inner system use. 297 * @since 7 298 */ 299 function reject(callId: number, callback: AsyncCallback<void>): void; 300 function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void; 301 function reject(callId?: number, options?: RejectMessageOptions): Promise<void>; 302 function rejectCall(callId: number, callback: AsyncCallback<void>): void; 303 function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void>): void; 304 function rejectCall(callId?: number, options?: RejectMessageOptions): Promise<void>; 305 306 /** 307 * Reject the incoming call without callId. 308 * 309 * @param options Indicates the text message to reject. 310 * @permission ohos.permission.ANSWER_CALL 311 * @throws {BusinessError} 201 - Permission denied. 312 * @throws {BusinessError} 401 - Parameter error. 313 * @throws {BusinessError} 8300001 - Invalid parameter value. 314 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 315 * @throws {BusinessError} 8300003 - System internal error. 316 * @throws {BusinessError} 8300999 - Unknown error code. 317 * @systemapi Hide this for inner system use. 318 * @since 9 319 */ 320 function reject(callback: AsyncCallback<void>): void; 321 function reject(options: RejectMessageOptions, callback: AsyncCallback<void>): void; 322 function rejectCall(callback: AsyncCallback<void>): void; 323 function rejectCall(options: RejectMessageOptions, callback: AsyncCallback<void>): void; 324 325 /** 326 * Keep a call on hold. 327 * 328 * @permission ohos.permission.ANSWER_CALL 329 * @param callId Indicates the identifier of the call. 330 * @throws {BusinessError} 201 - Permission denied. 331 * @throws {BusinessError} 401 - Parameter error. 332 * @throws {BusinessError} 8300001 - Invalid parameter value. 333 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 334 * @throws {BusinessError} 8300003 - System internal error. 335 * @throws {BusinessError} 8300999 - Unknown error code. 336 * @systemapi Hide this for inner system use. 337 * @since 7 338 */ 339 function holdCall(callId: number, callback: AsyncCallback<void>): void; 340 function holdCall(callId: number): Promise<void>; 341 342 /** 343 * Cancel call hold status. 344 * 345 * @permission ohos.permission.ANSWER_CALL 346 * @param callId Indicates the identifier of the call. 347 * @throws {BusinessError} 201 - Permission denied. 348 * @throws {BusinessError} 401 - Parameter error. 349 * @throws {BusinessError} 8300001 - Invalid parameter value. 350 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 351 * @throws {BusinessError} 8300003 - System internal error. 352 * @throws {BusinessError} 8300999 - Unknown error code. 353 * @systemapi Hide this for inner system use. 354 * @since 7 355 */ 356 function unHoldCall(callId: number, callback: AsyncCallback<void>): void; 357 function unHoldCall(callId: number): Promise<void>; 358 359 /** 360 * Switch call. 361 * 362 * @permission ohos.permission.ANSWER_CALL 363 * @param callId Indicates the identifier of the call. 364 * @throws {BusinessError} 201 - Permission denied. 365 * @throws {BusinessError} 401 - Parameter error. 366 * @throws {BusinessError} 8300001 - Invalid parameter value. 367 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 368 * @throws {BusinessError} 8300003 - System internal error. 369 * @throws {BusinessError} 8300999 - Unknown error code. 370 * @systemapi Hide this for inner system use. 371 * @since 7 372 */ 373 function switchCall(callId: number, callback: AsyncCallback<void>): void; 374 function switchCall(callId: number): Promise<void>; 375 376 /** 377 * Merge calls, merge two calls into conference calls. 378 * 379 * @param callId Indicates the identifier of the call. 380 * @throws {BusinessError} 401 - Parameter error. 381 * @throws {BusinessError} 801 - Capability not supported. 382 * @throws {BusinessError} 8300001 - Invalid parameter value. 383 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 384 * @throws {BusinessError} 8300003 - System internal error. 385 * @systemapi Hide this for inner system use. 386 * @since 7 387 */ 388 function combineConference(callId: number, callback: AsyncCallback<void>): void; 389 function combineConference(callId: number): Promise<void>; 390 391 /** 392 * Get the main call Id. 393 * 394 * @param callId Indicates the identifier of the call. 395 * @returns Returns the main call id. 396 * @throws {BusinessError} 401 - Parameter error. 397 * @throws {BusinessError} 801 - Capability not supported. 398 * @throws {BusinessError} 8300001 - Invalid parameter value. 399 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 400 * @throws {BusinessError} 8300003 - System internal error. 401 * @systemapi Hide this for inner system use. 402 * @since 7 403 */ 404 function getMainCallId(callId: number, callback: AsyncCallback<number>): void; 405 function getMainCallId(callId: number): Promise<number>; 406 407 /** 408 * Get the list of sub-call Ids. 409 * 410 * @param callId Indicates the identifier of the call. 411 * @returns Returns the list of sub call ids. 412 * @throws {BusinessError} 401 - Parameter error. 413 * @throws {BusinessError} 801 - Capability not supported. 414 * @throws {BusinessError} 8300001 - Invalid parameter value. 415 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 416 * @throws {BusinessError} 8300003 - System internal error. 417 * @systemapi Hide this for inner system use. 418 * @since 7 419 */ 420 function getSubCallIdList(callId: number, callback: AsyncCallback<Array<string>>): void; 421 function getSubCallIdList(callId: number): Promise<Array<string>>; 422 423 /** 424 * Get the call Id list of the conference. 425 * 426 * @param callId Indicates the identifier of the call. 427 * @param callback Returns the call id list of conference calls. 428 * @throws {BusinessError} 401 - Parameter error. 429 * @throws {BusinessError} 801 - Capability not supported. 430 * @throws {BusinessError} 8300001 - Invalid parameter value. 431 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 432 * @throws {BusinessError} 8300003 - System internal error. 433 * @systemapi Hide this for inner system use. 434 * @since 7 435 */ 436 function getCallIdListForConference(callId: number, callback: AsyncCallback<Array<string>>): void; 437 function getCallIdListForConference(callId: number): Promise<Array<string>>; 438 439 /** 440 * Get call waiting status. 441 * 442 * @permission ohos.permission.GET_TELEPHONY_STATE 443 * @param slotId Indicates the card slot index number, 444 * ranging from 0 to the maximum card slot index number supported by the device. 445 * @param callback Returns call waiting status. 446 * @throws {BusinessError} 201 - Permission denied. 447 * @throws {BusinessError} 401 - Parameter error. 448 * @throws {BusinessError} 801 - Capability not supported. 449 * @throws {BusinessError} 8300001 - Invalid parameter value. 450 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 451 * @throws {BusinessError} 8300003 - System internal error. 452 * @systemapi Hide this for inner system use. 453 * @since 7 454 */ 455 function getCallWaitingStatus(slotId: number, callback: AsyncCallback<CallWaitingStatus>): void; 456 function getCallWaitingStatus(slotId: number): Promise<CallWaitingStatus>; 457 458 /** 459 * Set call waiting. 460 * 461 * @permission ohos.permission.SET_TELEPHONY_STATE 462 * @param slotId Indicates the card slot index number, 463 * ranging from 0 to the maximum card slot index number supported by the device. 464 * @param activate Indicates whether to activate or call wait. 465 * @throws {BusinessError} 201 - Permission denied. 466 * @throws {BusinessError} 401 - Parameter error. 467 * @throws {BusinessError} 801 - Capability not supported. 468 * @throws {BusinessError} 8300001 - Invalid parameter value. 469 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 470 * @throws {BusinessError} 8300003 - System internal error. 471 * @systemapi Hide this for inner system use. 472 * @since 7 473 */ 474 function setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback<void>): void; 475 function setCallWaiting(slotId: number, activate: boolean): Promise<void>; 476 477 /** 478 * Start DTMF(Dual Tone Multi Frequency). 479 * 480 * @param callId Indicates the identifier of the call. 481 * @throws {BusinessError} 401 - Parameter error. 482 * @throws {BusinessError} 801 - Capability not supported. 483 * @throws {BusinessError} 8300001 - Invalid parameter value. 484 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 485 * @throws {BusinessError} 8300003 - System internal error. 486 * @systemapi Hide this for inner system use. 487 * @since 7 488 */ 489 function startDTMF(callId: number, character: string, callback: AsyncCallback<void>): void; 490 function startDTMF(callId: number, character: string): Promise<void>; 491 492 /** 493 * Stop DTMF(Dual Tone Multi Frequency). 494 * 495 * @param callId Indicates the identifier of the call. 496 * @throws {BusinessError} 401 - Parameter error. 497 * @throws {BusinessError} 801 - Capability not supported. 498 * @throws {BusinessError} 8300001 - Invalid parameter value. 499 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 500 * @throws {BusinessError} 8300003 - System internal error. 501 * @systemapi Hide this for inner system use. 502 * @since 7 503 */ 504 function stopDTMF(callId: number, callback: AsyncCallback<void>): void; 505 function stopDTMF(callId: number): Promise<void>; 506 507 /** 508 * Judge whether the emergency call is in progress. 509 * 510 * @permission ohos.permission.SET_TELEPHONY_STATE 511 * @param callback Returns {@code true} if the call is in emergency; returns {@code false} otherwise. 512 * @throws {BusinessError} 201 - Permission denied. 513 * @throws {BusinessError} 401 - Parameter error. 514 * @throws {BusinessError} 8300001 - Invalid parameter value. 515 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 516 * @throws {BusinessError} 8300003 - System internal error. 517 * @throws {BusinessError} 8300999 - Unknown error code. 518 * @systemapi Hide this for inner system use. 519 * @since 7 520 */ 521 function isInEmergencyCall(callback: AsyncCallback<boolean>): void; 522 function isInEmergencyCall(): Promise<boolean>; 523 524 /** 525 * Subscribe to the callDetailsChange event. 526 * 527 * @permission ohos.permission.SET_TELEPHONY_STATE 528 * @param callback Return the result of call details. 529 * @throws {BusinessError} 201 - Permission denied. 530 * @throws {BusinessError} 401 - Parameter error. 531 * @throws {BusinessError} 8300001 - Invalid parameter value. 532 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 533 * @throws {BusinessError} 8300003 - System internal error. 534 * @throws {BusinessError} 8300999 - Unknown error code. 535 * @systemapi Hide this for inner system use. 536 * @since 7 537 */ 538 function on(type: 'callDetailsChange', callback: Callback<CallAttributeOptions>): void; 539 540 /** 541 * Unsubscribe from the callDetailsChange event. 542 * 543 * @permission ohos.permission.SET_TELEPHONY_STATE 544 * @param callback Cancel call details registration. 545 * @throws {BusinessError} 201 - Permission denied. 546 * @throws {BusinessError} 401 - Parameter error. 547 * @throws {BusinessError} 8300001 - Invalid parameter value. 548 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 549 * @throws {BusinessError} 8300003 - System internal error. 550 * @throws {BusinessError} 8300999 - Unknown error code. 551 * @systemapi Hide this for inner system use. 552 * @since 7 553 */ 554 function off(type: 'callDetailsChange', callback?: Callback<CallAttributeOptions>): void; 555 556 /** 557 * Subscribe to the callEventChange event. 558 * 559 * @permission ohos.permission.SET_TELEPHONY_STATE 560 * @param callback Return the call event id. 561 * @throws {BusinessError} 201 - Permission denied. 562 * @throws {BusinessError} 401 - Parameter error. 563 * @throws {BusinessError} 8300001 - Invalid parameter value. 564 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 565 * @throws {BusinessError} 8300003 - System internal error. 566 * @throws {BusinessError} 8300999 - Unknown error code. 567 * @systemapi Hide this for inner system use. 568 * @since 8 569 */ 570 function on(type: 'callEventChange', callback: Callback<CallEventOptions>): void; 571 572 /** 573 * Unsubscribe from the callEventChange event. 574 * 575 * @permission ohos.permission.SET_TELEPHONY_STATE 576 * @param callback Cancel call event registration. 577 * @throws {BusinessError} 201 - Permission denied. 578 * @throws {BusinessError} 401 - Parameter error. 579 * @throws {BusinessError} 8300001 - Invalid parameter value. 580 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 581 * @throws {BusinessError} 8300003 - System internal error. 582 * @throws {BusinessError} 8300999 - Unknown error code. 583 * @systemapi Hide this for inner system use. 584 * @since 8 585 */ 586 function off(type: 'callEventChange', callback?: Callback<CallEventOptions>): void; 587 588 /** 589 * Subscribe to the callDisconnectedCause event. 590 * 591 * @permission ohos.permission.SET_TELEPHONY_STATE 592 * @param callback Return the call disconnection reason. 593 * @throws {BusinessError} 201 - Permission denied. 594 * @throws {BusinessError} 401 - Parameter error. 595 * @throws {BusinessError} 8300001 - Invalid parameter value. 596 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 597 * @throws {BusinessError} 8300003 - System internal error. 598 * @throws {BusinessError} 8300999 - Unknown error code. 599 * @systemapi Hide this for inner system use. 600 * @since 8 601 */ 602 function on(type: 'callDisconnectedCause', callback: Callback<DisconnectedDetails>): void; 603 604 /** 605 * Unsubscribe from the callDisconnectedCause event. 606 * 607 * @permission ohos.permission.SET_TELEPHONY_STATE 608 * @param callback Cancel the call disconnection reason registration. 609 * @throws {BusinessError} 201 - Permission denied. 610 * @throws {BusinessError} 401 - Parameter error. 611 * @throws {BusinessError} 8300001 - Invalid parameter value. 612 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 613 * @throws {BusinessError} 8300003 - System internal error. 614 * @throws {BusinessError} 8300999 - Unknown error code. 615 * @systemapi Hide this for inner system use. 616 * @since 8 617 */ 618 function off(type: 'callDisconnectedCause', callback?: Callback<DisconnectedDetails>): void; 619 620 /** 621 * Subscribe to the mmiCodeResult event. 622 * 623 * @param type Indicates the observer type. 624 * @param callback Return the result of MMI code. 625 * @permission ohos.permission.SET_TELEPHONY_STATE 626 * @throws {BusinessError} 201 - Permission denied. 627 * @throws {BusinessError} 401 - Parameter error. 628 * @throws {BusinessError} 8300001 - Invalid parameter value. 629 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 630 * @throws {BusinessError} 8300003 - System internal error. 631 * @throws {BusinessError} 8300999 - Unknown error code. 632 * @systemapi Hide this for inner system use. 633 * @since 9 634 */ 635 function on(type: 'mmiCodeResult', callback: Callback<MmiCodeResults>): void; 636 637 /** 638 * Unsubscribe from the mmiCodeResult event. 639 * 640 * @param type Indicates the observer type. 641 * @param callback Return the result of MMI code. 642 * @permission ohos.permission.SET_TELEPHONY_STATE 643 * @throws {BusinessError} 201 - Permission denied. 644 * @throws {BusinessError} 401 - Parameter error. 645 * @throws {BusinessError} 8300001 - Invalid parameter value. 646 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 647 * @throws {BusinessError} 8300003 - System internal error. 648 * @throws {BusinessError} 8300999 - Unknown error code. 649 * @systemapi Hide this for inner system use. 650 * @since 9 651 */ 652 function off(type: 'mmiCodeResult', callback?: Callback<MmiCodeResults>): void; 653 654 /** 655 * Judge whether to allow another new call. 656 * 657 * @param callback Returns {@code true} If the device currently allows new calls; returns {@code false} otherwise. 658 * @throws {BusinessError} 401 - Parameter error. 659 * @throws {BusinessError} 8300001 - Invalid parameter value. 660 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 661 * @throws {BusinessError} 8300003 - System internal error. 662 * @throws {BusinessError} 8300999 - Unknown error code. 663 * @systemapi Hide this for inner system use. 664 * @since 8 665 */ 666 function isNewCallAllowed(callback: AsyncCallback<boolean>): void; 667 function isNewCallAllowed(): Promise<boolean>; 668 669 /** 670 * Split conference call. 671 * 672 * @param callId Indicates the identifier of the call. 673 * @throws {BusinessError} 401 - Parameter error. 674 * @throws {BusinessError} 8300001 - Invalid parameter value. 675 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 676 * @throws {BusinessError} 8300003 - System internal error. 677 * @throws {BusinessError} 8300999 - Unknown error code. 678 * @systemapi Hide this for inner system use. 679 * @since 8 680 */ 681 function separateConference(callId: number, callback: AsyncCallback<void>): void; 682 function separateConference(callId: number): Promise<void>; 683 684 /** 685 * Get call barring status. 686 * 687 * @permission ohos.permission.GET_TELEPHONY_STATE 688 * @param slotId Indicates the card slot index number, 689 * ranging from 0 to the maximum card slot index number supported by the device. 690 * @param type Indicates which type of call restriction to obtain. 691 * @param callback Returns call restriction status. 692 * @throws {BusinessError} 201 - Permission denied. 693 * @throws {BusinessError} 401 - Parameter error. 694 * @throws {BusinessError} 801 - Capability not supported. 695 * @throws {BusinessError} 8300001 - Invalid parameter value. 696 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 697 * @throws {BusinessError} 8300003 - System internal error. 698 * @systemapi Hide this for inner system use. 699 * @since 8 700 */ 701 function getCallRestrictionStatus(slotId: number, type: CallRestrictionType, callback: AsyncCallback<RestrictionStatus>): void; 702 function getCallRestrictionStatus(slotId: number, type: CallRestrictionType): Promise<RestrictionStatus>; 703 704 /** 705 * Set call barring status. 706 * 707 * @permission ohos.permission.SET_TELEPHONY_STATE 708 * @param slotId Indicates the card slot index number, 709 * ranging from 0 to the maximum card slot index number supported by the device. 710 * @param info Indicates the set call restriction information. 711 * @throws {BusinessError} 201 - Permission denied. 712 * @throws {BusinessError} 401 - Parameter error. 713 * @throws {BusinessError} 801 - Capability not supported. 714 * @throws {BusinessError} 8300001 - Invalid parameter value. 715 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 716 * @throws {BusinessError} 8300003 - System internal error. 717 * @systemapi Hide this for inner system use. 718 * @since 8 719 */ 720 function setCallRestriction(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback<void>): void; 721 function setCallRestriction(slotId: number, info: CallRestrictionInfo): Promise<void>; 722 723 /** 724 * Get call forwarding information. 725 * 726 * @permission ohos.permission.GET_TELEPHONY_STATE 727 * @param slotId Indicates the card slot index number, 728 * ranging from 0 to the maximum card slot index number supported by the device. 729 * @param type Indicates which type of call forwarding to obtain. 730 * @param callback Returns call forwarding status. 731 * @throws {BusinessError} 201 - Permission denied. 732 * @throws {BusinessError} 401 - Parameter error. 733 * @throws {BusinessError} 801 - Capability not supported. 734 * @throws {BusinessError} 8300001 - Invalid parameter value. 735 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 736 * @throws {BusinessError} 8300003 - System internal error. 737 * @systemapi Hide this for inner system use. 738 * @since 8 739 */ 740 function getCallTransferInfo(slotId: number, type: CallTransferType, callback: AsyncCallback<CallTransferResult>): void; 741 function getCallTransferInfo(slotId: number, type: CallTransferType): Promise<CallTransferResult>; 742 743 /** 744 * Set call forwarding information. 745 * 746 * @permission ohos.permission.SET_TELEPHONY_STATE 747 * @param slotId Indicates the card slot index number, 748 * ranging from 0 to the maximum card slot index number supported by the device. 749 * @param info Indicates the set call forwarding information. 750 * @throws {BusinessError} 201 - Permission denied. 751 * @throws {BusinessError} 401 - Parameter error. 752 * @throws {BusinessError} 801 - Capability not supported. 753 * @throws {BusinessError} 8300001 - Invalid parameter value. 754 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 755 * @throws {BusinessError} 8300003 - System internal error. 756 * @systemapi Hide this for inner system use. 757 * @since 8 758 */ 759 function setCallTransfer(slotId: number, info: CallTransferInfo, callback: AsyncCallback<void>): void; 760 function setCallTransfer(slotId: number, info: CallTransferInfo): Promise<void>; 761 762 /** 763 * Jduge whether there is a ringing call. 764 * 765 * @permission ohos.permission.SET_TELEPHONY_STATE 766 * @param callback Returns {@code true} if the device is ringing; returns {@code false} otherwise. 767 * @throws {BusinessError} 201 - Permission denied. 768 * @throws {BusinessError} 401 - Parameter error. 769 * @throws {BusinessError} 8300001 - Invalid parameter value. 770 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 771 * @throws {BusinessError} 8300003 - System internal error. 772 * @throws {BusinessError} 8300999 - Unknown error code. 773 * @systemapi Hide this for inner system use. 774 * @since 8 775 */ 776 function isRinging(callback: AsyncCallback<boolean>): void; 777 function isRinging(): Promise<boolean>; 778 779 /** 780 * Set mute during a call. 781 * 782 * @throws {BusinessError} 401 - Parameter error. 783 * @throws {BusinessError} 8300001 - Invalid parameter value. 784 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 785 * @throws {BusinessError} 8300003 - System internal error. 786 * @throws {BusinessError} 8300999 - Unknown error code. 787 * @systemapi Hide this for inner system use. 788 * @since 8 789 */ 790 function setMuted(callback: AsyncCallback<void>): void; 791 function setMuted(): Promise<void>; 792 793 /** 794 * Unmute during a call. 795 * 796 * @throws {BusinessError} 401 - Parameter error. 797 * @throws {BusinessError} 8300001 - Invalid parameter value. 798 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 799 * @throws {BusinessError} 8300003 - System internal error. 800 * @throws {BusinessError} 8300999 - Unknown error code. 801 * @systemapi Hide this for inner system use. 802 * @since 8 803 */ 804 function cancelMuted(callback: AsyncCallback<void>): void; 805 function cancelMuted(): Promise<void>; 806 807 /** 808 * Set the audio device. 809 * 810 * @param device Indicates the device of audio. 811 * @param callback Returns {@code true} if the request is successful; returns {@code false} otherwise. 812 * @throws {BusinessError} 401 - Parameter error. 813 * @throws {BusinessError} 8300001 - Invalid parameter value. 814 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 815 * @throws {BusinessError} 8300003 - System internal error. 816 * @throws {BusinessError} 8300999 - Unknown error code. 817 * @systemapi Hide this for inner system use. 818 * @since 8 819 */ 820 function setAudioDevice(device: AudioDevice, callback: AsyncCallback<void>): void; 821 822 /** 823 * Set the audio device with options. 824 * 825 * @param device Indicates the device of audio. 826 * @param options Indicates additional information, such as address of bluetooth. 827 * @param callback Returns {@code true} if the request is successful; returns {@code false} otherwise. 828 * @throws {BusinessError} 401 - Parameter error. 829 * @throws {BusinessError} 8300001 - Invalid parameter value. 830 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 831 * @throws {BusinessError} 8300003 - System internal error. 832 * @throws {BusinessError} 8300999 - Unknown error code. 833 * @systemapi Hide this for inner system use. 834 * @since 9 835 */ 836 function setAudioDevice(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback<void>): void; 837 function setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise<void>; 838 839 /** 840 * Join the conference call. 841 * 842 * @param mainCallId Indicates the identifier of the main call. 843 * @param callNumberList Indicates a call list. 844 * @throws {BusinessError} 401 - Parameter error. 845 * @throws {BusinessError} 8300001 - Invalid parameter value. 846 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 847 * @throws {BusinessError} 8300003 - System internal error. 848 * @throws {BusinessError} 8300999 - Unknown error code. 849 * @systemapi Hide this for inner system use. 850 * @since 8 851 */ 852 function joinConference(mainCallId: number, callNumberList: Array<string>, callback: AsyncCallback<void>): void; 853 function joinConference(mainCallId: number, callNumberList: Array<string>): Promise<void>; 854 855 /** 856 * Update Ims call mode. 857 * 858 * @param callId Indicates the identifier of the call. 859 * @param mode Indicates the mode of the ims call. 860 * @throws {BusinessError} 401 - Parameter error. 861 * @throws {BusinessError} 8300001 - Invalid parameter value. 862 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 863 * @throws {BusinessError} 8300003 - System internal error. 864 * @throws {BusinessError} 8300999 - Unknown error code. 865 * @systemapi Hide this for inner system use. 866 * @since 8 867 */ 868 function updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback<void>): void; 869 function updateImsCallMode(callId: number, mode: ImsCallMode): Promise<void>; 870 871 /** 872 * Turn on Ims switch. 873 * 874 * @permission ohos.permission.SET_TELEPHONY_STATE 875 * @param slotId Indicates the card slot index number, 876 * ranging from 0 to the maximum card slot index number supported by the device. 877 * @throws {BusinessError} 201 - Permission denied. 878 * @throws {BusinessError} 401 - Parameter error. 879 * @throws {BusinessError} 8300001 - Invalid parameter value. 880 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 881 * @throws {BusinessError} 8300003 - System internal error. 882 * @throws {BusinessError} 8300999 - Unknown error code. 883 * @systemapi Hide this for inner system use. 884 * @since 8 885 */ 886 function enableImsSwitch(slotId: number, callback: AsyncCallback<void>): void; 887 function enableImsSwitch(slotId: number): Promise<void>; 888 889 /** 890 * Turn off Ims switch. 891 * 892 * @permission ohos.permission.SET_TELEPHONY_STATE 893 * @param slotId Indicates the card slot index number, 894 * ranging from 0 to the maximum card slot index number supported by the device. 895 * @throws {BusinessError} 201 - Permission denied. 896 * @throws {BusinessError} 401 - Parameter error. 897 * @throws {BusinessError} 8300001 - Invalid parameter value. 898 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 899 * @throws {BusinessError} 8300003 - System internal error. 900 * @throws {BusinessError} 8300999 - Unknown error code. 901 * @systemapi Hide this for inner system use. 902 * @since 8 903 */ 904 function disableImsSwitch(slotId: number, callback: AsyncCallback<void>): void; 905 function disableImsSwitch(slotId: number): Promise<void>; 906 907 /** 908 * Judge whether the Ims switch is enabled. 909 * 910 * @param slotId Indicates the card slot index number, 911 * ranging from 0 to the maximum card slot index number supported by the device. 912 * @param callback Returns {@code true} If the ims switch is on; returns {@code false} otherwise. 913 * @throws {BusinessError} 401 - Parameter error. 914 * @throws {BusinessError} 8300001 - Invalid parameter value. 915 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 916 * @throws {BusinessError} 8300003 - System internal error. 917 * @throws {BusinessError} 8300999 - Unknown error code. 918 * @systemapi Hide this for inner system use. 919 * @since 8 920 */ 921 function isImsSwitchEnabled(slotId: number, callback: AsyncCallback<boolean>): void; 922 function isImsSwitchEnabled(slotId: number): Promise<boolean>; 923 924 /** 925 * @systemapi Hide this for inner system use. 926 * @since 8 927 */ 928 export enum ImsCallMode { 929 CALL_MODE_AUDIO_ONLY = 0, 930 CALL_MODE_SEND_ONLY, 931 CALL_MODE_RECEIVE_ONLY, 932 CALL_MODE_SEND_RECEIVE, 933 CALL_MODE_VIDEO_PAUSED, 934 } 935 936 /** 937 * @systemapi Hide this for inner system use. 938 * @since 8 939 */ 940 export enum AudioDevice { 941 DEVICE_EARPIECE, 942 DEVICE_SPEAKER, 943 DEVICE_WIRED_HEADSET, 944 DEVICE_BLUETOOTH_SCO, 945 DEVICE_MIC, 946 } 947 948 /** 949 * @systemapi Hide this for inner system use. 950 * @since 8 951 */ 952 export enum CallRestrictionType { 953 RESTRICTION_TYPE_ALL_INCOMING = 0, 954 RESTRICTION_TYPE_ALL_OUTGOING, 955 RESTRICTION_TYPE_INTERNATIONAL, 956 RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME, 957 RESTRICTION_TYPE_ROAMING_INCOMING, 958 RESTRICTION_TYPE_ALL_CALLS, 959 RESTRICTION_TYPE_OUTGOING_SERVICES, 960 RESTRICTION_TYPE_INCOMING_SERVICES, 961 } 962 963 /** 964 * @systemapi Hide this for inner system use. 965 * @since 8 966 */ 967 export interface CallTransferInfo { 968 /** 969 * Phone number. 970 * 971 * @since 8 972 */ 973 transferNum: string; 974 975 /** 976 * Call forwarding type. 977 * 978 * @since 8 979 */ 980 type: CallTransferType; 981 982 /** 983 * Call forwarding setting type. 984 * 985 * @since 8 986 */ 987 settingType: CallTransferSettingType; 988 989 /** 990 * Start time hours. 991 * 992 * @since 9 993 */ 994 startHour?: number; 995 996 /** 997 * Start time minutes. 998 * 999 * @since 9 1000 */ 1001 startMinute?: number; 1002 1003 /** 1004 * End time hours. 1005 * 1006 * @since 9 1007 */ 1008 endHour?: number; 1009 1010 /** 1011 * End time minutes. 1012 * 1013 * @since 9 1014 */ 1015 endMinute?: number; 1016 } 1017 1018 /** 1019 * @systemapi Hide this for inner system use. 1020 * @since 8 1021 */ 1022 export enum CallTransferType { 1023 TRANSFER_TYPE_UNCONDITIONAL = 0, 1024 TRANSFER_TYPE_BUSY, 1025 TRANSFER_TYPE_NO_REPLY, 1026 TRANSFER_TYPE_NOT_REACHABLE, 1027 } 1028 1029 /** 1030 * @systemapi Hide this for inner system use. 1031 * @since 8 1032 */ 1033 export enum CallTransferSettingType { 1034 CALL_TRANSFER_DISABLE = 0, 1035 CALL_TRANSFER_ENABLE = 1, 1036 CALL_TRANSFER_REGISTRATION = 3, 1037 CALL_TRANSFER_ERASURE = 4, 1038 } 1039 1040 /** 1041 * @systemapi Hide this for inner system use. 1042 * @since 7 1043 */ 1044 export interface CallAttributeOptions { 1045 accountNumber: string; 1046 speakerphoneOn: boolean; 1047 accountId: number; 1048 videoState: VideoStateType; 1049 startTime: number; 1050 isEcc: boolean; 1051 callType: CallType; 1052 callId: number; 1053 callState: DetailedCallState; 1054 conferenceState: ConferenceState; 1055 } 1056 1057 /** 1058 * @systemapi Hide this for inner system use. 1059 * @since 7 1060 */ 1061 export enum ConferenceState { 1062 TEL_CONFERENCE_IDLE = 0, 1063 TEL_CONFERENCE_ACTIVE, 1064 TEL_CONFERENCE_DISCONNECTING, 1065 TEL_CONFERENCE_DISCONNECTED, 1066 } 1067 1068 /** 1069 * @systemapi Hide this for inner system use. 1070 * @since 7 1071 */ 1072 export enum CallType { 1073 TYPE_CS = 0, // CS 1074 TYPE_IMS = 1, // IMS 1075 TYPE_OTT = 2, // OTT 1076 TYPE_ERR_CALL = 3, // OTHER 1077 } 1078 1079 /** 1080 * @systemapi Hide this for inner system use. 1081 * @since 7 1082 */ 1083 export enum VideoStateType { 1084 TYPE_VOICE = 0, // Voice 1085 TYPE_VIDEO, // Video 1086 } 1087 1088 /** 1089 * @systemapi Hide this for inner system use. 1090 * @since 7 1091 */ 1092 export enum DetailedCallState { 1093 CALL_STATUS_ACTIVE = 0, 1094 CALL_STATUS_HOLDING, 1095 CALL_STATUS_DIALING, 1096 CALL_STATUS_ALERTING, 1097 CALL_STATUS_INCOMING, 1098 CALL_STATUS_WAITING, 1099 CALL_STATUS_DISCONNECTED, 1100 CALL_STATUS_DISCONNECTING, 1101 CALL_STATUS_IDLE, 1102 } 1103 1104 /** 1105 * @systemapi Hide this for inner system use. 1106 * @since 8 1107 */ 1108 export interface CallRestrictionInfo { 1109 type: CallRestrictionType; 1110 password: string; 1111 mode: CallRestrictionMode; 1112 } 1113 1114 /** 1115 * @systemapi Hide this for inner system use. 1116 * @since 8 1117 */ 1118 export enum CallRestrictionMode { 1119 RESTRICTION_MODE_DEACTIVATION = 0, 1120 RESTRICTION_MODE_ACTIVATION, 1121 } 1122 1123 /** 1124 * @systemapi Hide this for inner system use. 1125 * @since 8 1126 */ 1127 export interface CallEventOptions { 1128 eventId: CallAbilityEventId, 1129 } 1130 1131 /** 1132 * @systemapi Hide this for inner system use. 1133 * @since 8 1134 */ 1135 export enum CallAbilityEventId { 1136 EVENT_DIAL_NO_CARRIER = 1, 1137 EVENT_INVALID_FDN_NUMBER, 1138 } 1139 1140 export enum CallState { 1141 /** 1142 * Indicates an invalid state, which is used when the call state fails to be obtained. 1143 */ 1144 CALL_STATE_UNKNOWN = -1, 1145 1146 /** 1147 * Indicates that there is no ongoing call. 1148 */ 1149 CALL_STATE_IDLE = 0, 1150 1151 /** 1152 * Indicates that an incoming call is ringing or waiting. 1153 */ 1154 CALL_STATE_RINGING = 1, 1155 1156 /** 1157 * Indicates that a least one call is in the dialing, active, or hold state, and there is no new incoming call 1158 * ringing or waiting. 1159 */ 1160 CALL_STATE_OFFHOOK = 2 1161 } 1162 1163 export interface DialOptions { 1164 /** 1165 * boolean means whether the call to be made is a video call. The value {@code false} indicates a voice call. 1166 */ 1167 extras?: boolean; 1168 1169 /** 1170 * @systemapi Hide this for inner system use. 1171 * @since 8 1172 */ 1173 accountId?: number; 1174 1175 /** 1176 * @systemapi Hide this for inner system use. 1177 * @since 8 1178 */ 1179 videoState?: VideoStateType; 1180 1181 /** 1182 * @systemapi Hide this for inner system use. 1183 * @since 8 1184 */ 1185 dialScene?: DialScene; 1186 1187 /** 1188 * @systemapi Hide this for inner system use. 1189 * @since 8 1190 */ 1191 dialType?: DialType; 1192 } 1193 1194 /** 1195 * @systemapi Hide this for inner system use. 1196 * @since 9 1197 */ 1198 export interface DialCallOptions { 1199 /** 1200 * @systemapi Hide this for inner system use. 1201 */ 1202 accountId?: number; 1203 /** 1204 * @systemapi Hide this for inner system use. 1205 */ 1206 videoState?: VideoStateType; 1207 /** 1208 * @systemapi Hide this for inner system use. 1209 */ 1210 dialScene?: DialScene; 1211 /** 1212 * @systemapi Hide this for inner system use. 1213 */ 1214 dialType?: DialType; 1215 } 1216 1217 /** 1218 * @systemapi Hide this for inner system use. 1219 * @since 8 1220 */ 1221 export enum DialScene { 1222 CALL_NORMAL = 0, 1223 CALL_PRIVILEGED = 1, 1224 CALL_EMERGENCY = 2, 1225 } 1226 1227 /** 1228 * @systemapi Hide this for inner system use. 1229 * @since 8 1230 */ 1231 export enum DialType { 1232 DIAL_CARRIER_TYPE = 0, 1233 DIAL_VOICE_MAIL_TYPE = 1, 1234 DIAL_OTT_TYPE = 2, 1235 } 1236 1237 /** 1238 * @systemapi Hide this for inner system use. 1239 * @since 7 1240 */ 1241 export interface RejectMessageOptions { 1242 messageContent: string; 1243 } 1244 1245 /** 1246 * @systemapi Hide this for inner system use. 1247 * @since 8 1248 */ 1249 export interface CallTransferResult { 1250 /** 1251 * Call forwarding status. 1252 * 1253 * @since 8 1254 */ 1255 status: TransferStatus; 1256 1257 /** 1258 * Call forwarding phone number. 1259 * 1260 * @since 8 1261 */ 1262 number: string; 1263 1264 /** 1265 * Start time hours. 1266 * 1267 * @since 9 1268 */ 1269 startHour: number; 1270 1271 /** 1272 * Start time minutes. 1273 * 1274 * @since 9 1275 */ 1276 startMinute: number; 1277 1278 /** 1279 * End time hours. 1280 * 1281 * @since 9 1282 */ 1283 endHour: number; 1284 1285 /** 1286 * End time minutes. 1287 * 1288 * @since 9 1289 */ 1290 endMinute: number; 1291 } 1292 1293 /** 1294 * @systemapi Hide this for inner system use. 1295 * @since 7 1296 */ 1297 export enum CallWaitingStatus { 1298 /** 1299 * Indicates that call waiting is not enabled. 1300 * 1301 * @since 7 1302 */ 1303 CALL_WAITING_DISABLE = 0, 1304 1305 /** 1306 * Indicates that call waiting is enabled. 1307 * 1308 * @since 7 1309 */ 1310 CALL_WAITING_ENABLE = 1 1311 } 1312 1313 /** 1314 * @systemapi Hide this for inner system use. 1315 * @since 8 1316 */ 1317 export enum RestrictionStatus { 1318 /** 1319 * Indicates that call barring is not enabled. 1320 * 1321 * @since 8 1322 */ 1323 RESTRICTION_DISABLE = 0, 1324 1325 /** 1326 * Indicates that call barring is enabled. 1327 * 1328 * @since 8 1329 */ 1330 RESTRICTION_ENABLE = 1 1331 } 1332 1333 /** 1334 * @systemapi Hide this for inner system use. 1335 * @since 8 1336 */ 1337 export enum TransferStatus { 1338 /** 1339 * Indicates that call forwarding is not enabled. 1340 * 1341 * @since 8 1342 */ 1343 TRANSFER_DISABLE = 0, 1344 1345 /** 1346 * Indicates that call forwarding is enabled. 1347 * 1348 * @since 8 1349 */ 1350 TRANSFER_ENABLE = 1 1351 } 1352 1353 /** 1354 * @since 7 1355 */ 1356 export interface EmergencyNumberOptions { 1357 /** 1358 * Indicates sim card slot number. 1359 * 1360 * @since 7 1361 */ 1362 slotId?: number; 1363 } 1364 1365 /** 1366 * @since 7 1367 */ 1368 export interface NumberFormatOptions { 1369 /** 1370 * Indicates the country code. 1371 * 1372 * @since 7 1373 */ 1374 countryCode?: string; 1375 } 1376 1377 /** 1378 * @systemapi Hide this for inner system use. 1379 * @since 9 1380 */ 1381 export interface AudioDeviceOptions { 1382 /** 1383 * Indicates the bluetooth device address. 1384 * 1385 * @since 9 1386 */ 1387 bluetoothAddress?: string; 1388 } 1389 1390 /** 1391 * @systemapi Hide this for inner system use. 1392 * @since 9 1393 */ 1394 export interface MmiCodeResults { 1395 /** 1396 * Indicates the result of MMI code. 1397 * 1398 * @since 9 1399 */ 1400 result: MmiCodeResult; 1401 1402 /** 1403 * Indicates the message of MMI code. 1404 * 1405 * @since 9 1406 */ 1407 message: string; 1408 } 1409 1410 /** 1411 * @systemapi Hide this for inner system use. 1412 * @since 9 1413 */ 1414 export enum MmiCodeResult { 1415 /** Indicates the result of MMI code with successfully. 1416 * 1417 * @since 9 1418 */ 1419 MMI_CODE_SUCCESS = 0, 1420 1421 /** Indicates the result of MMI code with failed. 1422 * 1423 * @since 9 1424 */ 1425 MMI_CODE_FAILED = 1 1426 } 1427 1428 /** 1429 * @systemapi Hide this for inner system use. 1430 * @since 8 1431 */ 1432 export enum DisconnectedReason { 1433 /** 1434 * Unassigned number. 1435 * 1436 * @since 8 1437 */ 1438 UNASSIGNED_NUMBER = 1, 1439 1440 /** 1441 * No route to destination. 1442 * 1443 * @since 8 1444 */ 1445 NO_ROUTE_TO_DESTINATION = 3, 1446 1447 /** 1448 * Channel unacceptable. 1449 * 1450 * @since 8 1451 */ 1452 CHANNEL_UNACCEPTABLE = 6, 1453 1454 /** 1455 * Operator determined barring. 1456 * 1457 * @since 8 1458 */ 1459 OPERATOR_DETERMINED_BARRING = 8, 1460 1461 /** 1462 * Call completed elsewhere. 1463 * 1464 * @since 9 1465 */ 1466 CALL_COMPLETED_ELSEWHERE = 13, 1467 1468 /** 1469 * Normal call clearing. 1470 * 1471 * @since 8 1472 */ 1473 NORMAL_CALL_CLEARING = 16, 1474 1475 /** 1476 * User busy. 1477 * 1478 * @since 8 1479 */ 1480 USER_BUSY = 17, 1481 1482 /** 1483 * No user responding. 1484 * 1485 * @since 8 1486 */ 1487 NO_USER_RESPONDING = 18, 1488 1489 /** 1490 * User alerting, no answer. 1491 * 1492 * @since 8 1493 */ 1494 USER_ALERTING_NO_ANSWER = 19, 1495 1496 /** 1497 * Call rejected. 1498 * 1499 * @since 8 1500 */ 1501 CALL_REJECTED = 21, 1502 1503 /** 1504 * Number changed. 1505 * 1506 * @since 8 1507 */ 1508 NUMBER_CHANGED = 22, 1509 1510 /** 1511 * Call rejected due to feature at the destination. 1512 * 1513 * @since 9 1514 */ 1515 CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION = 24, 1516 1517 /** 1518 * Pre-emption. 1519 * 1520 * @since 9 1521 */ 1522 FAILED_PRE_EMPTION = 25, 1523 1524 /** 1525 * Non selected user clearing. 1526 * 1527 * @since 9 1528 */ 1529 NON_SELECTED_USER_CLEARING = 26, 1530 1531 /** 1532 * Destination out of order. 1533 * 1534 * @since 8 1535 */ 1536 DESTINATION_OUT_OF_ORDER = 27, 1537 1538 /** 1539 * Invalid number format. 1540 * 1541 * @since 8 1542 */ 1543 INVALID_NUMBER_FORMAT = 28, 1544 1545 /** 1546 * Facility rejected. 1547 * 1548 * @since 9 1549 */ 1550 FACILITY_REJECTED = 29, 1551 1552 /** 1553 * Response to status enquiry. 1554 * 1555 * @since 9 1556 */ 1557 RESPONSE_TO_STATUS_ENQUIRY = 30, 1558 1559 /** 1560 * Normal, unspecified. 1561 * 1562 * @since 9 1563 */ 1564 NORMAL_UNSPECIFIED = 31, 1565 1566 /** 1567 * No circuit/channel available. 1568 * 1569 * @since 9 1570 */ 1571 NO_CIRCUIT_CHANNEL_AVAILABLE = 34, 1572 1573 /** 1574 * Network out of order. 1575 * 1576 * @since 8 1577 */ 1578 NETWORK_OUT_OF_ORDER = 38, 1579 1580 /** 1581 * Temporary failure. 1582 * 1583 * @since 8 1584 */ 1585 TEMPORARY_FAILURE = 41, 1586 1587 /** 1588 * Switching equipment congestion. 1589 * 1590 * @since 9 1591 */ 1592 SWITCHING_EQUIPMENT_CONGESTION = 42, 1593 1594 /** 1595 * Access information discarded. 1596 * 1597 * @since 9 1598 */ 1599 ACCESS_INFORMATION_DISCARDED = 43, 1600 1601 /** 1602 * Requested circuit/channel not available. 1603 * 1604 * @since 9 1605 */ 1606 REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE = 44, 1607 1608 /** 1609 * Resources unavailable unspecified. 1610 * 1611 * @since 9 1612 */ 1613 RESOURCES_UNAVAILABLE_UNSPECIFIED = 47, 1614 1615 /** 1616 * Quality of service unavailable. 1617 * 1618 * @since 9 1619 */ 1620 QUALITY_OF_SERVICE_UNAVAILABLE = 49, 1621 1622 /** 1623 * Requested facility not subscribed. 1624 * 1625 * @since 9 1626 */ 1627 REQUESTED_FACILITY_NOT_SUBSCRIBED = 50, 1628 1629 /** 1630 * Incoming calls barred within the CUG. 1631 * 1632 * @since 9 1633 */ 1634 INCOMING_CALLS_BARRED_WITHIN_THE_CUG = 55, 1635 1636 /** 1637 * Bearer capability not authorized. 1638 * 1639 * @since 9 1640 */ 1641 BEARER_CAPABILITY_NOT_AUTHORIZED = 57, 1642 1643 /** 1644 * Bearer capability not presently available. 1645 * 1646 * @since 9 1647 */ 1648 BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE = 58, 1649 1650 /** 1651 * Service or option not available, unspecified. 1652 * 1653 * @since 9 1654 */ 1655 SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED = 63, 1656 1657 /** 1658 * Bearer service not implemented. 1659 * 1660 * @since 9 1661 */ 1662 BEARER_SERVICE_NOT_IMPLEMENTED = 65, 1663 1664 /** 1665 * ACM equal to or greater than the maximum value. 1666 * 1667 * @since 9 1668 */ 1669 ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE = 68, 1670 1671 /** 1672 * Requested facility not implemented. 1673 * 1674 * @since 9 1675 */ 1676 REQUESTED_FACILITY_NOT_IMPLEMENTED = 69, 1677 1678 /** 1679 * Only restricted digital info BC available. 1680 * 1681 * @since 9 1682 */ 1683 ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE = 70, 1684 1685 /** 1686 * Service or option not implemented, unspecified. 1687 * 1688 * @since 9 1689 */ 1690 SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED = 79, 1691 1692 /** 1693 * Invalid transaction identifier value. 1694 * 1695 * @since 9 1696 */ 1697 INVALID_TRANSACTION_IDENTIFIER_VALUE = 81, 1698 1699 /** 1700 * User not member of CUG. 1701 * 1702 * @since 9 1703 */ 1704 USER_NOT_MEMBER_OF_CUG = 87, 1705 1706 /** 1707 * Incompatible destination. 1708 * 1709 * @since 9 1710 */ 1711 INCOMPATIBLE_DESTINATION = 88, 1712 1713 /** 1714 * Invalid transit network selection. 1715 * 1716 * @since 9 1717 */ 1718 INVALID_TRANSIT_NETWORK_SELECTION = 91, 1719 1720 /** 1721 * Semantically incorrect message. 1722 * 1723 * @since 9 1724 */ 1725 SEMANTICALLY_INCORRECT_MESSAGE = 95, 1726 1727 /** 1728 * Invalid mandatory information. 1729 * 1730 * @since 9 1731 */ 1732 INVALID_MANDATORY_INFORMATION = 96, 1733 1734 /** 1735 * Msg type non-existent or not implemented. 1736 * 1737 * @since 9 1738 */ 1739 MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97, 1740 1741 /** 1742 * Msg type not compatible with protocol state. 1743 * 1744 * @since 9 1745 */ 1746 MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98, 1747 1748 /** 1749 * IE non-existent or not implemented. 1750 * 1751 * @since 9 1752 */ 1753 INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99, 1754 1755 /** 1756 * Conditional IE error. 1757 * 1758 * @since 9 1759 */ 1760 CONDITIONAL_IE_ERROR = 100, 1761 1762 /** 1763 * Message not compatible with protocol state. 1764 * 1765 * @since 9 1766 */ 1767 MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101, 1768 1769 /** 1770 * Recovery on timer expiry timer number. 1771 * 1772 * @since 9 1773 */ 1774 RECOVERY_ON_TIMER_EXPIRED = 102, 1775 1776 /** 1777 * Protocol error, unspecified. 1778 * 1779 * @since 9 1780 */ 1781 PROTOCOL_ERROR_UNSPECIFIED = 111, 1782 1783 /** 1784 * Interworking, unspecified. 1785 * 1786 * @since 9 1787 */ 1788 INTERWORKING_UNSPECIFIED = 127, 1789 1790 /** 1791 * Call barred. 1792 * 1793 * @since 9 1794 */ 1795 CALL_BARRED = 240, 1796 1797 /** 1798 * FDN blocked. 1799 * 1800 * @since 9 1801 */ 1802 FDN_BLOCKED = 241, 1803 1804 /** 1805 * IMSI in VLR is unknown. 1806 * 1807 * @since 9 1808 */ 1809 IMSI_UNKNOWN_IN_VLR = 242, 1810 1811 /** 1812 * IMEI not accepted. 1813 * 1814 * @since 9 1815 */ 1816 IMEI_NOT_ACCEPTED = 243, 1817 1818 /** 1819 * Dial modified to USSD. 1820 * 1821 * @since 9 1822 */ 1823 DIAL_MODIFIED_TO_USSD = 244, 1824 1825 /** 1826 * Dial modified to SS. 1827 * 1828 * @since 9 1829 */ 1830 DIAL_MODIFIED_TO_SS = 245, 1831 1832 /** 1833 * Dial modified to dial. 1834 * 1835 * @since 9 1836 */ 1837 DIAL_MODIFIED_TO_DIAL = 246, 1838 1839 /** 1840 * Radio off. 1841 * 1842 * @since 9 1843 */ 1844 RADIO_OFF = 247, 1845 1846 /** 1847 * Out of service. 1848 * 1849 * @since 9 1850 */ 1851 OUT_OF_SERVICE = 248, 1852 1853 /** 1854 * Invalid SIM. 1855 * 1856 * @since 9 1857 */ 1858 NO_VALID_SIM = 249, 1859 1860 /** 1861 * Radio internal error. 1862 * 1863 * @since 9 1864 */ 1865 RADIO_INTERNAL_ERROR = 250, 1866 1867 /** 1868 * Network response timeout. 1869 * 1870 * @since 9 1871 */ 1872 NETWORK_RESP_TIMEOUT = 251, 1873 1874 /** 1875 * Network reject. 1876 * 1877 * @since 9 1878 */ 1879 NETWORK_REJECT = 252, 1880 1881 /** 1882 * Radio access failure. 1883 * 1884 * @since 9 1885 */ 1886 RADIO_ACCESS_FAILURE = 253, 1887 1888 /** 1889 * Radio link failure. 1890 * 1891 * @since 9 1892 */ 1893 RADIO_LINK_FAILURE = 254, 1894 1895 /** 1896 * Radio link lost. 1897 * 1898 * @since 9 1899 */ 1900 RADIO_LINK_LOST = 255, 1901 1902 /** 1903 * Radio uplink failure. 1904 * 1905 * @since 9 1906 */ 1907 RADIO_UPLINK_FAILURE = 256, 1908 1909 /** 1910 * Radio setup failure. 1911 * 1912 * @since 9 1913 */ 1914 RADIO_SETUP_FAILURE = 257, 1915 1916 /** 1917 * Radio release normal. 1918 * 1919 * @since 9 1920 */ 1921 RADIO_RELEASE_NORMAL = 258, 1922 1923 /** 1924 * Radio release abnormal. 1925 * 1926 * @since 9 1927 */ 1928 RADIO_RELEASE_ABNORMAL = 259, 1929 1930 /** 1931 * Access class blocked. 1932 * 1933 * @since 9 1934 */ 1935 ACCESS_CLASS_BLOCKED = 260, 1936 1937 /** 1938 * Network detach. 1939 * 1940 * @since 9 1941 */ 1942 NETWORK_DETACH = 261, 1943 1944 /** 1945 * Invalid parameter. 1946 * 1947 * @since 8 1948 */ 1949 INVALID_PARAMETER = 1025, 1950 1951 /** 1952 * Sim not exit. 1953 * 1954 * @since 8 1955 */ 1956 SIM_NOT_EXIT = 1026, 1957 1958 /** 1959 * Sim pin need. 1960 * 1961 * @since 8 1962 */ 1963 SIM_PIN_NEED = 1027, 1964 1965 /** 1966 * Call Not allow. 1967 * 1968 * @since 8 1969 */ 1970 CALL_NOT_ALLOW = 1029, 1971 1972 /** 1973 * Sim invalid. 1974 * 1975 * @since 8 1976 */ 1977 SIM_INVALID = 1045, 1978 1979 /** 1980 * Unknown error. 1981 * 1982 * @since 8 1983 */ 1984 UNKNOWN = 1279, 1985 } 1986 1987 /** 1988 * @systemapi Hide this for inner system use. 1989 * @since 9 1990 */ 1991 export interface DisconnectedDetails { 1992 /** 1993 * Indicates the reason for ending the call. 1994 */ 1995 reason: DisconnectedReason; 1996 /** 1997 * Indicates the message for ending the call. 1998 */ 1999 message: string; 2000 } 2001} 2002 2003export default call; 2004