Ring Daemon 16.0.0
Loading...
Searching...
No Matches
sipaccountbase_config.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18#include "account_config.h"
19
20namespace jami {
21constexpr static const char* const OVERRTP_STR = "overrtp";
22constexpr static const char* const SIPINFO_STR = "sipinfo";
23constexpr static unsigned MAX_PORT {65536};
24constexpr static unsigned HALF_MAX_PORT {MAX_PORT / 2};
25
27 SipAccountBaseConfig(const std::string& type, const std::string& id, const std::filesystem::path& path)
29
30 void serializeDiff(YAML::Emitter& out, const SipAccountBaseConfig& def) const;
31 void unserialize(const YAML::Node& node) override;
32
33 std::map<std::string, std::string> toMap() const override;
34 void fromMap(const std::map<std::string, std::string>&) override;
35
39 std::string interface {"default"};
40
46
47 std::string publishedIp;
48
53 bool turnEnabled {false};
54
59 std::string turnServer;
60 std::string turnServerUserName;
61 std::string turnServerPwd;
62 std::string turnServerRealm;
63
64 std::string tlsCaListFile;
65 std::string tlsCertificateFile;
66 std::string tlsPrivateKeyFile;
67 std::string tlsPassword;
68
69 std::string dtmfType {OVERRTP_STR};
70 /*
71 * Port range for audio RTP ports
72 */
73 std::pair<uint16_t, uint16_t> audioPortRange {16384, 32766};
74
78 std::pair<uint16_t, uint16_t> videoPortRange {49152, (65536) -2};
79};
80
81inline void
82updateRange(uint16_t min, uint16_t max, std::pair<uint16_t, uint16_t>& range)
83{
84 if (min > 0 and (max > min) and max <= MAX_PORT - 2) {
85 range.first = min;
86 range.second = max;
87 }
88}
89
90}
void updateRange(uint16_t min, uint16_t max, std::pair< uint16_t, uint16_t > &range)
void emitSignal(Args... args)
Definition ring_signal.h:64
static constexpr unsigned MAX_PORT
static constexpr const char *const SIPINFO_STR
static constexpr unsigned HALF_MAX_PORT
static constexpr const char *const OVERRTP_STR
const std::string type
Account type.
const std::filesystem::path path
Path where the configuration file is stored.
const std::string id
Account id.
bool turnEnabled
Determine if TURN public address resolution is required to register this account.
bool publishedSameasLocal
Flag which determine if localIpAddress_ or publishedIpAddress_ is used in sip headers.
std::pair< uint16_t, uint16_t > videoPortRange
Port range for video RTP ports.
SipAccountBaseConfig(const std::string &type, const std::string &id, const std::filesystem::path &path)
void fromMap(const std::map< std::string, std::string > &) override
std::string turnServer
The TURN server hostname (optional), used to provide the public IP address in case the softphone stay...
void serializeDiff(YAML::Emitter &out, const SipAccountBaseConfig &def) const
std::pair< uint16_t, uint16_t > audioPortRange
void unserialize(const YAML::Node &node) override
std::map< std::string, std::string > toMap() const override