68 std::mutex randMutex_;
69 std::mt19937_64 rand_;
75 void setAutoAnswer(
bool enable);
96 PluginPreferences pluginPreferences;
103 VideoPreferences videoPreferences;
111 static bool isIOSExtension;
127 void finish() noexcept;
129 void monitor(
bool continuous);
131 std::vector<
std::map<
std::
string,
std::
string>> getConnectionList(const
std::
string& accountId,
132 const
std::
string& conversationId);
133 std::vector<
std::map<
std::
string,
std::
string>> getChannelList(const
std::
string& accountId,
134 const
std::
string& connectionId);
145 return std::make_unique<AudioDeviceGuard>(*
this, stream);
157 return std::make_unique<AudioDeviceGuard>(*
this, captureDevice);
168 std::string outgoingCall(
const std::string& accountId,
169 const std::string& callee,
170 const std::vector<libjami::MediaMap>& mediaList = {});
177 bool acceptCall(
const std::string& accountId,
178 const std::string& callId,
179 const std::vector<libjami::MediaMap>& mediaList = {});
180 bool acceptCall(Call& call,
const std::vector<libjami::MediaMap>& mediaList = {});
187 void incomingCall(
const std::string& accountId, Call& call);
195 bool hangupCall(
const std::string& accountId,
const std::string& callId);
202 bool hangupConference(
const std::string& accountId,
const std::string& confId);
210 bool holdCall(
const std::string& accountId,
const std::string& callId);
218 bool resumeCall(
const std::string& accountId,
const std::string& callId);
226 bool transferCall(
const std::string& accountId,
const std::string&
id,
const std::string& to);
231 void transferSucceeded();
236 void transferFailed();
243 bool refuseCall(
const std::string& accountId,
const std::string&
id);
249 bool holdConference(
const std::string& accountId,
const std::string& confId);
255 bool resumeConference(
const std::string& accountId,
const std::string& confId);
262 bool addSubCall(
const std::string& accountId,
263 const std::string& callId,
264 const std::string& account2Id,
265 const std::string& confId);
266 bool addSubCall(Call& call, Conference& conference);
267 void bindCallToConference(Call& call, Conference& conf);
281 const std::string& callId1,
282 const std::string& account2Id,
283 const std::string& callId2,
284 bool attached =
true);
303 bool detachHost(
const std::shared_ptr<Conference>& conf = {});
309 void removeParticipant(Call& call);
315 const std::string& confId1,
316 const std::string& account2Id,
317 const std::string& confId2);
319 void addAudio(Call& call);
321 void removeAudio(Call& call);
327 void saveConfig(
const std::shared_ptr<Account>& acc);
337 void playToneWithMessage();
349 void peerAnsweredCall(Call& call);
356 void peerRingingCall(Call& call);
362 void peerHungupCall(Call& call);
370 void incomingMessage(
const std::string& accountId,
371 const std::string& callId,
372 const std::string& from,
373 const std::map<std::string, std::string>& messages);
382 void sendCallTextMessage(
const std::string& accountId,
383 const std::string& callID,
384 const std::map<std::string, std::string>& messages,
385 const std::string& from,
395 void sendRegister(
const std::string& accountId,
bool enable);
398 const std::string& to,
399 const std::map<std::string, std::string>& payloads,
400 bool fromPlugin =
false,
401 bool onlyConnected =
false);
422 std::map<std::string, std::string>
getAccountDetails(
const std::string& accountID)
const;
444 void setAccountDetails(
const std::string& accountID,
const std::map<std::string, std::string>& details);
446 void setAccountActive(
const std::string& accountID,
bool active,
bool shutdownConnections);
449 std::mt19937_64 getSeededRandomEngine();
455 std::string getNewAccountId();
463 std::string
addAccount(
const std::map<std::string, std::string>& details,
const std::string& accountId = {});
465 void markAccountPending(
const std::string& accountId);
466 void markAccountReady(
const std::string& accountId);
474 void removeAccount(
const std::string& accountID,
bool flush =
false);
476 void removeAccounts();
489 void setAudioDevice(
int index, AudioDeviceType streamType);
561 bool isAGCEnabled()
const;
562 void setAGCState(
bool enabled);
581 bool toggleRecordingCall(
const std::string& accountId,
const std::string&
id);
589 void recordingPlaybackSeek(
const double value);
640 AudioFormat hardwareAudioFormatChanged(AudioFormat format);
648 AudioFormat audioFormatUsed(AudioFormat format);
659 void playRingtone(
const std::string& accountID);
670 void playDtmf(
char code);
675 void callBusy(Call& call);
680 void callFailure(Call& call);
686 std::shared_ptr<AudioLoop> getTelephoneTone();
692 std::shared_ptr<AudioLoop> getTelephoneFile();
698 bool incomingCallsWaiting();
704 std::shared_ptr<Call> getCurrentCall()
const;
710 const std::string& getCurrentCallId()
const;
717 bool isCurrentCall(
const Call& call)
const;
723 std::vector<std::string_view> loadAccountOrder()
const;
728 int loadAccountMap(
const YAML::Node& node);
734 std::shared_ptr<Call> getCallFromCallID(
const std::string& callID)
const;
739 RingBufferPool& getRingBufferPool();
745 bool hasCurrentCall()
const;
752 template<
class T = Account>
753 inline std::shared_ptr<T>
getAccount(std::string_view accountId)
const
755 return accountFactory.getAccount<T>(accountId);
762 template<
class T = Account>
765 const auto& account_order = loadAccountOrder();
766 const auto& all_accounts = accountFactory.getAllAccounts<T>();
767 std::vector<std::shared_ptr<T>> accountList;
768 accountList.reserve(all_accounts.size());
769 for (
const auto&
id : account_order) {
770 if (
auto acc = accountFactory.getAccount<T>(
id))
771 accountList.emplace_back(std::move(acc));
773 for (
auto& account : all_accounts) {
774 if (std::find(accountList.begin(), accountList.end(), account) == accountList.end())
775 accountList.emplace_back(std::move(account));
780 template<
class T = Account>
783 return accountFactory.accountCount<T>();
787 inline std::shared_ptr<T>
findAccount(
const std::function<
bool(
const std::shared_ptr<T>&)>& pred)
789 for (
const auto& account : getAllAccounts<T>()) {
797 bool hasAccount(
const std::string& accountID);
802 void registerAccounts();
812 void unregisterAccounts();
822 std::shared_ptr<Call> newOutgoingCall(std::string_view toUrl,
823 const std::string& accountId,
824 const std::vector<libjami::MediaMap>& mediaList);
828 const std::shared_ptr<dhtnet::IceTransportFactory>& getIceTransportFactory();
830 std::shared_ptr<asio::io_context> ioContext()
const;
831 std::shared_ptr<dhtnet::upnp::UPnPContext> upnpContext()
const;
833 std::map<std::string, std::string> getNearbyPeers(
const std::string& accountID);
844 std::shared_ptr<video::SinkClient> createSinkClient(
const std::string&
id =
"",
bool mixer =
false);
854 void createSinkClients(
const std::string& callId,
856 const std::vector<std::shared_ptr<video::VideoFrameActiveWriter>>& videoStreams,
857 std::map<std::string, std::shared_ptr<video::SinkClient>>& sinksMap,
858 const std::string& accountId =
"");
866 std::shared_ptr<video::SinkClient> getSinkClient(
const std::string&
id);
871 unsigned dhtLogLevel {0};
872 unsigned dhtnetLogLevel {0};
875 std::vector<libjami::Message> getLastMessages(
const std::string& accountID,
const uint64_t& base_timestamp);
888 std::shared_ptr<dhtnet::ChannelSocket> gitSocket(std::string_view accountId,
889 std::string_view deviceId,
890 std::string_view conversationId);
892 void setDefaultModerator(
const std::string& accountID,
const std::string& peerURI,
bool state);
893 std::vector<std::string> getDefaultModerators(
const std::string& accountID);
894 void enableLocalModerators(
const std::string& accountID,
bool state);
895 bool isLocalModeratorsEnabled(
const std::string& accountID);
896 void setAllModerators(
const std::string& accountID,
bool allModerators);
897 bool isAllModerators(
const std::string& accountID);
899 void insertGitTransport(git_smart_subtransport* tr, std::unique_ptr<P2PSubTransport>&& sub);
900 void eraseGitTransport(git_smart_subtransport* tr);
902 dhtnet::tls::CertificateStore& certStore(
const std::string& accountId)
const;
911 std::unique_ptr<ManagerPimpl> pimpl_;