Commit acec60a9 authored by Alexandre Savard's avatar Alexandre Savard

#5747: Handle offhold action for recording conference

parent 9b67a401
...@@ -103,6 +103,8 @@ void create_new_conference_from_details (const gchar *conf_id, GHashTable *detai ...@@ -103,6 +103,8 @@ void create_new_conference_from_details (const gchar *conf_id, GHashTable *detai
new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD; new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
} else if (g_strcasecmp (state_str, "HOLD") == 0) { } else if (g_strcasecmp (state_str, "HOLD") == 0) {
new_conf->_state = CONFERENCE_STATE_HOLD; new_conf->_state = CONFERENCE_STATE_HOLD;
} else if (g_strcasecmp (state_str, "HOLD_REC") == 0) {
new_conf->_state = CONFERENCE_STATE_HOLD_RECORD;
} }
*conf = new_conf; *conf = new_conf;
......
...@@ -46,7 +46,8 @@ typedef enum { ...@@ -46,7 +46,8 @@ typedef enum {
CONFERENCE_STATE_ACTIVE_DETACHED, CONFERENCE_STATE_ACTIVE_DETACHED,
CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD, CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD,
CONFERENCE_STATE_ACTIVE_DETACHED_RECORD, CONFERENCE_STATE_ACTIVE_DETACHED_RECORD,
CONFERENCE_STATE_HOLD CONFERENCE_STATE_HOLD,
CONFERENCE_STATE_HOLD_RECORD
} conference_state_t; } conference_state_t;
......
...@@ -261,6 +261,7 @@ row_activated (GtkTreeView *tree_view UNUSED, ...@@ -261,6 +261,7 @@ row_activated (GtkTreeView *tree_view UNUSED,
sflphone_add_main_participant (selectedConf); sflphone_add_main_participant (selectedConf);
break; break;
case CONFERENCE_STATE_HOLD: case CONFERENCE_STATE_HOLD:
case CONFERENCE_STATE_HOLD_RECORD:
sflphone_conference_off_hold (selectedConf); sflphone_conference_off_hold (selectedConf);
break; break;
case CONFERENCE_STATE_ACTIVE_ATACHED: case CONFERENCE_STATE_ACTIVE_ATACHED:
...@@ -1139,6 +1140,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) ...@@ -1139,6 +1140,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
break; break;
case CONFERENCE_STATE_ACTIVE_DETACHED: case CONFERENCE_STATE_ACTIVE_DETACHED:
case CONFERENCE_STATE_HOLD: case CONFERENCE_STATE_HOLD:
case CONFERENCE_STATE_HOLD_RECORD:
pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/usersDetached.svg", NULL); pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/usersDetached.svg", NULL);
break; break;
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD: case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
......
...@@ -246,7 +246,7 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, ...@@ -246,7 +246,7 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
conference_obj_t* changed_conf = conferencelist_get (confID); conference_obj_t* changed_conf = conferencelist_get (confID);
GSList * part; GSList * part;
DEBUG ("conference new state %s\n", state); DEBUG ("DBUS: Conference state changed: %s\n", state);
if (changed_conf) { if (changed_conf) {
// remove old conference from calltree // remove old conference from calltree
...@@ -263,6 +263,8 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, ...@@ -263,6 +263,8 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
changed_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD; changed_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
} else if (strcmp (state, "HOLD") == 0) { } else if (strcmp (state, "HOLD") == 0) {
changed_conf->_state = CONFERENCE_STATE_HOLD; changed_conf->_state = CONFERENCE_STATE_HOLD;
} else if (strcmp(state, "HOLD_REC") == 0) {
changed_conf->_state = CONFERENCE_STATE_HOLD_RECORD;
} else { } else {
DEBUG ("Error: conference state not recognized"); DEBUG ("Error: conference state not recognized");
} }
......
...@@ -375,6 +375,7 @@ update_actions() ...@@ -375,6 +375,7 @@ update_actions()
break; break;
case CONFERENCE_STATE_HOLD: case CONFERENCE_STATE_HOLD:
case CONFERENCE_STATE_HOLD_RECORD:
gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE); gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (offHoldToolbar), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (offHoldToolbar), TRUE);
gtk_action_set_sensitive (GTK_ACTION (recordAction), TRUE); gtk_action_set_sensitive (GTK_ACTION (recordAction), TRUE);
...@@ -552,19 +553,25 @@ call_hold (void* foo UNUSED) ...@@ -552,19 +553,25 @@ call_hold (void* foo UNUSED)
switch (selectedConf->_state) { switch (selectedConf->_state) {
case CONFERENCE_STATE_HOLD: { case CONFERENCE_STATE_HOLD:
selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATACHED; selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATACHED;
sflphone_conference_off_hold (selectedConf); sflphone_conference_off_hold (selectedConf);
} break;
break; case CONFERENCE_STATE_HOLD_RECORD:
selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
sflphone_conference_off_hold (selectedConf);
break;
case CONFERENCE_STATE_ACTIVE_ATACHED: case CONFERENCE_STATE_ACTIVE_ATACHED:
case CONFERENCE_STATE_ACTIVE_DETACHED: case CONFERENCE_STATE_ACTIVE_DETACHED:
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
selectedConf->_state = CONFERENCE_STATE_HOLD; selectedConf->_state = CONFERENCE_STATE_HOLD;
sflphone_conference_on_hold (selectedConf); sflphone_conference_on_hold (selectedConf);
break; break;
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
selectedConf->_state = CONFERENCE_STATE_HOLD_RECORD;
sflphone_conference_on_hold (selectedConf);
break;
default: default:
break; break;
} }
...@@ -602,18 +609,23 @@ conference_hold (void* foo UNUSED) ...@@ -602,18 +609,23 @@ conference_hold (void* foo UNUSED)
DEBUG ("UIManager: Hold button pressed (conference)"); DEBUG ("UIManager: Hold button pressed (conference)");
switch (selectedConf->_state) { switch (selectedConf->_state) {
case CONFERENCE_STATE_HOLD: { case CONFERENCE_STATE_HOLD:
selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATACHED; selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATACHED;
sflphone_conference_off_hold (selectedConf); sflphone_conference_off_hold (selectedConf);
} break;
break; case CONFERENCE_STATE_HOLD_RECORD:
selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
sflphone_conference_off_hold (selectedConf);
break;
case CONFERENCE_STATE_ACTIVE_ATACHED: case CONFERENCE_STATE_ACTIVE_ATACHED:
case CONFERENCE_STATE_ACTIVE_DETACHED: { case CONFERENCE_STATE_ACTIVE_DETACHED:
selectedConf->_state = CONFERENCE_STATE_HOLD; selectedConf->_state = CONFERENCE_STATE_HOLD;
sflphone_conference_on_hold (selectedConf); sflphone_conference_on_hold (selectedConf);
} break;
break; case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
selectedConf->_state = CONFERENCE_STATE_HOLD_RECORD;
sflphone_conference_on_hold(selectedConf);
default: default:
break; break;
} }
...@@ -1181,6 +1193,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event) ...@@ -1181,6 +1193,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
case CONFERENCE_STATE_ACTIVE_DETACHED: case CONFERENCE_STATE_ACTIVE_DETACHED:
break; break;
case CONFERENCE_STATE_HOLD: case CONFERENCE_STATE_HOLD:
case CONFERENCE_STATE_HOLD_RECORD:
hangup_conf = TRUE; hangup_conf = TRUE;
hold_conf = TRUE; hold_conf = TRUE;
break; break;
......
...@@ -462,6 +462,7 @@ conf_state_image_widget (conference_state_t state) ...@@ -462,6 +462,7 @@ conf_state_image_widget (conference_state_t state)
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD: case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD: case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
case CONFERENCE_STATE_HOLD: case CONFERENCE_STATE_HOLD:
case CONFERENCE_STATE_HOLD_RECORD:
image = gtk_image_new_from_stock (GTK_STOCK_IM, GTK_ICON_SIZE_LARGE_TOOLBAR); image = gtk_image_new_from_stock (GTK_STOCK_IM, GTK_ICON_SIZE_LARGE_TOOLBAR);
break; break;
default: default:
......
...@@ -145,9 +145,12 @@ std::string Conference::getStateStr() ...@@ -145,9 +145,12 @@ std::string Conference::getStateStr()
case ACTIVE_DETACHED_REC: case ACTIVE_DETACHED_REC:
state_str = "ACTIVE_DETACHED_REC"; state_str = "ACTIVE_DETACHED_REC";
break; break;
case Hold: case HOLD:
state_str = "HOLD"; state_str = "HOLD";
break; break;
case HOLD_REC:
state_str = "HOLD_REC";
break;
default: default:
break; break;
} }
......
...@@ -48,51 +48,101 @@ class Conference: public Recordable ...@@ -48,51 +48,101 @@ class Conference: public Recordable
public: public:
enum ConferenceState {ACTIVE_ATTACHED, ACTIVE_DETACHED, ACTIVE_ATTACHED_REC, ACTIVE_DETACHED_REC, Hold}; enum ConferenceState {ACTIVE_ATTACHED, ACTIVE_DETACHED, ACTIVE_ATTACHED_REC, ACTIVE_DETACHED_REC, HOLD, HOLD_REC};
static int count; static int count;
/**
* Constructor for this class, increment static counter
*/
Conference(); Conference();
/**
* Destructor
*/
~Conference(); ~Conference();
/**
* Return the conference id
*/
std::string getConfID() { std::string getConfID() {
return _id; return _id;
} }
/**
* Return the current conference state
*/
int getState(); int getState();
/**
* Set conference state
*/
void setState (ConferenceState state); void setState (ConferenceState state);
/**
* Return a string description of the conference state
*/
std::string getStateStr(); std::string getStateStr();
/**
* Return the number of participant for this conference
*/
int getNbParticipants() { int getNbParticipants() {
return _nbParticipant; return _nbParticipant;
} }
/**
* Add a new participant to the conference
*/
void add (CallID participant_id); void add (CallID participant_id);
/**
* Remove a participant from the conference
*/
void remove (CallID participant_id); void remove (CallID participant_id);
/**
* Bind a participant to the conference
*/
void bindParticipant (CallID participant_id); void bindParticipant (CallID participant_id);
/**
* Get the participant list for this conference
*/
ParticipantSet getParticipantList(); ParticipantSet getParticipantList();
/**
* Get recording file ID
*/
std::string getRecFileId() { std::string getRecFileId() {
return getConfID(); return getConfID();
} }
/**
* Start/stop recording toggle
*/
virtual bool setRecording(); virtual bool setRecording();
private: private:
/** Unique ID of the conference */ /**
* Unique ID of the conference
*/
CallID _id; CallID _id;
/**
* Conference state
*/
ConferenceState _confState; ConferenceState _confState;
/**
* List of participant ids
*/
ParticipantSet _participants; ParticipantSet _participants;
/**
* Number of participant
*/
int _nbParticipant; int _nbParticipant;
}; };
......
...@@ -619,14 +619,14 @@ bool ManagerImpl::offHoldCall (const CallID& call_id) ...@@ -619,14 +619,14 @@ bool ManagerImpl::offHoldCall (const CallID& call_id)
if (hasCurrentCall()) { if (hasCurrentCall()) {
_debug ("Manager: Has current call, put on hold"); _debug ("Manager: Has current call %s, put on hold", current_call_id.c_str());
// if this is not a conferenceand this and is not a conference participant // if this is not a conference and this and is not a conference participant
if (!isConference (current_call_id) && !participToConference ( if (!isConference (current_call_id) && !participToConference (current_call_id)) {
current_call_id)) { _debug("------------------------------------------------ is not a conference and does not participate to conference");
onHoldCall (current_call_id); onHoldCall (current_call_id);
} else if (isConference (current_call_id) && !participToConference ( } else if (isConference (current_call_id) && !participToConference (call_id)) {
call_id)) { _debug("------------------------------------------------ detach participant");
detachParticipant (default_id, current_call_id); detachParticipant (default_id, current_call_id);
} }
} }
...@@ -907,6 +907,7 @@ void ManagerImpl::holdConference (const CallID& id) ...@@ -907,6 +907,7 @@ void ManagerImpl::holdConference (const CallID& id)
Conference *conf; Conference *conf;
ConferenceMap::iterator iter_conf = _conferencemap.find (id); ConferenceMap::iterator iter_conf = _conferencemap.find (id);
bool isRec = false;
AccountID currentAccountId; AccountID currentAccountId;
...@@ -915,6 +916,14 @@ void ManagerImpl::holdConference (const CallID& id) ...@@ -915,6 +916,14 @@ void ManagerImpl::holdConference (const CallID& id)
if (iter_conf != _conferencemap.end()) { if (iter_conf != _conferencemap.end()) {
conf = iter_conf->second; conf = iter_conf->second;
if(conf->getState() == Conference::ACTIVE_ATTACHED_REC) {
isRec = true;
} else if (conf->getState() == Conference::ACTIVE_DETACHED_REC) {
isRec = true;
} else if (conf->getState() == Conference::HOLD_REC) {
isRec = true;
}
ParticipantSet participants = conf->getParticipantList(); ParticipantSet participants = conf->getParticipantList();
ParticipantSet::iterator iter_participant = participants.begin(); ParticipantSet::iterator iter_participant = participants.begin();
...@@ -930,7 +939,12 @@ void ManagerImpl::holdConference (const CallID& id) ...@@ -930,7 +939,12 @@ void ManagerImpl::holdConference (const CallID& id)
} }
conf->setState (Conference::Hold); if(isRec) {
conf->setState(Conference::HOLD_REC);
}
else {
conf->setState (Conference::HOLD);
}
if (_dbus) if (_dbus)
_dbus->getCallManager()->conferenceChanged (conf->getConfID(), conf->getStateStr()); _dbus->getCallManager()->conferenceChanged (conf->getConfID(), conf->getStateStr());
...@@ -958,6 +972,12 @@ void ManagerImpl::unHoldConference (const CallID& id) ...@@ -958,6 +972,12 @@ void ManagerImpl::unHoldConference (const CallID& id)
ParticipantSet participants = conf->getParticipantList(); ParticipantSet participants = conf->getParticipantList();
ParticipantSet::iterator iter_participant = participants.begin(); ParticipantSet::iterator iter_participant = participants.begin();
if((conf->getState() == Conference::ACTIVE_ATTACHED_REC) ||
(conf->getState() == Conference::ACTIVE_DETACHED_REC) ||
(conf->getState() == Conference::HOLD_REC)) {
isRec = true;
}
while (iter_participant != participants.end()) { while (iter_participant != participants.end()) {
_debug (" unholdConference: participant %s", (*iter_participant).c_str()); _debug (" unholdConference: participant %s", (*iter_participant).c_str());
currentAccountId = getAccountFromCall (*iter_participant); currentAccountId = getAccountFromCall (*iter_participant);
...@@ -975,14 +995,17 @@ void ManagerImpl::unHoldConference (const CallID& id) ...@@ -975,14 +995,17 @@ void ManagerImpl::unHoldConference (const CallID& id)
} }
if(isRec) { if(isRec) {
_debug("----------------------------------------------------------- active attached rec");
conf->setState (Conference::ACTIVE_ATTACHED_REC); conf->setState (Conference::ACTIVE_ATTACHED_REC);
} }
else { else {
conf->setState (Conference::ACTIVE_ATTACHED); conf->setState (Conference::ACTIVE_ATTACHED);
} }
if (_dbus)
_dbus->getCallManager()->conferenceChanged (conf->getConfID(), conf->getStateStr());
if (_dbus) {
_debug("------------------------------------------------------------ dbus %s", conf->getStateStr().c_str());
_dbus->getCallManager()->conferenceChanged (conf->getConfID(), conf->getStateStr());
}
} }
} }
...@@ -2826,21 +2849,25 @@ bool ManagerImpl::getMd5CredentialHashing (void) ...@@ -2826,21 +2849,25 @@ bool ManagerImpl::getMd5CredentialHashing (void)
void ManagerImpl::setRecordingCall (const CallID& id) void ManagerImpl::setRecordingCall (const CallID& id)
{ {
Call *call = NULL;
Conference *conf = NULL;
Recordable* rec = NULL; Recordable* rec = NULL;
if (!isConference (id)) { if (!isConference (id)) {
_debug ("Manager: Set recording for call %s", id.c_str()); _debug ("Manager: Set recording for call %s", id.c_str());
AccountID accountid = getAccountFromCall (id); AccountID accountid = getAccountFromCall (id);
rec = (Recordable *) getAccountLink (accountid)->getCall (id); call = getAccountLink (accountid)->getCall (id);
rec = static_cast<Recordable *>(call);
} else { } else {
_debug ("Manager: Ser recording for conference %s", id.c_str()); _debug ("Manager: Set recording for conference %s", id.c_str());
ConferenceMap::iterator it = _conferencemap.find (id); ConferenceMap::iterator it = _conferencemap.find (id);
rec = (Recordable *) it->second; conf = it->second;
rec = static_cast<Recordable *>(conf);
} }
if (rec) if (rec != NULL) {
rec->setRecording(); rec->setRecording();
}
} }
bool ManagerImpl::isRecording (const CallID& id) bool ManagerImpl::isRecording (const CallID& id)
......
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