Commit e127ef09 authored by Ghislain MARY's avatar Ghislain MARY

Send full state NOTIFY of a conference to a specific device.

parent c50ba661
......@@ -29,10 +29,11 @@
LINPHONE_BEGIN_NAMESPACE
class Participant;
class ParticipantDevice;
class LocalConferenceEventHandlerPrivate : public ObjectPrivate {
public:
void notifyFullState (const std::string &notify, const std::shared_ptr<Participant> &participant);
void notifyFullState (const std::string &notify, const std::shared_ptr<ParticipantDevice> &device);
void notifyAllExcept (const std::string &notify, const std::shared_ptr<Participant> &exceptParticipant);
void notifyAll (const std::string &notify);
std::string createNotifyFullState (int notifyId = -1);
......@@ -52,6 +53,7 @@ private:
std::string createNotify (Xsd::ConferenceInfo::ConferenceType confInfo, int notifyId = -1, bool isFullState = false);
void notifyParticipant (const std::string &notify, const std::shared_ptr<Participant> &participant);
void notifyParticipantDevice (const std::string &notify, const std::shared_ptr<ParticipantDevice> &device);
L_DECLARE_PUBLIC(LocalConferenceEventHandler);
};
......
......@@ -37,8 +37,8 @@ using namespace Xsd::ConferenceInfo;
// -----------------------------------------------------------------------------
void LocalConferenceEventHandlerPrivate::notifyFullState (const string &notify, const shared_ptr<Participant> &participant) {
notifyParticipant(notify, participant);
void LocalConferenceEventHandlerPrivate::notifyFullState (const string &notify, const shared_ptr<ParticipantDevice> &device) {
notifyParticipantDevice(notify, device);
}
void LocalConferenceEventHandlerPrivate::notifyAllExcept (const string &notify, const shared_ptr<Participant> &exceptParticipant) {
......@@ -54,14 +54,17 @@ void LocalConferenceEventHandlerPrivate::notifyAll (const string &notify) {
}
void LocalConferenceEventHandlerPrivate::notifyParticipant (const string &notify, const shared_ptr<Participant> &participant) {
for (const auto &device : participant->getPrivate()->getDevices()) {
if (device->isSubscribedToConferenceEventPackage()) {
LinphoneEvent *ev = device->getConferenceSubscribeEvent();
LinphoneContent *content = linphone_core_create_content(ev->lc);
linphone_content_set_buffer(content, (const uint8_t *)notify.c_str(), strlen(notify.c_str()));
linphone_event_notify(ev, content);
linphone_content_unref(content);
}
for (const auto &device : participant->getPrivate()->getDevices())
notifyParticipantDevice(notify, device);
}
void LocalConferenceEventHandlerPrivate::notifyParticipantDevice (const string &notify, const shared_ptr<ParticipantDevice> &device) {
if (device->isSubscribedToConferenceEventPackage()) {
LinphoneEvent *ev = device->getConferenceSubscribeEvent();
LinphoneContent *content = linphone_core_create_content(ev->lc);
linphone_content_set_buffer(content, (const uint8_t *)notify.c_str(), strlen(notify.c_str()));
linphone_event_notify(ev, content);
linphone_content_unref(content);
}
}
......@@ -280,9 +283,9 @@ void LocalConferenceEventHandler::subscribeReceived (LinphoneEvent *lev) {
if (linphone_event_get_subscription_state(lev) == LinphoneSubscriptionActive) {
unsigned int lastNotify = static_cast<unsigned int>(Utils::stoi(linphone_event_get_custom_header(lev, "Last-Notify-Version")));
if (lastNotify == 0) {
lInfo() << "Sending initial notify of conference:" << d->conf->getConferenceAddress().asStringUriOnly() << " to: " << participant->getAddress().asString();
lInfo() << "Sending initial notify of conference:" << d->conf->getConferenceAddress().asStringUriOnly() << " to: " << device->getGruu().asString();
device->setConferenceSubscribeEvent(lev);
d->notifyFullState(d->createNotifyFullState(), participant);
d->notifyFullState(d->createNotifyFullState(), device);
} else if (lastNotify < d->lastNotify) {
lInfo() << "Sending all missed notify for conference:" << d->conf->getConferenceAddress().asStringUriOnly() <<
" from: " << lastNotify << " to: " << participant->getAddress().asString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment