diff --git a/sflphone-client-gnome/src/toolbar.c b/sflphone-client-gnome/src/toolbar.c index 6b250973dbdb2e0322df6b03e615b04af17ef756..b88d67fd130aee3f1e95e933bf0eaf2533d66ef2 100644 --- a/sflphone-client-gnome/src/toolbar.c +++ b/sflphone-client-gnome/src/toolbar.c @@ -334,6 +334,7 @@ toolbar_update_buttons () case CALL_STATE_INCOMING: gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(conferenceButton), TRUE); g_object_ref(callButton); gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton)); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), pickupButton, 0); @@ -363,7 +364,6 @@ toolbar_update_buttons () gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE); gtk_widget_set_sensitive( GTK_WIDGET(recButton), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(conferenceButton), TRUE); break; case CALL_STATE_BUSY: case CALL_STATE_FAILURE: diff --git a/sflphone-common/src/Makefile.am b/sflphone-common/src/Makefile.am index 581c204f74317046a4b63eb572e1d36d1b306ead..a3231759a990c68ee8dbc69c0cf815ee23c85108 100644 --- a/sflphone-common/src/Makefile.am +++ b/sflphone-common/src/Makefile.am @@ -19,6 +19,7 @@ SUBDIRS = dbus audio config plug-in hooks history # Add here the cpp files to be build with sflphone sflphoned_SOURCES = \ + conference.cpp \ voiplink.cpp \ main.cpp \ managerimpl.cpp \ @@ -29,7 +30,6 @@ sflphoned_SOURCES = \ accountcreator.cpp \ sipvoiplink.cpp \ call.cpp \ - conference.cpp \ account.cpp \ sipcall.cpp \ sdp.cpp \ @@ -60,6 +60,7 @@ sflphoned_LDFLAGS= -luuid noinst_LTLIBRARIES = libsflphone.la noinst_HEADERS = \ + conference.h \ voiplink.h \ managerimpl.h \ manager.h \ @@ -73,7 +74,6 @@ noinst_HEADERS = \ accountcreator.h \ sipvoiplink.h \ call.h \ - conference.h \ sipcall.h \ sdp.h \ sdpmedia.h \ diff --git a/sflphone-common/src/audio/audiolayer.h b/sflphone-common/src/audio/audiolayer.h index 1ec4b7c7c9be34b77346543df40df5d865ee9dcb..31217eb998ce2e819061d95ad4f1f26a7b9c1d69 100644 --- a/sflphone-common/src/audio/audiolayer.h +++ b/sflphone-common/src/audio/audiolayer.h @@ -30,7 +30,6 @@ #include <cc++/thread.h> // for ost::Mutex - #define FRAME_PER_BUFFER 160 /** diff --git a/sflphone-common/src/conference.cpp b/sflphone-common/src/conference.cpp index 62a4112c866c22ed637a585d01be046a8f835d24..d325c3584faba39aa09eee9009d15c317e964e76 100644 --- a/sflphone-common/src/conference.cpp +++ b/sflphone-common/src/conference.cpp @@ -19,8 +19,9 @@ */ #include "conference.h" - #include "manager.h" +#include "audio/audiolayer.h" + Conference::Conference() { @@ -33,11 +34,15 @@ Conference::Conference() Conference::~Conference() { + + } void Conference::add(CallID participant_id) { + _debug("Conference::add participant %s\n", participant_id.c_str()); + if(_nbParticipant >= 1) { ParticipantSet::iterator iter; @@ -46,6 +51,8 @@ void Conference::add(CallID participant_id) Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID(participant_id, *iter); } + // Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID(participant_id); + _participants.insert(participant_id); _nbParticipant++; @@ -60,7 +67,7 @@ void Conference::remove(CallID participant_id) ParticipantSet::iterator iter = _participants.begin(); for(iter = _participants.begin(); iter != _participants.end(); iter++) - Manager::instance().getAudioDriver()->getMainBuffer()->unBindCallID(participant_id, *iter); + Manager::instance().getAudioDriver()->getMainBuffer()->unBindCallID(participant_id, *iter); } _participants.erase(participant_id); diff --git a/sflphone-common/src/conference.h b/sflphone-common/src/conference.h index 454283ccf4357bf7a4eec470d533435cf9f0d931..83409974702c804abd194e0bd14c247c6d82c548 100644 --- a/sflphone-common/src/conference.h +++ b/sflphone-common/src/conference.h @@ -22,8 +22,10 @@ #include <set> #include "call.h" -#include "manager.h" -#include "audio/audiolayer.h" + +// class ManagerImpl; +// class Call; + typedef std::set<CallID> ParticipantSet; diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp index 4d536a50cf97c01fb8cf9a17a897e5b8fe418bdb..c02fb3e9d0c43ecd6289ed8dd18cc77d20e00368 100644 --- a/sflphone-common/src/dbus/callmanager.cpp +++ b/sflphone-common/src/dbus/callmanager.cpp @@ -121,7 +121,7 @@ void CallManager::addParticipant (const std::string& callID) { _debug ("CallManager::addParticipant received %s\n", callID.c_str()); - // Manager::instance().setRecordingCall (callID); + Manager::instance().addParticipant(callID); } void diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 484df3e8e5ebb627267037e75bbd8a220c424bdd..4010fa499859f9b05b648b45781591e58c18d0f6 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -35,6 +35,8 @@ #include <ccrtp/rtp.h> // why do I need this here? #include <cc++/file.h> +#include "conference.h" + #include "manager.h" #include "account.h" #include "sipaccount.h" @@ -308,11 +310,15 @@ ManagerImpl::answerCall (const CallID& id) _debug ("ManagerImpl::answerCall :: current call->getState %i \n", currentCall->getState()); _debug ("Try to answer call: %s\n", id.data()); - if (lastCall != NULL) { - if (lastCall->getState() == Call::Active) { + if (lastCall != NULL ) { + if (lastCall->getState() == Call::Active && _conferencemap.empty()) { _debug ("* Manager Info: there is currently a call, try to hold it\n"); onHoldCall (getCurrentCallId()); } + else + { + _debug("There is a conference!!!!!!!!!!!!!!!!!!!!!!\n"); + } } if (!getAccountLink (currentAccountId)->answer (id)) { @@ -624,9 +630,43 @@ ManagerImpl::refuseCall (const CallID& id) void -ManagerImpl::createConference() +ManagerImpl::createConference(const CallID& id) { _debug("ManagerImpl::createConference()\n"); + + Conference* conf = new Conference(); + _conferencemap["conf"] = conf; + + conf->add(getCurrentCallId()); + conf->add(id); + + answerCall(id); + +} + +void +ManagerImpl::addParticipant(const CallID& id) +{ + _debug("ManagerImpl::addParticipant(%s)\n", id.c_str()); + _debug(" Current call ID %s\n", getCurrentCallId().c_str()); + + if(_conferencemap.empty()) + { + _debug("NO CONFERENCE YET, CREATE ONE\n"); + createConference(id); + } + else + { + _debug("ALREADY A CONFERENCE CREATED, ADD PARTICIPANT TO IT\n"); + Conference* conf; + ConferenceMap::iterator iter = _conferencemap.find("conf"); + conf = iter->second; + + conf->add(id); + + answerCall(id); + } + } //THREAD=Main diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index 286e765263131298a08912f427c775aa63e5222e..1b4d3738e597b990c21f57028a09e8101ae67859 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -36,6 +36,7 @@ #include "account.h" #include "call.h" +#include "conference.h" #include "numbercleaner.h" #include <history/historymanager.h> @@ -49,6 +50,7 @@ class CodecDescriptor; class GuiFramework; class TelephoneTone; class VoIPLink; +// class Conference; #ifdef USE_ZEROCONF class DNSService; @@ -68,6 +70,9 @@ typedef std::set<CallID> CallIDSet; /** To send multiple string */ typedef std::list<std::string> TokenList; +/** To store conference objects by ids */ +typedef std::map<CallID, Conference*> ConferenceMap; + /** Manager (controller) of sflphone daemon */ class ManagerImpl { public: @@ -175,7 +180,9 @@ class ManagerImpl { */ bool refuseCall(const CallID& id); - void createConference(); + void createConference(const CallID& id); + + void addParticipant(const CallID& id); /** * Save config to file @@ -1142,6 +1149,9 @@ class ManagerImpl { int isStunEnabled (void); void enableStun (void); + + ConferenceMap _conferencemap; + private: // Copy Constructor diff --git a/sflphone-common/test/Makefile.am b/sflphone-common/test/Makefile.am index 632c7b5ed179200a8ff8cf5a9522fb2ba0f9d9e1..647cf4c74a95d2cc12c66713e28bb0814d018e35 100644 --- a/sflphone-common/test/Makefile.am +++ b/sflphone-common/test/Makefile.am @@ -15,13 +15,15 @@ OBJECT_FILES= \ ../src/sflphoned-sipaccount.o \ ../src/sflphoned-iaxaccount.o \ ../src/sflphoned-eventthread.o \ + ../src/sflphoned-conference.o \ ../src/plug-in/pluginmanager.o \ ../src/plug-in/audiorecorder/audiorecord.o \ ../src/sflphoned-samplerateconverter.o \ ../src/sflphoned-sdp.o \ ../src/sflphoned-sdpmedia.o \ ../src/sflphoned-numbercleaner.o \ - ../src/history/historymanager.o + ../src/history/historymanager.o + ../ numbercleanerTester_SOURCES = \ numbercleanerTest.h \ diff --git a/sflphone-common/test/numbercleanerTest.h b/sflphone-common/test/numbercleanerTest.h index 3152892a0053bcbb43b4e347933bc1bb576b2bca..3af6ab8c92a59e3125dd1d7d2aa2d9d648e32b2f 100644 --- a/sflphone-common/test/numbercleanerTest.h +++ b/sflphone-common/test/numbercleanerTest.h @@ -27,7 +27,7 @@ // Application import #include "numbercleaner.h" - +// #include "../src/conference.h" /* * @file numbercleanerTest.cpp * @brief Regroups unitary tests related to the phone number cleanup function.