~aleteoryx/muditaos

ref: b4568c32eb2a4b37e9dfbbe08c446430eee2145c muditaos/module-services/service-cellular/src/volte/VolteAllowedList.cpp -rw-r--r-- 1.5 KiB
b4568c32 — Kuba Kleczkowski [MOS-977] Added VoLTE support in additional countries 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "VolteAllowedList.hpp"
#include "ImsiParser_Poland.hpp"
#include "ImsiParser_UnitedStates.hpp"
#include "ImsiParser_Netherlands.hpp"
#include "ImsiParser_Germany.hpp"
#include "ImsiParser_Denmark.hpp"
#include "ImsiParser_GreatBritain.hpp"
#include "ImsiParser_Canada.hpp"
#include "ImsiParser_Austria.hpp"

#include "module-utils/log/Logger.hpp"

namespace
{
    template <typename Container, typename... Items>
    void pushBack(Container &container, Items &&...items)
    {
        (container.push_back(std::forward<Items>(items)), ...);
    }
} // namespace

namespace cellular::service
{
    auto VolteAllowedList::isVolteAllowed(const std::string &imsi) const -> bool
    {
        for (auto country : allowedList) {
            if (country.isAllowed(imsi)) {
                LOG_INFO("MCC supported, VoLTE allowed.");
                return true;
            }
        }

        LOG_ERROR("MCC not supported, VoLTE not allowed.");
        return false;
    }

    void VolteAllowedList::buildList()
    {
        pushBack(allowedList,
                 ImsiParserPL(),
                 ImsiParserUS(),
                 ImsiParserDK(),
                 ImsiParserDE(),
                 ImsiParserNL(),
                 ImsiParserGB(),
                 ImsiParserCA(),
                 ImsiParserAT());
    }
} // namespace cellular::service