52subscribeBuddy(
const std::string& accountId,
const std::string& uri,
bool flag)
55 auto pres = sipaccount->getPresence();
57 JAMI_DEBUG(
"{}ubscribePresence (acc:{}, buddy:{})",
61 pres->subscribeClient(uri, flag);
65 ringaccount->trackBuddyPresence(uri, flag);
67 JAMI_ERROR(
"Unable to find account {}", accountId);
76publish(
const std::string& accountId,
bool status,
const std::string& note)
79 auto pres = sipaccount->getPresence();
81 JAMI_DEBUG(
"Send Presence (acc:{}, status {}).",
83 status ?
"online" :
"offline");
84 pres->sendPresence(status, note);
88 acc->sendPresenceNote(note);
90 JAMI_ERROR(
"Unable to find account {}", accountId);
101 if (
auto sipaccount =
static_cast<SIPAccount *
>(account.get())) {
102 JAMI_DEBUG(
"Approve presence (acc:IP2IP, serv:{}, flag:{})", uri, flag);
104 if (
auto pres = sipaccount->getPresence())
105 pres->approvePresSubServer(uri, flag);
111 JAMI_ERROR(
"answerServerRequest() is deprecated and does nothing");
118std::vector<std::map<std::string, std::string>>
121 std::vector<std::map<std::string, std::string>> ret;
124 if (
auto pres = sipaccount->getPresence()) {
125 const auto& subs = pres->getClientSubscriptions();
126 ret.reserve(subs.size());
127 for (
const auto& s : subs) {
137 const auto& trackedBuddies = ringaccount->getTrackedBuddyPresence();
138 ret.reserve(trackedBuddies.size());
139 for (
const auto& tracked_id : trackedBuddies) {
146 JAMI_ERROR(
"Unable to find account {}", accountId);
158 if (
auto pres = sipaccount->getPresence()) {
159 for (
const auto& u : uris)
160 pres->subscribeClient(u,
true);
165 for (
const auto& u : uris)
166 acc->trackBuddyPresence(u,
true);
168 JAMI_ERROR(
"Unable to find account {}", accountId);
Ring Account is build on top of SIPAccountBase and uses DHT to handle call connectivity.
static LIBJAMI_TEST_EXPORT Manager & instance()
std::shared_ptr< T > getAccount(std::string_view accountId) const
Get an account pointer, looks for account of type T.
#define JAMI_ERROR(formatstr,...)
#define JAMI_DEBUG(formatstr,...)
static constexpr const char * ONLINE_KEY
static constexpr const char * LINESTATUS_KEY
static constexpr const char * OFFLINE_KEY
static constexpr const char * BUDDY_KEY
static constexpr const char * STATUS_KEY
std::vector< std::map< std::string, std::string > > getSubscriptions(const std::string &accountId)
Get all active subscriptions for "accountId".
void subscribeBuddy(const std::string &accountId, const std::string &uri, bool flag)
Un/subscribe to buddySipUri for an accountId.
void registerPresHandlers(const std::map< std::string, std::shared_ptr< CallbackWrapperBase > > &handlers)
void answerServerRequest(UNUSED const std::string &uri, UNUSED bool flag)
Accept or not a PresSubServer request for IP2IP account.
void registerSignalHandlers(const std::map< std::string, std::shared_ptr< CallbackWrapperBase > > &handlers)
void setSubscriptions(const std::string &accountId, const std::vector< std::string > &uris)
Batch subscribing of URIs.
void publish(const std::string &accountId, bool status, const std::string ¬e)
push a presence for a account Notify for IP2IP account For JamiAccount status is ignored but note is ...
A SIP Account specify SIP specific functions and object = SIPCall/SIPVoIPLink)
A SIP Presence manages buddy subscription in both PBX and IP2IP contexts.
#define PRESENCE_FUNCTION_SUBSCRIBE
#define PRESENCE_FUNCTION_PUBLISH