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(
132 const
std::
string& accountId, 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);
156 std::string outgoingCall(
const std::string& accountId,
157 const std::string& callee,
158 const std::vector<libjami::MediaMap>& mediaList = {});
165 bool answerCall(
const std::string& accountId,
166 const std::string& callId,
167 const std::vector<libjami::MediaMap>& mediaList = {});
168 bool answerCall(Call& call,
const std::vector<libjami::MediaMap>& mediaList = {});
175 void incomingCall(
const std::string& accountId, Call& call);
183 bool hangupCall(
const std::string& accountId,
const std::string& callId);
190 bool hangupConference(
const std::string& accountId,
const std::string& confId);
198 bool onHoldCall(
const std::string& accountId,
const std::string& callId);
206 bool offHoldCall(
const std::string& accountId,
const std::string& callId);
214 bool transferCall(
const std::string& accountId,
const std::string&
id,
const std::string& to);
219 void transferSucceeded();
224 void transferFailed();
231 bool refuseCall(
const std::string& accountId,
const std::string&
id);
237 bool holdConference(
const std::string& accountId,
const std::string& confId);
243 bool unHoldConference(
const std::string& accountId,
const std::string& confId);
250 bool addSubCall(
const std::string& accountId,
251 const std::string& callId,
252 const std::string& account2Id,
253 const std::string& confId);
254 bool addSubCall(Call& call, Conference& conference);
255 void bindCallToConference(Call& call, Conference& conf);
269 const std::string& callId1,
270 const std::string& account2Id,
271 const std::string& callId2,
272 bool attached =
true);
279 const std::vector<std::string>&);
292 bool detachHost(
const std::shared_ptr<Conference>& conf = {});
298 void removeParticipant(Call& call);
304 const std::string& confId1,
305 const std::string& account2Id,
306 const std::string& confId2);
308 void addAudio(Call& call);
310 void removeAudio(Call& call);
316 void saveConfig(
const std::shared_ptr<Account>& acc);
326 void playToneWithMessage();
338 void peerAnsweredCall(Call& call);
345 void peerRingingCall(Call& call);
351 void peerHungupCall(Call& call);
359 void incomingMessage(
const std::string& accountId,
360 const std::string& callId,
361 const std::string& from,
362 const std::map<std::string, std::string>& messages);
371 void sendCallTextMessage(
const std::string& accountId,
372 const std::string& callID,
373 const std::map<std::string, std::string>& messages,
374 const std::string& from,
384 void sendRegister(
const std::string& accountId,
bool enable);
387 const std::string& to,
388 const std::map<std::string, std::string>& payloads,
389 bool fromPlugin =
false,
390 bool onlyConnected =
false);
411 std::map<std::string, std::string>
getAccountDetails(
const std::string& accountID)
const;
434 const std::map<std::string, std::string>& details);
438 bool shutdownConnections);
441 const std::string& convId);
443 std::mt19937_64 getSeededRandomEngine();
449 std::string getNewAccountId();
457 std::string
addAccount(
const std::map<std::string, std::string>& details,
458 const std::string& accountId = {});
466 void removeAccount(
const std::string& accountID,
bool flush =
false);
468 void removeAccounts();
481 void setAudioDevice(
int index, AudioDeviceType streamType);
529 bool isAGCEnabled()
const;
530 void setAGCState(
bool enabled);
549 bool toggleRecordingCall(
const std::string& accountId,
const std::string&
id);
557 void recordingPlaybackSeek(
const double value);
608 AudioFormat hardwareAudioFormatChanged(AudioFormat format);
616 AudioFormat audioFormatUsed(AudioFormat format);
627 void playRingtone(
const std::string& accountID);
638 void playDtmf(
char code);
643 void callBusy(Call& call);
648 void callFailure(Call& call);
654 std::shared_ptr<AudioLoop> getTelephoneTone();
660 std::shared_ptr<AudioLoop> getTelephoneFile();
666 bool incomingCallsWaiting();
672 std::shared_ptr<Call> getCurrentCall()
const;
678 const std::string& getCurrentCallId()
const;
685 bool isCurrentCall(
const Call& call)
const;
691 std::vector<std::string_view> loadAccountOrder()
const;
696 int loadAccountMap(
const YAML::Node& node);
702 std::shared_ptr<Call> getCallFromCallID(
const std::string& callID)
const;
707 RingBufferPool& getRingBufferPool();
713 bool hasCurrentCall()
const;
720 template<
class T = Account>
721 inline std::shared_ptr<T>
getAccount(std::string_view accountId)
const
723 return accountFactory.getAccount<T>(accountId);
730 template<
class T = Account>
733 const auto& account_order = loadAccountOrder();
734 const auto& all_accounts = accountFactory.getAllAccounts<T>();
735 std::vector<std::shared_ptr<T>> accountList;
736 accountList.reserve(all_accounts.size());
737 for (
const auto&
id : account_order) {
738 if (
auto acc = accountFactory.getAccount<T>(
id))
739 accountList.emplace_back(std::move(acc));
741 for (
auto& account : all_accounts) {
742 if (std::find(accountList.begin(), accountList.end(), account) == accountList.end())
743 accountList.emplace_back(std::move(account));
748 template<
class T = Account>
751 return accountFactory.accountCount<T>();
755 inline std::shared_ptr<T>
findAccount(
const std::function<
bool(
const std::shared_ptr<T>&)>& pred)
757 for (
const auto& account : getAllAccounts<T>()) {
765 bool hasAccount(
const std::string& accountID);
770 void registerAccounts();
780 void unregisterAccounts();
790 std::shared_ptr<Call> newOutgoingCall(std::string_view toUrl,
791 const std::string& accountId,
792 const std::vector<libjami::MediaMap>& mediaList);
796 const std::shared_ptr<dhtnet::IceTransportFactory>& getIceTransportFactory();
798 std::shared_ptr<asio::io_context> ioContext()
const;
799 std::shared_ptr<dhtnet::upnp::UPnPContext> upnpContext()
const;
802 std::shared_ptr<Task> scheduleTask(std::function<
void()>&& task,
803 std::chrono::steady_clock::time_point when,
807 std::shared_ptr<Task> scheduleTaskIn(std::function<
void()>&& task,
808 std::chrono::steady_clock::duration timeout,
812 std::map<std::string, std::string> getNearbyPeers(
const std::string& accountID);
823 std::shared_ptr<video::SinkClient> createSinkClient(
const std::string&
id =
"",
834 void createSinkClients(
835 const std::string& callId,
837 const std::vector<std::shared_ptr<video::VideoFrameActiveWriter>>& videoStreams,
838 std::map<std::string, std::shared_ptr<video::SinkClient>>& sinksMap,
839 const std::string& accountId =
"");
847 std::shared_ptr<video::SinkClient> getSinkClient(
const std::string&
id);
852 unsigned dhtLogLevel {0};
855 std::vector<libjami::Message> getLastMessages(
const std::string& accountID,
856 const uint64_t& base_timestamp);
869 std::shared_ptr<dhtnet::ChannelSocket> gitSocket(std::string_view accountId,
870 std::string_view deviceId,
871 std::string_view conversationId);
873 void setDefaultModerator(
const std::string& accountID,
const std::string& peerURI,
bool state);
874 std::vector<std::string> getDefaultModerators(
const std::string& accountID);
875 void enableLocalModerators(
const std::string& accountID,
bool state);
876 bool isLocalModeratorsEnabled(
const std::string& accountID);
877 void setAllModerators(
const std::string& accountID,
bool allModerators);
878 bool isAllModerators(
const std::string& accountID);
880 void insertGitTransport(git_smart_subtransport* tr, std::unique_ptr<P2PSubTransport>&& sub);
881 void eraseGitTransport(git_smart_subtransport* tr);
883 dhtnet::tls::CertificateStore& certStore(
const std::string& accountId)
const;
892 std::unique_ptr<ManagerPimpl> pimpl_;