Commit cce6169e authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2006] Add getConferenceDetails call on dbus

parent e3dde95d
......@@ -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"/>
......
......@@ -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;
......
......@@ -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;
}
......@@ -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;
......
......@@ -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"/>
......
......@@ -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;
}
......
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