From cce6169ecbc578f6a9d533852f4979012f55f416 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.net> Date: Tue, 25 Aug 2009 17:31:26 -0400 Subject: [PATCH] [#2006] Add getConferenceDetails call on dbus --- .../src/dbus/callmanager-introspec.xml | 3 ++ sflphone-client-gnome/src/dbus/dbus.c | 14 ++++++ sflphone-common/src/conference.cpp | 50 ++++++++++++++++--- sflphone-common/src/conference.h | 11 ++++ .../src/dbus/callmanager-introspec.xml | 3 ++ sflphone-common/src/managerimpl.cpp | 48 ++++-------------- 6 files changed, 84 insertions(+), 45 deletions(-) diff --git a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml index 5a5ce8d3ec..258c6e5569 100644 --- a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml @@ -119,6 +119,9 @@ <arg type="s" name="callID" direction="out"/> <arg type="s" name="state" direction="out"/> </signal> + + <signal name="conferenceChanged"> + </signal> <signal name="voiceMailNotify"> <arg type="s" name="accountID" direction="out"/> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 6b34563f85..bc1effea4e 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -1796,6 +1796,20 @@ gchar** dbus_get_conference_list (void) return list; } +GHashTable* dbus_get_conference_details (const gchar *confID) +{ + GError *error = NULL; + GHashTable *details = NULL; + + org_sflphone_SFLphone_CallManager_get_conference_details (callManagerProxy, confID, &details, &error); + if (error){ + ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_conference_details"); + g_error_free (error); + } + + return details; +} + void dbus_set_accounts_order (const gchar* order) { GError *error = NULL; diff --git a/sflphone-common/src/conference.cpp b/sflphone-common/src/conference.cpp index 176c9270ea..8cf8435873 100644 --- a/sflphone-common/src/conference.cpp +++ b/sflphone-common/src/conference.cpp @@ -38,6 +38,19 @@ Conference::~Conference() } + +int Conference::getState() +{ + return _confState; +} + + +void Conference::setState(ConferenceState state) +{ + _confState = state; +} + + void Conference::add(CallID participant_id) { @@ -90,23 +103,46 @@ void Conference::remove(CallID participant_id) void Conference::bindParticipant(CallID participant_id) { - if(_nbParticipant >= 1) - { + if(_nbParticipant >= 1) { ParticipantSet::iterator iter = _participants.begin(); - while (iter != _participants.end()) - { - if (participant_id != (*iter)) - { + while (iter != _participants.end()) { + + if (participant_id != (*iter)) { + _debug("---- Conference:: bind callid %s with %s in conference add\n", participant_id.c_str(), (*iter).c_str()); Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID(participant_id, *iter); } iter++; } + } - _debug("---- Conference:: bind callid %s with default_id in conference add\n", participant_id.c_str()); + _debug("---- Conference::bind callid %s with default_id in conference add\n", participant_id.c_str()); Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID(participant_id); } + + +std::string Conference::getStateStr() +{ + + std::string state_str; + + switch(_confState) { + + case Active: + state_str = "ACTIVE"; + break; + + case Hold: + state_str = "HOLD"; + break; + + default: + break; + } + + return state_str; +} diff --git a/sflphone-common/src/conference.h b/sflphone-common/src/conference.h index b1e0cb2c0e..31b5036cb4 100644 --- a/sflphone-common/src/conference.h +++ b/sflphone-common/src/conference.h @@ -26,6 +26,7 @@ // class ManagerImpl; // class Call; +typedef std::string ConfID; typedef std::set<CallID> ParticipantSet; @@ -33,10 +34,18 @@ class Conference{ public: + enum ConferenceState {Active, Hold}; + Conference(); ~Conference(); + int getState(); + + void setState(ConferenceState state); + + std::string getStateStr(); + int getNbParticipants() { return _nbParticipant; } void add(CallID participant_id); @@ -50,6 +59,8 @@ class Conference{ /** Unique ID of the call */ CallID _id; + ConferenceState _confState; + ParticipantSet _participants; int _nbParticipant; diff --git a/sflphone-common/src/dbus/callmanager-introspec.xml b/sflphone-common/src/dbus/callmanager-introspec.xml index 679d779ba4..22fab77093 100644 --- a/sflphone-common/src/dbus/callmanager-introspec.xml +++ b/sflphone-common/src/dbus/callmanager-introspec.xml @@ -119,6 +119,9 @@ <arg type="s" name="callID" direction="out"/> <arg type="s" name="state" direction="out"/> </signal> + + <signal name="conferenceChanged"> + </signal> <signal name="voiceMailNotify"> <arg type="s" name="accountID" direction="out"/> diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 06c1cf5659..b31e05ce5e 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3481,51 +3481,23 @@ ManagerImpl::getCallList (void) std::map< std::string, std::string > -ManagerImpl::getConferenceDetails(const CallID& callID) +ManagerImpl::getConferenceDetails(const ConfID& confID) { - std::map<std::string, std::string> call_details; - AccountID accountid; - Account *account; - VoIPLink *link; - Call *call = NULL; - std::stringstream type; - + std::map<std::string, std::string> conf_details; + ConferenceMap::iterator iter_conf; - // We need here to retrieve the call information attached to the call ID - // To achieve that, we need to get the voip link attached to the call - // But to achieve that, we need to get the account the call was made with + iter_conf = _conferencemap.find(confID); - // So first we fetch the account - accountid = getAccountFromCall (callID); - _debug ("%s\n",callID.c_str()); - // Then the VoIP link this account is linked with (IAX2 or SIP) - - if ( (account=getAccount (accountid)) != 0) { - link = account->getVoIPLink (); - - if (link) { - call = link->getCall (callID); - } - } + Conference *conf; + if(iter_conf != _conferencemap.end()) { - if (call) { - type << call->getCallType (); - call_details.insert (std::pair<std::string, std::string> ("ACCOUNTID", accountid)); - call_details.insert (std::pair<std::string, std::string> ("PEER_NUMBER", call->getPeerNumber ())); - call_details.insert (std::pair<std::string, std::string> ("PEER_NAME", call->getPeerName ())); - call_details.insert (std::pair<std::string, std::string> ("CALL_STATE", call->getStateStr ())); - call_details.insert (std::pair<std::string, std::string> ("CALL_TYPE", type.str ())); - } else { - _debug ("Error: Managerimpl - getCallDetails ()\n"); - call_details.insert (std::pair<std::string, std::string> ("ACCOUNTID", AccountNULL)); - call_details.insert (std::pair<std::string, std::string> ("PEER_NUMBER", "Unknown")); - call_details.insert (std::pair<std::string, std::string> ("PEER_NAME", "Unknown")); - call_details.insert (std::pair<std::string, std::string> ("CALL_STATE", "UNKNOWN")); - call_details.insert (std::pair<std::string, std::string> ("CALL_TYPE", "0")); + + conf_details.insert (std::pair<std::string, std::string> ("CONFID", confID)); + conf_details.insert (std::pair<std::string, std::string> ("CONF_STATE", conf->getStateStr())); } - return call_details; + return conf_details; } -- GitLab