Ring Daemon
Loading...
Searching...
No Matches
sipvoiplink.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
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include "noncopyable.h"
24
25#include <dhtnet/ip_utils.h>
26
28#include <pjsip.h>
29#include <pjlib.h>
30#include <pjsip_ua.h>
31#include <pjlib-util.h>
32#include <pjnath.h>
33#include <pjnath/stun_config.h>
34
35#include <memory>
36#include <functional>
37#include <thread>
38#include <atomic>
39
40namespace jami {
41
42class SIPCall;
43class SIPAccountBase;
44class SIPVoIPLink;
45class SipTransportBroker;
46
53{
54public:
57
61 void shutdown();
62
66 void handleEvents();
67
72
77
82
87
88public:
90
94 std::unique_ptr<SipTransportBroker> sipTransportBroker;
95
96 typedef std::function<void(std::vector<dhtnet::IpAddr>)> SrvResolveCallback;
97 void resolveSrvName(const std::string& name, pjsip_transport_type_e type, SrvResolveCallback&& cb);
98
102 std::shared_ptr<SIPAccountBase> guessAccount(std::string_view userName,
103 std::string_view server,
104 std::string_view fromUri) const;
105
106 int getModId();
109
112
123 const std::string& host,
124 std::string& address,
126
129 int stunPort,
130 std::string& address,
132
139 {
142 tp.u.transport = transport;
143 return tp;
144 }
145
146private:
148
149 mutable pj_caching_pool cp_;
150 sip_utils::PoolPtr pool_;
151 std::atomic_bool running_ {true};
152 std::thread sipThread_;
153
154 friend class SIPTest;
155};
156
157} // namespace jami
std::unique_ptr< pj_pool_t, PoolDeleter > PoolPtr
Definition sip_utils.h:174
void emitSignal(Args... args)
Definition jami_signal.h:64
Simple macro to hide class' copy constructor and assignment operator.
#define NON_COPYABLE(ClassName)
Definition noncopyable.h:30