Commit 4387c3ed authored by Andrea Gianarda's avatar Andrea Gianarda
Browse files

Rework conference.

When participants are added to a local conference, a remote conference is created that allow the remote participants to receive notifications about newly added participants and other events if the event conference package is enabled
Delete private classes of LocalConferenceEventHandler, RemoteConferenceEventHandler, Participant, ParticipantDevice, Conference, LocalConference, RemoteConference, RemoteConferenceEventHandler, LocalConferenceEventHandler
Send 200OK to subscribes whose state is terminated and expires field is set to 0
Create audio video conference tester whose task is to verify conference behaviour
parent d76cbdcb
......@@ -72,7 +72,7 @@ option(ENABLE_PACKAGE_SOURCE "Create 'package_source' target for source archive
cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS NO)
if(NOT CMAKE_BUILD_TYPE)
......@@ -279,6 +279,7 @@ if(MSVC)
list(APPEND STRICT_OPTIONS_CPP "/wd4995") # Disable "name was marked as #pragma deprecated" warnings
list(APPEND STRICT_OPTIONS_CPP "/wd4996") # Disable deprecated function warnings
list(APPEND STRICT_OPTIONS_CPP "/wd4800") # Disable warning for cast from bool_t to bool
list(APPEND STRICT_OPTIONS_CPP "/wd4251") # Disable warning for missing dll export
if(ENABLE_STRICT)
list(APPEND STRICT_OPTIONS_CPP "/WX")
endif()
......
......@@ -67,6 +67,7 @@ set(LINPHONE_SOURCE_FILES_C
im_encryption_engine.c
linphonecall.c
linphonecore.c
linphoneconference.c
linphone_tunnel_config.c
localplayer.c
logging.c
......@@ -126,9 +127,6 @@ endif()
if(BELCARD_FOUND)
list(APPEND LINPHONE_SOURCE_FILES_CXX vcard.cc)
if(NOT MSVC)
list(APPEND STRICT_OPTIONS_CXX "-std=c++11")
endif()
else()
list(APPEND LINPHONE_SOURCE_FILES_C vcard_stubs.c)
endif()
......
......@@ -202,6 +202,11 @@ bool_t sal_address_has_param(const SalAddress *addr, const char *name){
return !!belle_sip_parameters_has_parameter(parameters, name);
}
void sal_address_remove_param(const SalAddress *addr, const char *name) {
belle_sip_parameters_t* parameters = BELLE_SIP_PARAMETERS(addr);
belle_sip_parameters_remove_parameter(parameters, name);
}
const char * sal_address_get_param(const SalAddress *addr, const char *name) {
belle_sip_parameters_t* parameters = BELLE_SIP_PARAMETERS(addr);
return belle_sip_parameters_get_parameter(parameters, name);
......
......@@ -101,56 +101,53 @@ static void call_received(SalCallOp *h) {
fromAddr = linphone_address_new(h->getFrom().c_str());
LinphoneAddress *toAddr = linphone_address_new(h->getTo().c_str());
if (_linphone_core_is_conference_creation(lc, toAddr)) {
#ifdef HAVE_ADVANCED_IM
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
string oneToOneChatRoom = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room"));
if (oneToOneChatRoom == "true") {
bool_t oneToOneChatRoomEnabled = linphone_config_get_bool(linphone_core_get_config(lc), "misc", "enable_one_to_one_chat_room", TRUE);
if (!oneToOneChatRoomEnabled) {
h->decline(SalReasonNotAcceptable);
h->release();
return;
}
IdentityAddress from(h->getFrom());
list<IdentityAddress> identAddresses = ServerGroupChatRoom::parseResourceLists(h->getRemoteBody());
if (identAddresses.size() != 1) {
h->decline(SalReasonNotAcceptable);
h->release();
return;
}
const char *endToEndEncryptedStr = sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted");
bool encrypted = endToEndEncryptedStr && strcmp(endToEndEncryptedStr, "true") == 0;
IdentityAddress confAddr = L_GET_PRIVATE_FROM_C_OBJECT(lc)->mainDb->findOneToOneConferenceChatRoomAddress(from, identAddresses.front(), encrypted);
if (confAddr.isValid()) {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ConferenceId(confAddr, confAddr));
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->confirmRecreation(h);
return;
}
}
_linphone_core_create_server_group_chat_room(lc, h);
}
// TODO: handle media conference creation if the "text" feature tag is not present
return;
#else
ms_warning("Advanced IM such as group chat is disabled!");
return;
#endif
}
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
#ifdef HAVE_ADVANCED_IM
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (linphone_core_conference_server_enabled(lc)) {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ConferenceId(IdentityAddress(h->getTo()), IdentityAddress(h->getTo()))
ConferenceId(ConferenceAddress(Address(h->getTo())), ConferenceAddress(Address(h->getTo())))
);
if (chatRoom) {
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->confirmJoining(h);
} else if (_linphone_core_is_conference_creation(lc, toAddr)) {
#ifdef HAVE_ADVANCED_IM
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
string oneToOneChatRoom = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room"));
if (oneToOneChatRoom == "true") {
bool_t oneToOneChatRoomEnabled = linphone_config_get_bool(linphone_core_get_config(lc), "misc", "enable_one_to_one_chat_room", TRUE);
if (!oneToOneChatRoomEnabled) {
h->decline(SalReasonNotAcceptable);
h->release();
return;
}
IdentityAddress from(h->getFrom());
list<IdentityAddress> identAddresses = ServerGroupChatRoom::parseResourceLists(h->getRemoteBody());
if (identAddresses.size() != 1) {
h->decline(SalReasonNotAcceptable);
h->release();
return;
}
const char *endToEndEncryptedStr = sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted");
bool encrypted = endToEndEncryptedStr && strcmp(endToEndEncryptedStr, "true") == 0;
IdentityAddress confAddr = L_GET_PRIVATE_FROM_C_OBJECT(lc)->mainDb->findOneToOneConferenceChatRoomAddress(from, identAddresses.front(), encrypted);
if (confAddr.isValid()) {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ConferenceId(confAddr, confAddr));
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->confirmRecreation(h);
return;
}
}
_linphone_core_create_server_group_chat_room(lc, h);
}
// TODO: handle media conference creation if the "text" feature tag is not present
return;
#else
ms_warning("Advanced IM such as group chat is disabled!");
return;
#endif
} else {
//invite is for an unknown chatroom
h->decline(SalReasonNotFound);
......@@ -158,7 +155,7 @@ static void call_received(SalCallOp *h) {
}
} else {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ConferenceId(IdentityAddress(h->getFrom()), IdentityAddress(h->getTo()))
ConferenceId(ConferenceAddress(Address(h->getFrom())), ConferenceAddress(Address(h->getTo())))
);
if (chatRoom && chatRoom->getCapabilities() & ChatRoom::Capabilities::Basic) {
lError() << "Invalid basic chat room found. It should have been a ClientGroupChatRoom... Recreating it...";
......@@ -169,7 +166,7 @@ static void call_received(SalCallOp *h) {
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted"));
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(
h->getSubject(),
ConferenceId(IdentityAddress(h->getRemoteContact()), IdentityAddress(h->getTo())),
ConferenceId(ConferenceAddress(Address(h->getRemoteContact())), ConferenceAddress(Address(h->getTo()))),
h->getRemoteBody(),
endToEndEncrypted == "true"
);
......@@ -180,6 +177,8 @@ static void call_received(SalCallOp *h) {
L_GET_PRIVATE(static_pointer_cast<ClientGroupChatRoom>(chatRoom))->addOneToOneCapability();
L_GET_PRIVATE(static_pointer_cast<ClientGroupChatRoom>(chatRoom))->confirmJoining(h);
}
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
return;
#else
ms_warning("Advanced IM such as group chat is disabled!");
......@@ -188,7 +187,9 @@ static void call_received(SalCallOp *h) {
} else {
// TODO: handle media conference joining if the "text" feature tag is not present
}
/* First check if we can answer successfully to this invite */
LinphonePresenceActivity *activity = nullptr;
if ((linphone_presence_model_get_basic_status(lc->presence_model) == LinphonePresenceBasicStatusClosed)
......@@ -297,7 +298,7 @@ static void call_accepted(SalOp *op) {
static void call_refreshed(SalOp *op) {
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
if (!session) {
ms_warning("call_updating: CallSession no longer exists");
ms_warning("call_refreshed: CallSession no longer exists");
return;
}
auto sessionRef = session->getSharedFromThis();
......@@ -310,7 +311,7 @@ static void call_refreshed(SalOp *op) {
static void call_refreshing(SalOp *op) {
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
if (!session) {
ms_warning("call_updating: CallSession no longer exists");
ms_warning("call_refreshing: CallSession no longer exists");
return;
}
auto sessionRef = session->getSharedFromThis();
......@@ -725,8 +726,14 @@ static void subscribe_response(SalOp *op, SalSubscribeStatus status, int will_re
}else{
if (will_retry && linphone_core_get_global_state(lc) != LinphoneGlobalShutdown ){
linphone_event_set_state(lev,LinphoneSubscriptionOutgoingProgress);
} else {
// If it is in GlobalShutDown state, the remote conference event handler may be destroyed by the time this event reaches the state changed callback
// Subscriptipn are terminated by destructors
if (linphone_core_get_global_state(lc) == LinphoneGlobalShutdown ){
linphone_event_set_user_data(lev, NULL);
}
linphone_event_set_state(lev,LinphoneSubscriptionError);
}
else linphone_event_set_state(lev,LinphoneSubscriptionError);
}
}
......@@ -764,6 +771,11 @@ static void subscribe_received(SalSubscribeOp *op, const char *eventname, const
lev=linphone_event_new_with_op(lc,op,LinphoneSubscriptionIncoming,eventname);
linphone_event_set_state(lev,LinphoneSubscriptionIncomingReceived);
LinphoneContent *ct = linphone_content_from_sal_body_handler(body_handler);
Address to(op->getTo());
LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(lc, L_GET_C_BACK_PTR(&to));
if (proxy && linphone_proxy_config_get_realm(proxy)) {
op->setRealm(linphone_proxy_config_get_realm(proxy));
}
linphone_core_notify_subscribe_received(lc,lev,eventname,ct);
if (ct)
linphone_content_unref(ct);
......@@ -852,7 +864,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
if (linphone_core_conference_server_enabled(lc)) {
// Removal of a participant at the server side
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ConferenceId(IdentityAddress(op->getTo()), IdentityAddress(op->getTo()))
ConferenceId(ConferenceAddress(op->getTo()), ConferenceAddress(op->getTo()))
);
if (chatRoom) {
std::shared_ptr<Participant> participant = chatRoom->findParticipant(IdentityAddress(op->getFrom()));
......@@ -882,7 +894,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
if (linphone_core_conference_server_enabled(lc)) {
#ifdef HAVE_ADVANCED_IM
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ConferenceId(IdentityAddress(op->getTo()), IdentityAddress(op->getTo()))
ConferenceId(ConferenceAddress(op->getTo()), ConferenceAddress(op->getTo()))
);
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(chatRoom);
if (cr) {
......@@ -904,7 +916,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
participant = L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->findAuthorizedParticipant(addr);
if (!participant) {
bool ret = static_pointer_cast<ServerGroupChatRoom>(chatRoom)->addParticipant(
IdentityAddress(addr), nullptr, false);
IdentityAddress(addr));
static_cast<SalReferOp *>(op)->reply(ret ? SalReasonNone : SalReasonNotAcceptable);
return;
}
......
......@@ -81,7 +81,20 @@ const bctbx_list_t *linphone_core_get_chat_rooms (LinphoneCore *lc) {
return lc->chat_rooms;
}
//Deprecated see linphone_core_create_chat_room_6
static LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(core)->getOrCreateBasicChatRoom(
*L_GET_CPP_PTR_FROM_C_OBJECT(addr),
!!linphone_core_realtime_text_enabled(core)
));
}
LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){
LinphoneChatRoom *cr = linphone_chat_room_new(linphone_call_get_core(call),
linphone_address_clone(linphone_call_get_remote_address(call)));
linphone_chat_room_set_call(cr, call);
return cr;
}
LinphoneChatRoom *linphone_core_create_client_group_chat_room(LinphoneCore *lc, const char *subject, bool_t fallback) {
return linphone_core_create_client_group_chat_room_2(lc, subject, fallback, FALSE);
}
......@@ -268,8 +281,8 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, LinphonePrivate:
}
LinphonePrivate::ConferenceId conferenceId{
LinphonePrivate::IdentityAddress(peerAddress),
LinphonePrivate::IdentityAddress(localAddress)
LinphonePrivate::ConferenceAddress(LinphonePrivate::Address(peerAddress)),
LinphonePrivate::ConferenceAddress(LinphonePrivate::Address(localAddress))
};
shared_ptr<LinphonePrivate::AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(conferenceId);
if (chatRoom)
......
This diff is collapsed.
......@@ -20,8 +20,13 @@
#ifndef CONFERENCE_PRIVATE_H
#define CONFERENCE_PRIVATE_H
#include <map>
#include "linphone/core.h"
#include "call/call.h"
#include "linphone/conference.h"
#include "conference/conference.h"
#include "conference/handlers/local-audio-video-conference-event-handler.h"
#include "belle-sip/object++.hh"
......@@ -29,20 +34,6 @@
extern "C" {
#endif
typedef enum {
LinphoneConferenceClassLocal,
LinphoneConferenceClassRemote
} LinphoneConferenceClass;
/**
* List of states used by #LinphoneConference
*/
typedef enum {
LinphoneConferenceStopped, /*< Initial state */
LinphoneConferenceStarting, /*< A participant has been added but the conference is not running yet */
LinphoneConferenceRunning, /*< The conference is running */
LinphoneConferenceStartingFailed /*< A participant has been added but the initialization of the conference has failed */
} LinphoneConferenceState;
/**
* Type of the funtion to pass as callback to linphone_conference_params_set_state_changed_callback()
* @param conference The conference instance which the state has changed
......@@ -51,20 +42,11 @@ typedef enum {
*/
typedef void (*LinphoneConferenceStateChangedCb)(LinphoneConference *conference, LinphoneConferenceState new_state, void *user_data);
/**
* A function to converte a #LinphoneConferenceState into a string
*/
const char *linphone_conference_state_to_string(LinphoneConferenceState state);
LinphoneConferenceParams *linphone_conference_params_new(const LinphoneCore *core);
LinphoneConference *linphone_local_conference_new(LinphoneCore *core);
LinphoneConference *linphone_local_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params);
LinphoneConference *linphone_remote_conference_new(LinphoneCore *core);
LinphoneConference *linphone_remote_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params);
/**
* Get the state of a conference
*/
......@@ -78,183 +60,135 @@ LinphoneConferenceState linphone_conference_get_state(const LinphoneConference *
*/
void linphone_conference_set_state_changed_callback(LinphoneConference *obj, LinphoneConferenceStateChangedCb cb, void *user_data);
int linphone_conference_add_participant(LinphoneConference *obj, LinphoneCall *call);
int linphone_conference_remove_participant_with_call(LinphoneConference *obj, LinphoneCall *call);
int linphone_conference_terminate(LinphoneConference *obj);
int linphone_conference_get_size(const LinphoneConference *obj);
int linphone_conference_enter(LinphoneConference *obj);
int linphone_conference_leave(LinphoneConference *obj);
bool_t linphone_conference_is_in(const LinphoneConference *obj);
/* This is actually only used by the ToneManager. TODO: encapsulate this better. */
AudioStream *linphone_conference_get_audio_stream(LinphoneConference *obj);
int linphone_conference_mute_microphone(LinphoneConference *obj, bool_t val);
bool_t linphone_conference_microphone_is_muted(const LinphoneConference *obj);
float linphone_conference_get_input_volume(const LinphoneConference *obj);
int linphone_conference_start_recording(LinphoneConference *obj, const char *path);
int linphone_conference_stop_recording(LinphoneConference *obj);
void linphone_conference_on_call_terminating(LinphoneConference *obj, LinphoneCall *call);
LINPHONE_PUBLIC bool_t linphone_conference_check_class(LinphoneConference *obj, LinphoneConferenceClass _class);
#ifdef __cplusplus
}
#endif
LINPHONE_BEGIN_NAMESPACE
class Call;
class Participant;
class AudioControlInterface;
class VideoControlInterface;
class MixerSession;
class ConferenceFactoryInterface;
class ConferenceParamsInterface;
class ConferenceParams;
class RemoteConferenceEventHandler;
namespace MediaConference{ // They are in a special namespace because of conflict of generic Conference classes in src/conference/*
class Conference;
class LocalConference;
class RemoteConference;
class ConferenceParams : public bellesip::HybridObject<LinphoneConferenceParams, ConferenceParams>{
friend class Conference;
friend class LocalConference;
friend class RemoteConference;
public:
ConferenceParams(const ConferenceParams& params) = default;
ConferenceParams(const LinphoneCore *core = NULL) {
m_enableVideo = false;
if(core) {
const LinphoneVideoPolicy *policy = linphone_core_get_video_policy(core);
if(policy->automatically_initiate) m_enableVideo = true;
}
}
void enableVideo(bool enable) {m_enableVideo = enable;}
bool videoEnabled() const {return m_enableVideo;}
void enableLocalParticipant(bool enable){ mLocalParticipantEnabled = enable; }
bool localParticipantEnabled()const { return mLocalParticipantEnabled; }
Object *clone()const override{
return new ConferenceParams(*this);
}
private:
bool m_enableVideo;
bool mLocalParticipantEnabled = true;
};
/*
* Base class for audio/video conference.
*/
class Conference : public bellesip::HybridObject<LinphoneConference, Conference>{
class LINPHONE_PUBLIC Conference : public bellesip::HybridObject<LinphoneConference, Conference>, public LinphonePrivate::Conference {
friend class LocalAudioVideoConferenceEventHandler;
public:
class Participant {
public:
Participant(LinphoneCall *call) {
m_uri = linphone_address_clone(linphone_call_get_remote_address(call));
m_call = call;
}
~Participant() {
linphone_address_unref(m_uri);
}
Conference(const std::shared_ptr<Core> &core, const IdentityAddress &myAddress, CallSessionListener *listener, const std::shared_ptr<ConferenceParams> params);
virtual ~Conference();
const LinphoneAddress *getUri() const {
return m_uri;
}
LinphoneCall *getCall() const {
return m_call;
}
private:
Participant(const Participant &src);
Participant &operator=(const Participant &src);
private:
LinphoneAddress *m_uri;
LinphoneCall *m_call;
virtual int inviteAddresses(const std::list<const LinphoneAddress*> &addresses, const LinphoneCallParams *params) = 0;
virtual bool addParticipant(const IdentityAddress &participantAddress) override;
virtual bool addParticipant(std::shared_ptr<LinphonePrivate::Call> call) override;
friend class RemoteConference;
};
bool addParticipantDevice(std::shared_ptr<LinphonePrivate::Call> call);
Conference(LinphoneCore *core, const ConferenceParams *params = NULL);
virtual ~Conference() {}
virtual int removeParticipantDevice(const std::shared_ptr<LinphonePrivate::CallSession> & session);
int removeParticipant(std::shared_ptr<LinphonePrivate::Call> call);
virtual int removeParticipant(const std::shared_ptr<LinphonePrivate::CallSession> & session, const bool preserveSession);
virtual int removeParticipant(const IdentityAddress &addr) = 0;
virtual bool removeParticipant(const std::shared_ptr<LinphonePrivate::Participant> &participant) override;
const ConferenceParams &getCurrentParams() const {return *m_currentParams;}
virtual bool removeParticipants (const std::list<std::shared_ptr<LinphonePrivate::Participant>> &participants) override;
virtual int inviteAddresses(const std::list<const LinphoneAddress*> &addresses, const LinphoneCallParams *params) = 0;
virtual int addParticipant(LinphoneCall *call) = 0;
virtual int removeParticipant(LinphoneCall *call) = 0;
virtual int removeParticipant(const LinphoneAddress *uri) = 0;
virtual int updateParams(const ConferenceParams &params) = 0;
virtual int terminate() = 0;
virtual void finalizeCreation() = 0;
virtual int enter() = 0;
virtual int leave() = 0;
virtual void leave() override = 0;
virtual bool isIn() const = 0;
virtual AudioControlInterface * getAudioControlInterface() const = 0;
virtual VideoControlInterface * getVideoControlInterface() const = 0;
virtual AudioStream *getAudioStream() = 0; /* Used by the tone manager, revisit.*/
virtual int getSize() const {return (int)m_participants.size() + (isIn()?1:0);}
const std::list<Participant *> &getParticipants() const {return m_participants;}
virtual int getSize() const {return getParticipantCount() + (isIn()?1:0);}
virtual int startRecording(const char *path) = 0;
virtual int stopRecording() = 0;
LinphoneConferenceState getState() const {return m_state;}
LinphoneCore *getCore()const{
return m_core;
}
static const char *stateToString(LinphoneConferenceState state);
void setID(const char *conferenceID) {
m_conferenceID = conferenceID;
}
const char *getID() const {
return m_conferenceID.c_str();
}
void setState (LinphonePrivate::ConferenceInterface::State state) override;
void setStateChangedCallback(LinphoneConferenceStateChangedCb cb, void *userData) {
m_stateChangedCb = cb;
m_userData = userData;
mStateChangedCb = cb;
mUserData = userData;
}
virtual void setParticipantAdminStatus (const std::shared_ptr<LinphonePrivate::Participant> &participant, bool isAdmin) override;
void setConferenceAddress (const ConferenceAddress &conferenceAddress);
virtual void join () override;
virtual void join (const IdentityAddress &participantAddress) override;
bctbx_list_t *getCallbacksList () const;
LinphoneConferenceCbs *getCurrentCbs () const;
void setCurrentCbs (LinphoneConferenceCbs *cbs);
void addCallbacks (LinphoneConferenceCbs *cbs);
void removeCallbacks (LinphoneConferenceCbs *cbs);
void *getUserData () const;
void setUserData (void *ud);
virtual void onConferenceTerminated (const IdentityAddress &addr) override;
virtual void notifyStateChanged (LinphonePrivate::ConferenceInterface::State state) override;
void checkIfTerminated();
protected:
void setState(LinphoneConferenceState state);
Participant *findParticipant(const LinphoneCall *call) const;
Participant *findParticipant(const LinphoneAddress *uri) const;
void setConferenceId (const ConferenceId &conferenceId);
protected:
std::string m_conferenceID;
LinphoneCore *m_core;
std::list<Participant *> m_participants;
std::shared_ptr<ConferenceParams> m_currentParams;
LinphoneConferenceState m_state;
LinphoneConferenceStateChangedCb m_stateChangedCb = nullptr;
void *m_userData = nullptr;
LinphoneConferenceStateChangedCb mStateChangedCb = nullptr;
// TODO: Delete mUserData
void *mUserData = nullptr;
void *userData = nullptr;
bctbx_list_t *mCallbacks = nullptr;
LinphoneConferenceCbs *mCurrentCbs = nullptr;
};
/*
* Class for an audio/video conference running locally.
*/
class LocalConference: public Conference {
class LINPHONE_PUBLIC LocalConference: public Conference {
public:
LocalConference(LinphoneCore *core, const ConferenceParams *params = NULL);
LocalConference(const std::shared_ptr<Core> &core, const IdentityAddress &myAddress, CallSessionListener *listener, const std::shared_ptr<ConferenceParams> params);
virtual ~LocalConference();
virtual int inviteAddresses(const std::list<const LinphoneAddress*> &addresses, const LinphoneCallParams *params) override;
virtual int addParticipant(LinphoneCall *call) override;
virtual int removeParticipant(LinphoneCall *call) override;
virtual int removeParticipant(const LinphoneAddress *uri) override;
virtual int updateParams(const ConferenceParams &params) override;
virtual bool addParticipant(std::shared_ptr<LinphonePrivate::Call> call) override;
virtual bool addParticipant(const IdentityAddress &participantAddress) override;
virtual int removeParticipant(const std::shared_ptr<LinphonePrivate::CallSession> & session, const bool preserveSession) override;
virtual int removeParticipant(const IdentityAddress &addr) override;
virtual bool removeParticipant(const std::shared_ptr<LinphonePrivate::Participant> &participant) override;
virtual bool update(const ConferenceParamsInterface &params) override;
virtual int terminate() override;
virtual void finalizeCreation() override;
virtual void onConferenceTerminated (const IdentityAddress &addr) override;
virtual void setSubject (const std::string &subject) override;