Commit 373583cf authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin

The server reacts to incomingCalls

parent 12dcc704
......@@ -37,7 +37,7 @@ sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone
#sflphoned_LDFLAGS = -static
sflphoned_LDADD = ./libsflphone.la $(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) $(IAX_LIBS) $(EXOSIP_LIBS)
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES)
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(IAX_CFLAGS) $(USER_INCLUDES) $(libdbuscpp_CFLAGS)
#libsflphone_la_LDFLAGS= -version-info 0:1:0
libsflphone_la_LIBADD = \
......
......@@ -17,7 +17,7 @@ audiortp.cpp dtmf.cpp tone.cpp audiocodec.cpp audiolayer.cpp audiodev
tonegenerator.cpp ulaw.cpp codecDescriptor.cpp \
audioloop.cpp ringbuffer.cpp $(SPEEX_SOURCES_CPP)
AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libccrtp1_CFLAGS) $(USER_INCLUDES)
AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $(libdbuscpp_CFLAGS) $(libccrtp1_CFLAGS) $(USER_INCLUDES)
libaudio_la_LIBADD = gsm/libgsm.la $(SPEEX_LIB)
libaudio_la_CPPFLAGS = $(SPEEX_FLAG)
......
......@@ -4,8 +4,9 @@ EXTRA_DIST = *.xml README
noinst_LTLIBRARIES = libdbus.la
libdbus_la_SOURCES = callmanager.cpp \
dbusmanagerimpl.cpp
libdbus_la_SOURCES = \
callmanager.cpp \
dbusmanagerimpl.cpp
libdbus_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\"
libdbus_la_CPPFLAGS = -I$(top_srcdir)/libs -I$(top_srcdir)/src $(libccext2_CFLAGS) $(libdbuscpp_CFLAGS)
......
......@@ -10,6 +10,7 @@
namespace org {
namespace sflphone {
namespace SFLPhone {
class CallManager
: public ::DBus::InterfaceAdaptor
......@@ -17,7 +18,7 @@ class CallManager
public:
CallManager()
: ::DBus::InterfaceAdaptor("org.sflphone.CallManager")
: ::DBus::InterfaceAdaptor("org.sflphone.SFLPhone.CallManager")
{
register_method(CallManager, placeCall, _placeCall_stub);
register_method(CallManager, refuse, _refuse_stub);
......@@ -101,14 +102,14 @@ public:
{ "callID", "s", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument incommingCall_args[] =
static ::DBus::IntrospectedArgument incomingCall_args[] =
{
{ "accountID", "s", false },
{ "callID", "s", false },
{ "from", "s", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument incommingMessage_args[] =
static ::DBus::IntrospectedArgument incomingMessage_args[] =
{
{ "accountID", "s", false },
{ "from", "s", false },
......@@ -158,8 +159,8 @@ public:
};
static ::DBus::IntrospectedMethod CallManager_signals[] =
{
{ "incommingCall", incommingCall_args },
{ "incommingMessage", incommingMessage_args },
{ "incomingCall", incomingCall_args },
{ "incomingMessage", incomingMessage_args },
{ "ring", ring_args },
{ "pickedUp", pickedUp_args },
{ "hungUp", hungUp_args },
......@@ -173,7 +174,7 @@ public:
};
static ::DBus::IntrospectedInterface CallManager_interface =
{
"org.sflphone.CallManager",
"org.sflphone.SFLPhone.CallManager",
CallManager_methods,
CallManager_signals,
CallManager_properties
......@@ -209,18 +210,18 @@ public:
/* signal emitters for this interface
*/
void incommingCall( const ::DBus::String& arg1, const ::DBus::String& arg2, const ::DBus::String& arg3 )
void incomingCall( const ::DBus::String& arg1, const ::DBus::String& arg2, const ::DBus::String& arg3 )
{
::DBus::SignalMessage sig("incommingCall");
::DBus::SignalMessage sig("incomingCall");
::DBus::MessageIter wi = sig.writer();
wi << arg1;
wi << arg2;
wi << arg3;
emit_signal(sig);
}
void incommingMessage( const ::DBus::String& arg1, const ::DBus::String& arg2 )
void incomingMessage( const ::DBus::String& arg1, const ::DBus::String& arg2 )
{
::DBus::SignalMessage sig("incommingMessage");
::DBus::SignalMessage sig("incomingMessage");
::DBus::MessageIter wi = sig.writer();
wi << arg1;
wi << arg2;
......@@ -387,5 +388,5 @@ private:
}
};
} }
} } }
#endif//__dbusxx__callmanager_glue_h__ADAPTOR_MARSHAL_H
<?xml version="1.0" ?>
<node name="/org/sflphone/CallManager">
<interface name="org.sflphone.CallManager">
<node name="/org/sflphone/SFLPhone">
<interface name="org.sflphone.SFLPhone.CallManager">
<method name="placeCall">
<arg type="s" name="accountID" direction="in"/>
......@@ -56,13 +56,13 @@
<arg type="s" name="callID" direction="out"/>
</method>
<signal name="incommingCall">
<signal name="incomingCall">
<arg type="s" name="accountID" />
<arg type="s" name="callID" />
<arg type="s" name="from" />
</signal>
<signal name="incommingMessage">
<signal name="incomingMessage">
<arg type="s" name="accountID" />
<arg type="s" name="from" />
</signal>
......
......@@ -25,7 +25,7 @@
class CallManager
: public org::sflphone::CallManager,
: public org::sflphone::SFLPhone::CallManager,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
......
......@@ -10,6 +10,7 @@
namespace org {
namespace sflphone {
namespace SFLPhone {
class ConfigurationManager
: public ::DBus::InterfaceAdaptor
......@@ -17,7 +18,7 @@ class ConfigurationManager
public:
ConfigurationManager()
: ::DBus::InterfaceAdaptor("org.sflphone.ConfigurationManager")
: ::DBus::InterfaceAdaptor("org.sflphone.SFLPhone.ConfigurationManager")
{
register_method(ConfigurationManager, getAccountDetails, _getAccountDetails_stub);
register_method(ConfigurationManager, addAccount, _addAccount_stub);
......@@ -239,7 +240,7 @@ public:
};
static ::DBus::IntrospectedInterface ConfigurationManager_interface =
{
"org.sflphone.ConfigurationManager",
"org.sflphone.SFLPhone.ConfigurationManager",
ConfigurationManager_methods,
ConfigurationManager_signals,
ConfigurationManager_properties
......@@ -573,5 +574,5 @@ private:
}
};
} }
} } }
#endif//__dbusxx__configurationmanager_glue_h__ADAPTOR_MARSHAL_H
......@@ -22,11 +22,6 @@
const char* DBusManagerImpl::SERVER_NAME = "org.sflphone.SFLPhone";
void
DBusManagerImpl::connect(){
}
int
DBusManagerImpl::exec(){
......
......@@ -24,7 +24,7 @@
class DBusManagerImpl {
public:
void connect();
CallManager * getCallManager(){ return _callManager; };
int exec();
static const char* SERVER_NAME;
......
......@@ -20,5 +20,5 @@ noinst_LTLIBRARIES = libguiframework.la
libguiframework_la_SOURCES = guiframework.cpp guiframework.h
libguiframework_la_CPPFLAGS = -I$(top_srcdir)/libs -I$(top_srcdir)/src
libguiframework_la_CXXFLAGS = $(libccext2_CFLAGS)
libguiframework_la_CXXFLAGS = $(libccext2_CFLAGS) $(libdbuscpp_CFLAGS)
libguiframework_la_LIBADD = $(serverlib)
......@@ -77,6 +77,7 @@ main (int argc, char **argv) {
//GUI = &(GUIServer::instance());
//GUIServer::instance().setSessionPort(sessionPort);
//Manager::instance().setGui(GUI);
Manager::instance().setDBusManager(&DBusManager::instance());
exit_code = DBusManager::instance().exec();
}
......
......@@ -66,7 +66,7 @@ ManagerImpl::ManagerImpl (void)
_path = "";
_exist = 0;
_setupLoaded = false;
_gui = 0;
_dbus = NULL;
// sound
_audiodriver = 0;
......@@ -599,7 +599,7 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
from.append(number);
from.append(">");
}
_gui->incomingCall(accountId, call->getCallId(), from);
_dbus->getCallManager()->incomingCall(accountId, call->getCallId(), from);
return true;
}
......@@ -607,8 +607,8 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
//THREAD=VoIP
void
ManagerImpl::incomingMessage(const AccountID& accountId, const std::string& message) {
if (_gui) {
_gui->incomingMessage(accountId, message);
if (_dbus) {
_dbus->getCallManager()->incomingMessage(accountId, message);
}
}
......@@ -619,7 +619,7 @@ ManagerImpl::peerAnsweredCall(const CallID& id)
if (isCurrentCall(id)) {
stopTone(false);
}
if (_gui) _gui->peerAnsweredCall(id);
if (_dbus) _dbus->getCallManager()->pickedUp(id);
}
//THREAD=VoIP Call=Outgoing
......@@ -629,7 +629,7 @@ ManagerImpl::peerRingingCall(const CallID& id)
if (isCurrentCall(id)) {
ringback();
}
if (_gui) _gui->peerRingingCall(id);
if (_dbus) _dbus->getCallManager()->ring(id);
}
//THREAD=VoIP Call=Outgoing/Ingoing
......@@ -647,7 +647,7 @@ ManagerImpl::peerHungupCall(const CallID& id)
}
removeWaitingCall(id);
removeCallAccount(id);
if (_gui) _gui->peerHungupCall(id);
if (_dbus) _dbus->getCallManager()->hungUp(id);
}
//THREAD=VoIP
......@@ -660,7 +660,7 @@ ManagerImpl::callBusy(const CallID& id) {
}
removeCallAccount(id);
removeWaitingCall(id);
if(_gui) _gui->displayErrorText( id, "Call is busy");
//if(_gui) _gui->displayErrorText( id, "Call is busy");
}
//THREAD=VoIP
......@@ -672,9 +672,9 @@ ManagerImpl::callFailure(const CallID& id)
playATone(Tone::TONE_BUSY);
switchCall("");
}
if (_gui) {
/*if (_gui) {
_gui->callFailure(id);
}
}*/
removeCallAccount(id);
removeWaitingCall(id);
}
......@@ -683,61 +683,61 @@ ManagerImpl::callFailure(const CallID& id)
void
ManagerImpl::displayTextMessage(const CallID& id, const std::string& message)
{
if(_gui) {
/*if(_gui) {
_gui->displayTextMessage(id, message);
}
}*/
}
//THREAD=VoIP
void
ManagerImpl::displayErrorText(const CallID& id, const std::string& message)
{
if(_gui) {
/*if(_gui) {
_gui->displayErrorText(id, message);
} else {
std::cerr << message << std::endl;
}
}*/
}
//THREAD=VoIP
void
ManagerImpl::displayError (const std::string& error)
{
if(_gui) {
/*if(_gui) {
_gui->displayError(error);
}
}*/
}
//THREAD=VoIP
void
ManagerImpl::displayStatus(const std::string& status)
{
if(_gui) {
/*if(_gui) {
_gui->displayStatus(status);
}
}*/
}
//THREAD=VoIP
void
ManagerImpl::displayConfigError (const std::string& message)
{
if(_gui) {
/*if(_gui) {
_gui->displayConfigError(message);
}
}*/
}
//THREAD=VoIP
void
ManagerImpl::startVoiceMessageNotification(const AccountID& accountId, const std::string& nb_msg)
{
if (_gui) _gui->sendVoiceNbMessage(accountId, nb_msg);
//if (_gui) _gui->sendVoiceNbMessage(accountId, nb_msg);
}
//THREAD=VoIP
void
ManagerImpl::stopVoiceMessageNotification(const AccountID& accountId)
{
if (_gui) _gui->sendVoiceNbMessage(accountId, std::string("0"));
//if (_gui) _gui->sendVoiceNbMessage(accountId, std::string("0"));
}
//THREAD=VoIP
......@@ -745,21 +745,21 @@ void
ManagerImpl::registrationSucceed(const AccountID& accountid)
{
Account* acc = getAccount(accountid);
if ( acc ) {
/*if ( acc ) {
acc->setState(true);
if (_gui) _gui->sendRegistrationState(accountid, true);
}
}*/
}
//THREAD=VoIP
void
ManagerImpl::registrationFailed(const AccountID& accountid)
{
Account* acc = getAccount(accountid);
/*Account* acc = getAccount(accountid);
if ( acc ) {
acc->setState(false);
if (_gui) _gui->sendRegistrationState(accountid, false);
}
}*/
}
/**
......@@ -1141,7 +1141,7 @@ ManagerImpl::getZeroconf(const std::string& sequenceId)
bool returnValue = false;
#ifdef USE_ZEROCONF
int useZeroconf = getConfigInt(PREFERENCES, CONFIG_ZEROCONF);
if (useZeroconf && _gui != NULL) {
if (useZeroconf && _dbus != NULL) {
TokenList arg;
TokenList argTXT;
std::string newService = "new service";
......@@ -1152,7 +1152,7 @@ ManagerImpl::getZeroconf(const std::string& sequenceId)
arg.push_back(newService);
while(iter!=services.end()) {
arg.push_front(iter->first);
_gui->sendMessage("100",sequenceId,arg);
//_gui->sendMessage("100",sequenceId,arg);
arg.pop_front(); // remove the first, the name
TXTRecordMap record = iter->second.getTXTRecords();
......@@ -1163,7 +1163,7 @@ ManagerImpl::getZeroconf(const std::string& sequenceId)
argTXT.push_back(iterTXT->first);
argTXT.push_back(iterTXT->second);
argTXT.push_back(newTXT);
_gui->sendMessage("101",sequenceId,argTXT);
// _gui->sendMessage("101",sequenceId,argTXT);
iterTXT++;
}
iter++;
......@@ -1229,7 +1229,7 @@ ManagerImpl::getEvents() {
bool
ManagerImpl::getCallStatus(const std::string& sequenceId)
{
if (!_gui) { return false; }
if (!_dbus) { return false; }
ost::MutexLock m(_callAccountMapMutex);
CallAccountMap::iterator iter = _callAccountMap.begin();
TokenList tk;
......@@ -1274,7 +1274,7 @@ ManagerImpl::getCallStatus(const std::string& sequenceId)
tk.push_back(iter->second);
tk.push_back(destination);
tk.push_back(status);
_gui->sendCallMessage(code, sequenceId, iter->first, tk);
//_gui->sendCallMessage(code, sequenceId, iter->first, tk);
tk.clear();
iter++;
......@@ -1294,7 +1294,7 @@ ManagerImpl::getConfigAll(const std::string& sequenceId)
returnValue = true;
}
while (tk.size()) {
_gui->sendMessage("100", sequenceId, tk);
//_gui->sendMessage("100", sequenceId, tk);
tk = iter.next();
}
return returnValue;
......@@ -1369,7 +1369,7 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam
} else {
tk.push_back(strType.str());
}
_gui->sendMessage("100", sequenceId, tk);
// _gui->sendMessage("100", sequenceId, tk);
iter++;
}
returnValue = true;
......@@ -1379,7 +1379,7 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam
str << 1;
tk.push_back(str.str());
tk.push_back(""); // filepath
_gui->sendMessage("100", sequenceId, tk);
//_gui->sendMessage("100", sequenceId, tk);
// share directory
std::string path = std::string(PROGSHAREDIR) + DIR_SEPARATOR_STR + RINGDIR;
......@@ -1423,7 +1423,7 @@ ManagerImpl::getAudioDeviceList(const std::string& sequenceId, int ioDeviceMask)
tk.push_back(device->getName());
tk.push_back(device->getApiName());
std::ostringstream rate; rate << (int)(device->getRate()); tk.push_back(rate.str());
_gui->sendMessage("100", sequenceId, tk);
//_gui->sendMessage("100", sequenceId, tk);
// don't forget to delete it after
delete device; device = 0;
......@@ -1435,7 +1435,7 @@ ManagerImpl::getAudioDeviceList(const std::string& sequenceId, int ioDeviceMask)
rate << "VARIABLE";
tk.clear();
tk.push_back(rate.str());
_gui->sendMessage("101", sequenceId, tk);
//_gui->sendMessage("101", sequenceId, tk);
return returnValue;
}
......@@ -1462,7 +1462,7 @@ ManagerImpl::sendCountryTone(const std::string& sequenceId, int index, const std
TokenList tk;
std::ostringstream str; str << index; tk.push_back(str.str());
tk.push_back(name);
_gui->sendMessage("100", sequenceId, tk);
//_gui->sendMessage("100", sequenceId, tk);
}
//THREAD=Main
......@@ -1483,7 +1483,7 @@ ManagerImpl::getDirListing(const std::string& sequenceId, const std::string& pat
str << (*nbFile);
tk.push_back(str.str());
tk.push_back(filePathName);
_gui->sendMessage("100", sequenceId, tk);
//_gui->sendMessage("100", sequenceId, tk);
(*nbFile)++;
}
}
......@@ -1510,12 +1510,12 @@ ManagerImpl::getAccountList(const std::string& sequenceId)
if ( iter->second->isEnabled() || iter->second->shouldInitOnStart()) {
tk.push_back("Active");
tk.push_back(getConfigString(iter->first,CONFIG_ACCOUNT_ALIAS));
_gui->sendMessage("130", sequenceId, tk);
//_gui->sendMessage("130", sequenceId, tk);
oneActive = true;
} else {
tk.push_back("Inactive");
tk.push_back(getConfigString(iter->first,CONFIG_ACCOUNT_ALIAS));
_gui->sendMessage("131", sequenceId, tk);
//_gui->sendMessage("131", sequenceId, tk);
}
tk.clear();
......
......@@ -28,6 +28,7 @@
#include <set>
#include <map>
#include <cc++/thread.h>
#include "dbus/dbusmanager.h"
#include "stund/stun.h"
#include "observer.h"
......@@ -41,6 +42,7 @@
#include "audio/dtmf.h"
#include "audio/codecDescriptor.h"
class AudioLayer;
class CodecDescriptor;
class GuiFramework;
......@@ -94,7 +96,7 @@ public:
* Set the graphic user interface : only GuiServer right now
* @param gui A GuiFramework gui implmentation
*/
void setGui (GuiFramework* gui) { _gui = gui; }
void setDBusManager (DBusManagerImpl* man) { _dbus = man; }
// Accessor to audiodriver
// it's multi-thread and use mutex internally
......@@ -416,7 +418,7 @@ private:
//
// Multithread variable (non protected)
//
GuiFramework* _gui;
DBusManagerImpl * _dbus;
/** Waiting Call Vectors */
CallIDSet _waitingCall;
......
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