Ring Daemon
Loading...
Searching...
No Matches
sipaccountbase_config.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2026 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{
28 SipAccountBaseConfig(const std::string& type, const std::string& id, const std::filesystem::path& path)
30 {}
31
32 void serializeDiff(YAML::Emitter& out, const SipAccountBaseConfig& def) const;
33 void unserialize(const YAML::Node& node) override;
34
35 std::map<std::string, std::string> toMap() const override;
36 void fromMap(const std::map<std::string, std::string>&) override;
37
41 std::string interface {"default"};
42
48
49 std::string publishedIp;
50
55 bool turnEnabled {false};
56
61 std::string turnServer;
62 std::string turnServerUserName;
63 std::string turnServerPwd;
64 std::string turnServerRealm;
65
66 std::string tlsCaListFile;
67 std::string tlsCertificateFile;
68 std::string tlsPrivateKeyFile;
69 std::string tlsPassword;
70
71 std::string dtmfType {OVERRTP_STR};
72 /*
73 * Port range for audio RTP ports
74 */
75 std::pair<uint16_t, uint16_t> audioPortRange {16384, 32766};
76
80 std::pair<uint16_t, uint16_t> videoPortRange {49152, (65536) - 2};
81};
82
83inline void
84updateRange(uint16_t min, uint16_t max, std::pair<uint16_t, uint16_t>& range)
85{
86 if (min > 0 and (max > min) and max <= MAX_PORT - 2) {
87 range.first = min;
88 range.second = max;
89 }
90}
91
92} // namespace jami
void updateRange(uint16_t min, uint16_t max, std::pair< uint16_t, uint16_t > &range)
void emitSignal(Args... args)
Definition jami_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