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