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