1 /* 2 * Copyright (C) 2023 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 16 #ifndef CALL_MANAGER_INFO_H 17 #define CALL_MANAGER_INFO_H 18 19 #include "call_manager_base.h" 20 21 namespace OHOS { 22 namespace Telephony { 23 /** 24 * @brief Indicates the cellular call detail information. 25 */ 26 struct CellularCallInfo { 27 /** 28 * Indicates the call index 29 */ 30 int32_t callId = 0; 31 /** 32 * Indicates the call phone number. 33 */ 34 char phoneNum[kMaxNumberLen] = { 0 }; 35 /** 36 * Indicates the slot id. 37 */ 38 int32_t slotId = 0; 39 int32_t accountId = 0; 40 /** 41 * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType} 42 */ 43 CallType callType = CallType::TYPE_ERR_CALL; 44 /** 45 * Indicates whether the call is video. 0: audio 1: send only 2: revive ony 3:video 46 */ 47 int32_t videoState = 0; 48 int32_t index = 0; 49 }; 50 51 /** 52 * @brief Indicates the cellular call event information. 53 */ 54 struct CellularCallEventInfo { 55 /** 56 * Indicates the call event type. {@link CellularCallEventType} 57 */ 58 CellularCallEventType eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE; 59 /** 60 * Indicates the call event id, one id corresponds to one request. 61 * {@link RequestResultEventId} 62 */ 63 RequestResultEventId eventId = RequestResultEventId::INVALID_REQUEST_RESULT_EVENT_ID; 64 }; 65 66 /** 67 * @brief Indicates the ringback tone playing mode. 68 */ 69 enum class RBTPlayInfo { 70 /** 71 * Indicates the mode is network, the tone is from network. 72 */ 73 NETWORK_ALERTING, 74 /** 75 * Indicates the mode is local, the tone is from local file. 76 */ 77 LOCAL_ALERTING, 78 }; 79 80 struct VoipCallReportInfo { 81 std::string voipCallId = ""; 82 std::string userName = ""; 83 std::vector<uint8_t> userProfile = {}; 84 std::string abilityName = ""; 85 std::string extensionId = ""; 86 std::string voipBundleName = ""; 87 bool showBannerForIncomingCall = true; 88 bool isConferenceCall = false; 89 bool isVoiceAnswerSupported = true; 90 bool hasMicPermission = true; 91 int32_t uid = 0; 92 }; 93 94 /** 95 * @brief Indicates detail information of the number mark. 96 */ 97 struct NumberMarkInfo { 98 /** 99 * Indicates the type of number mark. 100 */ 101 MarkType markType = MarkType::MARK_TYPE_NONE; 102 /** 103 * Indicates the content of number mark. 104 */ 105 char markContent[kMaxNumberLen + 1] = { 0 }; 106 /** 107 * Indicates the count of number mark. 108 */ 109 int32_t markCount = -1; 110 /** 111 * Indicates the source of number mark. 112 */ 113 char markSource[kMaxNumberLen + 1] = { 0 }; 114 /** 115 * Indicates if this is a number mark from cloud. 116 */ 117 bool isCloud = false; 118 }; 119 120 /** 121 * @brief Indicates the call event detail information. 122 */ 123 struct CallEventInfo { 124 /** 125 * Indicates the event ID of call ability. {@link CallAbilityEventId} 126 */ 127 CallAbilityEventId eventId = CallAbilityEventId::EVENT_DIAL_NO_CARRIER; 128 /** 129 * Indicates the call phone number. 130 */ 131 char phoneNum[kMaxNumberLen + 1] = { 0 }; 132 /** 133 * Indicates the bundle name. 134 */ 135 char bundleName[kMaxBundleNameLen + 1] = { 0 }; 136 }; 137 138 struct AccountInfo { 139 int32_t accountId = 0; 140 int32_t power = 0; 141 char bundleName[kMaxNumberLen + 1] = { 0 }; 142 bool isEnabled = false; 143 }; 144 145 /** 146 * @brief Indicates the call report information. 147 */ 148 struct CallReportInfo { 149 int32_t index = 0; 150 /** 151 * Indicates the call phone number. 152 */ 153 char accountNum[kMaxNumberLen + 1] = { 0 }; 154 int32_t accountId = 0; 155 /** 156 * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType} 157 */ 158 CallType callType = CallType::TYPE_ERR_CALL; 159 /** 160 * Indicates the type of video state. {@link VideoStateType} 161 */ 162 VideoStateType callMode = VideoStateType::TYPE_VOICE; 163 /** 164 * Indicates the detailed state of call. {@link TelCallState} 165 */ 166 TelCallState state = TelCallState::CALL_STATUS_UNKNOWN; 167 /** 168 * Indicates the voica domain, 0: CS, 1: IMS 169 */ 170 int32_t voiceDomain = 0; 171 /** 172 * Indicates the Multi-party call status: 173 * 0: not a multi-party(conference) call 174 * 1: a multi-party(conference) call 175 */ 176 int32_t mpty = 0; 177 /** 178 * Indicates the color tone type. 179 */ 180 int32_t crsType = 0; 181 /** 182 * Indicates the initial type of this call. 183 */ 184 int32_t originalCallType = 0; 185 /** 186 * Indicates the VoIP call specific information 187 */ 188 VoipCallReportInfo voipCallInfo; 189 /** 190 * Call state between with holdRequest and holdResponse 191 */ 192 bool isPendingHold = false; 193 }; 194 195 /** 196 * @brief Indicates the detail information of some calls record. 197 */ 198 struct CallsReportInfo { 199 /** 200 * Indicates a list of the call report information. 201 */ 202 std::vector<CallReportInfo> callVec {}; 203 /** 204 * Indicates the slot id. 205 */ 206 int32_t slotId = 0; 207 }; 208 209 /** 210 * @brief Indicates the detail information of a call. 211 */ 212 struct CallAttributeInfo { 213 /** 214 * Indicates the call phone number. 215 */ 216 char accountNumber[kMaxNumberLen + 1] = { 0 }; 217 /** 218 * Indicates the bundle name. 219 */ 220 char bundleName[kMaxBundleNameLen + 1] = { 0 }; 221 /** 222 * Indicates whether the speaker phone is on. 223 */ 224 bool speakerphoneOn = false; 225 int32_t accountId = 0; 226 /** 227 * Indicates the type of video state. {@link VideoStateType} 228 */ 229 VideoStateType videoState = VideoStateType::TYPE_VOICE; 230 /** 231 * Indicates the Call start time. 232 */ 233 int64_t startTime = 0; 234 /** 235 * Indicates whether the call is emergency call. 236 */ 237 bool isEcc = false; 238 /** 239 * Indicates whether the call is emergency Contact call. 240 */ 241 bool isEccContact = false; 242 /** 243 * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType} 244 */ 245 CallType callType = CallType::TYPE_ERR_CALL; 246 /** 247 * Indicates the call index. 248 */ 249 int32_t callId = 0; 250 /** 251 * Indicates the detailed state of call. {@link TelCallState} 252 */ 253 TelCallState callState = TelCallState::CALL_STATUS_UNKNOWN; 254 /** 255 * Indicates the state of conference call. {@link TelConferenceState} 256 */ 257 TelConferenceState conferenceState = TelConferenceState::TEL_CONFERENCE_IDLE; 258 /** 259 * Indicates the call beginning and ending time. 260 */ 261 time_t callBeginTime = 0; 262 time_t callCreateTime = 0; 263 time_t callEndTime = 0; 264 time_t ringBeginTime = 0; 265 time_t ringEndTime = 0; 266 /** 267 * Indicates the call is MO or MT. {@link CallDirection} 268 */ 269 CallDirection callDirection = CallDirection::CALL_DIRECTION_UNKNOW; 270 /** 271 * Indicates the cause when the call is answered. {@link CallAnswerType} 272 */ 273 CallAnswerType answerType = CallAnswerType::CALL_ANSWER_MISSED; 274 /* 275 * Indicates the call index in cellular call 276 */ 277 int32_t index = 0; 278 /** 279 * Indicates the color tone type. 280 */ 281 int32_t crsType = 0; 282 /** 283 * Indicates the initial type of this call. 284 */ 285 int32_t originalCallType = 0; 286 /** 287 * Indicates the VoIP call specific information 288 */ 289 VoipCallReportInfo voipCallInfo; 290 /** 291 * Indicates the location of phone number. 292 */ 293 char numberLocation[kMaxNumberLen + 1] = { 0 }; 294 /** 295 * Indicates the mark information of the phone number. 296 */ 297 NumberMarkInfo numberMarkInfo; 298 /** 299 * Indicates the reason of call blocked. 300 */ 301 int32_t blockReason = 0; 302 /** 303 * Indicates the type of celia call. 304 */ 305 int32_t celiaCallType = -1; 306 }; 307 308 /** 309 * @brief Indicates the detail information of call record. 310 */ 311 struct CallRecordInfo { 312 /** 313 * Indicates the call index. 314 */ 315 int32_t callId = 0; 316 /** 317 * Indicates the call phone number. 318 */ 319 char phoneNumber[kMaxNumberLen + 1] = { 0 }; 320 /** 321 * Indicates the number after formatted. 322 */ 323 char formattedNumber[kMaxNumberLen + 1] = { 0 }; 324 /** 325 * Indicates the phone number after formatted. 326 */ 327 char formattedNumberToE164[kMaxNumberLen + 1] = { 0 }; 328 /** 329 * Indicates the location of phone number. 330 */ 331 char numberLocation[kMaxNumberLen + 1] = { 0 }; 332 /** 333 * Indicates the type of call, includs CS, IMS, OTT, OTHER. {@link CallType} 334 */ 335 CallType callType = CallType::TYPE_ERR_CALL; 336 /** 337 * Indicates the type of video state. {@link VideoStateType} 338 */ 339 VideoStateType videoState = VideoStateType::TYPE_VOICE; 340 /** 341 * Indicates the call beginning time. 342 */ 343 time_t callBeginTime = 0; 344 /** 345 * Indicates the call create time. 346 */ 347 time_t callCreateTime = 0; 348 /** 349 * Indicates the call ending time. 350 */ 351 time_t callEndTime = 0; 352 /** 353 * Indicates the call ring duration. 354 */ 355 uint32_t ringDuration = 0; 356 /** 357 * Indicates the call session duration. 358 */ 359 uint32_t callDuration = 0; 360 /** 361 * Indicates the call is MO or MT. {@link CallDirection} 362 */ 363 CallDirection directionType = CallDirection::CALL_DIRECTION_UNKNOW; 364 /** 365 * Indicates the cause when the call is answered. {@link CallAnswerType} 366 */ 367 CallAnswerType answerType = CallAnswerType::CALL_ANSWER_MISSED; 368 /** 369 * Indicates the country code of the call. 370 */ 371 int32_t countryCode = 0; 372 /** 373 * Indicates the slot id. 374 */ 375 int32_t slotId = 0; 376 /** 377 * Indicates the call features. 378 */ 379 int32_t features = 0; 380 /** 381 * Indicates the mark information of the phone number. 382 */ 383 NumberMarkInfo numberMarkInfo; 384 /** 385 * Indicates the reason of call blocked. 386 */ 387 int32_t blockReason = 0; 388 389 /** 390 * Indicates the type of celia call. 391 */ 392 int32_t celiaCallType = -1; 393 CallRecordInfoCallRecordInfo394 CallRecordInfo() {} 395 CallRecordInfoCallRecordInfo396 CallRecordInfo(const CallRecordInfo &temp) 397 { 398 *this = temp; 399 } 400 401 CallRecordInfo &operator=(const CallRecordInfo &temp) 402 { 403 callId = temp.callId; 404 std::copy(std::begin(temp.phoneNumber), std::end(temp.phoneNumber), std::begin(phoneNumber)); 405 std::copy(std::begin(temp.formattedNumberToE164), std::end(temp.formattedNumberToE164), 406 std::begin(formattedNumberToE164)); 407 std::copy(std::begin(temp.formattedNumber), std::end(temp.formattedNumber), 408 std::begin(formattedNumber)); 409 std::copy(std::begin(temp.numberLocation), std::end(temp.numberLocation), 410 std::begin(numberLocation)); 411 callType = temp.callType; 412 callBeginTime = temp.callBeginTime; 413 callCreateTime = temp.callCreateTime; 414 callEndTime = temp.callEndTime; 415 ringDuration = temp.ringDuration; 416 callDuration = temp.callDuration; 417 directionType = temp.directionType; 418 answerType = temp.answerType; 419 countryCode = temp.countryCode; 420 slotId = temp.slotId; 421 videoState = temp.videoState; 422 features = temp.features; 423 numberMarkInfo.markType = temp.numberMarkInfo.markType; 424 std::copy(std::begin(temp.numberMarkInfo.markContent), std::end(temp.numberMarkInfo.markContent), 425 std::begin(numberMarkInfo.markContent)); 426 numberMarkInfo.markCount = temp.numberMarkInfo.markCount; 427 std::copy(std::begin(temp.numberMarkInfo.markSource), std::end(temp.numberMarkInfo.markSource), 428 std::begin(numberMarkInfo.markSource)); 429 numberMarkInfo.isCloud = temp.numberMarkInfo.isCloud; 430 blockReason = temp.blockReason; 431 celiaCallType = temp.celiaCallType; 432 return *this; 433 } 434 }; 435 436 /** 437 * @brief Indicates detail information of a call. 438 */ 439 struct CallDetailInfo { 440 /** 441 * Indicates the call index. 442 */ 443 int32_t index = 0; 444 /** 445 * Indicates the call phone number. 446 */ 447 char phoneNum[kMaxNumberLen + 1] = { 0 }; 448 /** 449 * Indicates the bundle name. 450 */ 451 char bundleName[kMaxBundleNameLen + 1] = { 0 }; 452 /** 453 * Indicates the account id. 454 */ 455 int32_t accountId = 0; 456 /** 457 * Indicates the call type, CS, IMS, ERROR 458 */ 459 CallType callType = CallType::TYPE_ERR_CALL; 460 /** 461 * Indicates the call video state, 0: audio 1:video. 462 */ 463 VideoStateType callMode = VideoStateType::TYPE_VOICE; 464 /** 465 * Indicates the call status. 466 */ 467 TelCallState state = TelCallState::CALL_STATUS_UNKNOWN; 468 /** 469 * Indicates the voice domain. 0: CS, 1: IMS 470 */ 471 int32_t voiceDomain = 0; 472 /** 473 * Indicates the Multi-party call status: 474 * 0: not a multi-party(conference) call 475 * 1: a multi-party(conference) call 476 */ 477 int32_t mpty = 0; 478 /** 479 * Indicates the color tone type. 480 */ 481 int32_t crsType = 0; 482 /** 483 * Indicates the initial type of this call. 484 */ 485 int32_t originalCallType = 0; 486 /** 487 * Indicates the VoIP call specific information 488 */ 489 VoipCallReportInfo voipCallInfo; 490 CallDetailInfoCallDetailInfo491 CallDetailInfo() {} 492 CallDetailInfoCallDetailInfo493 CallDetailInfo(const CallDetailInfo &temp) 494 { 495 *this = temp; 496 } 497 498 CallDetailInfo &operator=(const CallDetailInfo &temp) 499 { 500 index = temp.index; 501 std::copy(std::begin(temp.phoneNum), std::end(temp.phoneNum), std::begin(phoneNum)); 502 std::copy(std::begin(temp.bundleName), std::end(temp.bundleName), std::begin(bundleName)); 503 accountId = temp.accountId; 504 callType = temp.callType; 505 callMode = temp.callMode; 506 state = temp.state; 507 voiceDomain = temp.voiceDomain; 508 mpty = temp.mpty; 509 crsType = temp.crsType; 510 originalCallType = temp.originalCallType; 511 voipCallInfo.voipCallId = temp.voipCallInfo.voipCallId; 512 voipCallInfo.extensionId = temp.voipCallInfo.extensionId; 513 voipCallInfo.userName = temp.voipCallInfo.userName; 514 (voipCallInfo.userProfile).assign( 515 (temp.voipCallInfo.userProfile).begin(), (temp.voipCallInfo.userProfile).end()); 516 voipCallInfo.abilityName = temp.voipCallInfo.abilityName; 517 voipCallInfo.voipBundleName = temp.voipCallInfo.voipBundleName; 518 voipCallInfo.showBannerForIncomingCall = temp.voipCallInfo.showBannerForIncomingCall; 519 voipCallInfo.isConferenceCall = temp.voipCallInfo.isConferenceCall; 520 voipCallInfo.isVoiceAnswerSupported = temp.voipCallInfo.isVoiceAnswerSupported; 521 voipCallInfo.hasMicPermission = temp.voipCallInfo.hasMicPermission; 522 voipCallInfo.uid = temp.voipCallInfo.uid; 523 return *this; 524 } 525 }; 526 527 /** 528 * @brief Indicates detail information of some calls. 529 */ 530 struct CallDetailsInfo { 531 /** 532 * Indicates a CallDetailInfo list. {@link CallDetailInfo} 533 */ 534 std::vector<CallDetailInfo> callVec {}; 535 /** 536 * Indicates the slot id. 537 */ 538 int32_t slotId = 0; 539 /** 540 * Indicates the bundle name. 541 */ 542 char bundleName[kMaxBundleNameLen + 1] = { 0 }; 543 }; 544 545 /** 546 * @brief Indicates the type of call transfer setting. 547 * 548 * 27007-430_2001 7.11 Call forwarding number and conditions +CCFC 549 * 3GPP TS 22.082 [4] 550 * <mode>: 551 * 0 disable 552 * 1 enable 553 * 3 registration 554 * 4 erasure 555 */ 556 enum class CallTransferSettingType { 557 /** 558 * Indicates disable the call transfer. 559 */ 560 CALL_TRANSFER_DISABLE = 0, 561 /** 562 * Indicates enable the call transfer. 563 */ 564 CALL_TRANSFER_ENABLE = 1, 565 /** 566 * Indicates register the call transfer. 567 */ 568 CALL_TRANSFER_REGISTRATION = 3, 569 /** 570 * Indicates erasure the call transfer. 571 */ 572 CALL_TRANSFER_ERASURE = 4, 573 }; 574 575 /** 576 * @brief Indicates the Call forwarding type 577 * 578 * 27007-430_2001 7.11 Call forwarding number and conditions +CCFC 579 * 3GPP TS 22.082 [4] 580 * <reason>: 581 * 0 unconditional 582 * 1 mobile busy 583 * 2 no reply 584 * 3 not reachable 585 */ 586 enum class CallTransferType { 587 /** 588 * Indicates transfer the call unconditionally. 589 */ 590 TRANSFER_TYPE_UNCONDITIONAL = 0, 591 /** 592 * Indicates transfer the call when busy. 593 */ 594 TRANSFER_TYPE_BUSY = 1, 595 /** 596 * Indicates transfer the call when no reply. 597 */ 598 TRANSFER_TYPE_NO_REPLY = 2, 599 /** 600 * Indicates transfer the call when unreachable. 601 */ 602 TRANSFER_TYPE_NOT_REACHABLE = 3, 603 }; 604 605 /** 606 * @brief Indicates the information of call transfer. 607 */ 608 struct CallTransferInfo { 609 /** 610 * Indication the phone number which will forward to. 611 */ 612 char transferNum[kMaxNumberLen + 1] = { 0 }; 613 /** 614 * Indicates the type of call transfer setting. {@link CallTransferSettingType} 615 */ 616 CallTransferSettingType settingType = CallTransferSettingType::CALL_TRANSFER_DISABLE; 617 /** 618 * Indicates the Call forwarding type. {@link CallTransferType} 619 */ 620 CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; 621 /** 622 * Start time hours. 623 */ 624 int32_t startHour = 0; 625 /** 626 * Start time minutes. 627 */ 628 int32_t startMinute = 0; 629 /** 630 * End time hours. 631 */ 632 int32_t endHour = 0; 633 /** 634 * End time minutes. 635 */ 636 int32_t endMinute = 0; 637 }; 638 639 /** 640 * @brief Indicates the type of call restriction. 641 * 642 * 3GPP TS 22.030 V4.0.0 (2001-03) 643 * 3GPP TS 22.088 V4.0.0 (2001-03) 644 */ 645 enum class CallRestrictionType { 646 /** 647 * Indicates restrict all incoming calls. 648 */ 649 RESTRICTION_TYPE_ALL_INCOMING = 0, 650 /** 651 * Indicates restrict all outgoing calls. 652 */ 653 RESTRICTION_TYPE_ALL_OUTGOING, 654 /** 655 * Indicates restrict international calls. 656 */ 657 RESTRICTION_TYPE_INTERNATIONAL, 658 /** 659 * Indicates restrict international roaming calls. 660 */ 661 RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME, 662 /** 663 * Indicates restrict roaming calls. 664 */ 665 RESTRICTION_TYPE_ROAMING_INCOMING, 666 /** 667 * Indicates restrict all calls. 668 */ 669 RESTRICTION_TYPE_ALL_CALLS, 670 /** 671 * Indicates restrict all outgoing services. 672 */ 673 RESTRICTION_TYPE_OUTGOING_SERVICES, 674 /** 675 * Indicates restrict all incoming services. 676 */ 677 RESTRICTION_TYPE_INCOMING_SERVICES, 678 }; 679 680 /** 681 * @brief Indicates the mode of call restriction. 682 * 683 * 3GPP TS 22.088 V4.0.0 (2001-03) 684 */ 685 enum class CallRestrictionMode { 686 /** 687 * Indicates call restriction is deactivated. 688 */ 689 RESTRICTION_MODE_DEACTIVATION = 0, 690 /** 691 * Indicates call restriction is activated. 692 */ 693 RESTRICTION_MODE_ACTIVATION = 1, 694 }; 695 696 /** 697 * @brief Indicates the information of call restriction. 698 */ 699 struct CallRestrictionInfo { 700 /** 701 * Indicates the password required to set call restrictions. 702 */ 703 char password[kMaxNumberLen + 1] = { 0 }; 704 /** 705 * Indicates the type of call restriction. 706 */ 707 CallRestrictionType fac = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; 708 /** 709 * Indicates the mode of call restriction. 710 */ 711 CallRestrictionMode mode = CallRestrictionMode::RESTRICTION_MODE_DEACTIVATION; 712 }; 713 } // namespace Telephony 714 } // namespace OHOS 715 #endif // CALL_MANAGER_INFO_H