Commit 7689cbde authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#1883] Add minimal functionalities to create a conference



Call someone, add incoming calls to the conference using the new conference button
Signed-off-by: default avatarAlexandre Savard <alexandre.savard@savoirfairelinux.net>
parent b79320b2
......@@ -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:
......
......@@ -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 \
......
......@@ -30,7 +30,6 @@
#include <cc++/thread.h> // for ost::Mutex
#define FRAME_PER_BUFFER 160
/**
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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 \
......
......@@ -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.
......
Supports Markdown
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