Commit 66f31c2e authored by Alexandre Savard's avatar Alexandre Savard

#5747: Add recording state for conferences

parent 9209fd46
......@@ -33,7 +33,10 @@ buttons_DATA = current.svg \
contact_default.svg \
face-monkey.svg \
users.svg \
usersActive.svg \
usersAttached.svg \
usersDetached.svg \
usersAttachedRec.svg \
usersDetachedRec.svg \
home.svg \
wait-on.gif \
lock_certified.svg \
......
......@@ -15,7 +15,7 @@
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/apps"
sodipodi:docname="usersActive.svg"
sodipodi:docname="usersAttached.svg"
inkscape:export-filename="/home/jimmac/src/cvs/gnome/gnome-icon-theme/48x48/stock/generic/stock_person.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
......
......@@ -1099,11 +1099,17 @@ sflphone_rec_call()
switch (selectedConf->_state) {
case CONFERENCE_STATE_ACTIVE_ATACHED:
selectedConf->_state = CONFERENCE_STATE_RECORD;
selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
break;
case CONFERENCE_STATE_RECORD:
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
selectedConf->_state = CONFERENCE_STATE_ACTIVE_ATACHED;
break;
case CONFERENCE_STATE_ACTIVE_DETACHED:
selectedConf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
break;
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
selectedConf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
break;
default:
WARN ("Should not happen in sflphone_off_hold ()!");
break;
......
......@@ -93,14 +93,17 @@ void create_new_conference_from_details (const gchar *conf_id, GHashTable *detai
state_str = g_hash_table_lookup (details, "CONF_STATE");
if (g_strcasecmp (state_str, "ACTIVE_ATACHED") == 0)
if (g_strcasecmp (state_str, "ACTIVE_ATACHED") == 0) {
new_conf->_state = CONFERENCE_STATE_ACTIVE_ATACHED;
else if (g_strcasecmp (state_str, "ACTIVE_DETACHED") == 0)
} else if (g_strcasecmp (state_str, "ACTIVE_ATTACHED_REC") == 0) {
new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
} else if (g_strcasecmp (state_str, "ACTIVE_DETACHED") == 0) {
new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED;
else if (g_strcasecmp (state_str, "HOLD") == 0)
} else if (g_strcasecmp (state_str, "ACTIVE_DETACHED_REC") == 0) {
new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
} else if (g_strcasecmp (state_str, "HOLD") == 0) {
new_conf->_state = CONFERENCE_STATE_HOLD;
}
*conf = new_conf;
}
......
......@@ -44,7 +44,8 @@
typedef enum {
CONFERENCE_STATE_ACTIVE_ATACHED = 0,
CONFERENCE_STATE_ACTIVE_DETACHED,
CONFERENCE_STATE_RECORD,
CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD,
CONFERENCE_STATE_ACTIVE_DETACHED_RECORD,
CONFERENCE_STATE_HOLD
} conference_state_t;
......
......@@ -257,13 +257,14 @@ row_activated (GtkTreeView *tree_view UNUSED,
switch (selectedConf->_state) {
case CONFERENCE_STATE_ACTIVE_DETACHED:
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
sflphone_add_main_participant (selectedConf);
break;
case CONFERENCE_STATE_HOLD:
sflphone_conference_off_hold (selectedConf);
break;
case CONFERENCE_STATE_ACTIVE_ATACHED:
case CONFERENCE_STATE_RECORD:
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
default:
break;
}
......@@ -841,11 +842,9 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
case SRTP_STATE_ZRTP_SAS_UNCONFIRMED:
DEBUG ("Secure is ON");
pixbuf_security = gdk_pixbuf_new_from_file (ICONS_DIR "/lock_unconfirmed.svg", NULL);
if (c->_sas != NULL) {
DEBUG ("SAS is ready with value %s", c->_sas);
}
break;
case SRTP_STATE_ZRTP_SAS_CONFIRMED:
DEBUG ("SAS is confirmed");
......@@ -866,7 +865,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
default:
WARN ("Update calltree srtp state #%d- Should not happen!", c->_srtp_state);
if (g_strcasecmp (srtp_enabled,"true") == 0) {
if (g_strcasecmp (srtp_enabled, "true") == 0) {
pixbuf_security = gdk_pixbuf_new_from_file (ICONS_DIR "/lock_off.svg", NULL);
}
......@@ -1135,23 +1134,22 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
if (tab == current_calls) {
switch (conf->_state) {
case CONFERENCE_STATE_ACTIVE_ATACHED: {
pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/usersActive.svg", NULL);
case CONFERENCE_STATE_ACTIVE_ATACHED:
pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/usersAttached.svg", NULL);
break;
}
case CONFERENCE_STATE_ACTIVE_DETACHED:
case CONFERENCE_STATE_HOLD: {
pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/users.svg", NULL);
case CONFERENCE_STATE_HOLD:
pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/usersDetached.svg", NULL);
break;
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttachedRec.svg", NULL);
break;
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersDetachedRec.svg", NULL);
break;
}
default:
WARN ("Update conference add - Should not happen!");
}
} else {
DEBUG ("Error Conference State NULL for conferece %s!!!!!", conf->_confID);
}
......@@ -1172,22 +1170,12 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
// Every participant to a conference must be secured, the conference is not secured elsewhere
conf->_conference_secured = TRUE;
DEBUG ("Calltree: Determine if conference is secured");
// participant = conf->participant;
// participant = dbus_get_participant_list(conf->_confID);
conference_participant = conf->participant_list;
if (conference_participant) {
DEBUG ("Calltree: Determine if at least one participant uses SRTP");
// participant = conf->participant;
// participant = dbus_get_participant_list(conf->_confID);
// for (pl = participant; *pl; pl++)
while (conference_participant) {
// call_id = (gchar*)(*pl);
call_id = (gchar*) (conference_participant->data);
call = calllist_get (tab, call_id);
......@@ -1199,7 +1187,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
srtp_enabled = g_hash_table_lookup (account_details->properties, ACCOUNT_SRTP_ENABLED);
}
if (g_strcasecmp (srtp_enabled,"true") == 0) {
if (g_strcasecmp (srtp_enabled, "true") == 0) {
DEBUG ("Calltree: SRTP enabled for participant %s", call_id);
conf->_conf_srtp_enabled = TRUE;
break;
......@@ -1227,7 +1215,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf)
if (call != NULL) {
if (call->_srtp_state == 0) {
if (call->_srtp_state == SRTP_STATE_UNLOCKED) {
DEBUG ("Calltree: Participant %s is not secured", call_id);
conf->_conference_secured = FALSE;
break;
......
......@@ -239,7 +239,6 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
const gchar* state, void * foo UNUSED)
{
// gchar** part;
callable_obj_t *call;
gchar* call_id;
......@@ -258,6 +257,10 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
changed_conf->_state = CONFERENCE_STATE_ACTIVE_ATACHED;
} else if (strcmp (state, "ACTIVE_DETACHED") == 0) {
changed_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED;
} else if (strcmp (state, "ACTIVE_ATTACHED_REC") == 0) {
changed_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
} else if (strcmp(state, "ACTIVE_DETACHED_REC") == 0) {
changed_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
} else if (strcmp (state, "HOLD") == 0) {
changed_conf->_state = CONFERENCE_STATE_HOLD;
} else {
......@@ -277,8 +280,6 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
part = g_slist_next (part);
}
// new_participants = (gchar **) dbus_get_participant_list (changed_conf->_confID);
// update conferece participants
conference_participant_list_update (dbus_get_participant_list (changed_conf->_confID), changed_conf);
......@@ -324,8 +325,15 @@ conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
call = calllist_get (current_calls, call_id);
// if a text widget is already created, disable it, use conference widget instead
if (call->_im_widget)
if (call->_im_widget) {
im_widget_update_state (IM_WIDGET (call->_im_widget), FALSE);
}
// if one of these participant is currently recording, the whole conference will be recorded
if(call->_state == CALL_STATE_RECORD) {
new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
}
call->_confID = g_strdup (confID);
}
......
......@@ -358,7 +358,7 @@ update_actions()
break;
case CONFERENCE_STATE_RECORD:
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
DEBUG ("UIManager: Conference state record");
gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (holdToolbar), TRUE);
......
......@@ -459,7 +459,8 @@ conf_state_image_widget (conference_state_t state)
switch (state) {
case CONFERENCE_STATE_ACTIVE_ATACHED:
case CONFERENCE_STATE_ACTIVE_DETACHED:
case CONFERENCE_STATE_RECORD:
case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD:
case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD:
case CONFERENCE_STATE_HOLD:
image = gtk_image_new_from_stock (GTK_STOCK_IM, GTK_ICON_SIZE_LARGE_TOOLBAR);
break;
......
......@@ -93,66 +93,44 @@ Call::getStateStr ()
std::string state_str;
switch (state) {
case Active:
switch (connection) {
case Ringing:
(type == Incoming) ? state_str = "INCOMING":state_str = "RINGING";
break;
case Connected:
state_str = "CURRENT";
break;
default:
state_str = "CURRENT";
break;
}
break;
case Hold:
state_str = "HOLD";
break;
case Busy:
state_str = "BUSY";
break;
case Inactive:
switch (connection) {
case Ringing:
(type == Incoming) ? state_str = "INCOMING":state_str = "RINGING";
break;
case Connected:
state_str = "CURRENT";
break;
default:
state_str = "INACTIVE";
break;
}
break;
case Conferencing:
state_str = "CONFERENCING";
break;
case Refused:
case Error:
case Active:
switch (connection) {
case Ringing:
(type == Incoming) ? state_str = "INCOMING":state_str = "RINGING";
break;
case Connected:
default:
state_str = "FAILURE";
isRecording() ? state_str = "RECORD" : state_str = "CURRENT";
break;
}
case Hold:
state_str = "HOLD";
break;
case Busy:
state_str = "BUSY";
break;
case Inactive:
switch (connection) {
case Ringing:
(type == Incoming) ? state_str = "INCOMING":state_str = "RINGING";
break;
case Connected:
state_str = "CURRENT";
break;
default:
state_str = "INACTIVE";
break;
}
break;
case Conferencing:
state_str = "CONFERENCING";
break;
case Refused:
case Error:
default:
state_str = "FAILURE";
break;
}
return state_str;
}
......
......@@ -38,7 +38,7 @@
int Conference::count = 0;
Conference::Conference() : _id (""), _confState (Active_Atached), _nbParticipant (0)
Conference::Conference() : _id (""), _confState (ACTIVE_ATTACHED), _nbParticipant (0)
{
_nbParticipant = 0;
......@@ -133,18 +133,21 @@ std::string Conference::getStateStr()
switch (_confState) {
case Active_Atached:
case ACTIVE_ATTACHED:
state_str = "ACTIVE_ATACHED";
break;
case Active_Detached:
case ACTIVE_DETACHED:
state_str = "ACTIVE_DETACHED";
break;
case ACTIVE_ATTACHED_REC:
state_str = "ACTIVE_ATTACHED_REC";
break;
case ACTIVE_DETACHED_REC:
state_str = "ACTIVE_DETACHED_REC";
break;
case Hold:
state_str = "HOLD";
break;
default:
break;
}
......
......@@ -48,7 +48,7 @@ class Conference: public Recordable
public:
enum ConferenceState {Active_Atached, Active_Detached, Hold};
enum ConferenceState {ACTIVE_ATTACHED, ACTIVE_DETACHED, ACTIVE_ATTACHED_REC, ACTIVE_DETACHED_REC, Hold};
static int count;
......
......@@ -604,10 +604,10 @@ bool ManagerImpl::offHoldCall (const CallID& call_id)
{
AccountID account_id;
bool returnValue, is_rec;
bool returnValue, isRec;
std::string codecName;
is_rec = false;
isRec = false;
_debug ("Manager: Put call %s off hold", call_id.c_str());
......@@ -651,16 +651,17 @@ bool ManagerImpl::offHoldCall (const CallID& call_id)
_debug ("Manager: Setting offhold, Account %s, callid %s", account_id.c_str(), call_id.c_str());
is_rec = getAccountLink (account_id)->getCall (call_id)->isRecording();
isRec = getAccountLink (account_id)->getCall (call_id)->isRecording();
returnValue = getAccountLink (account_id)->offhold (call_id);
}
if (_dbus) {
if (is_rec)
if (isRec) {
_dbus->getCallManager()->callStateChanged (call_id, "UNHOLD_RECORD");
else
}
else {
_dbus->getCallManager()->callStateChanged (call_id, "UNHOLD_CURRENT");
}
}
if (participToConference (call_id)) {
......@@ -945,6 +946,7 @@ void ManagerImpl::unHoldConference (const CallID& id)
Conference *conf;
ConferenceMap::iterator iter_conf = _conferencemap.find (id);
bool isRec = false;
AccountID currentAccountId;
......@@ -961,14 +963,23 @@ void ManagerImpl::unHoldConference (const CallID& id)
currentAccountId = getAccountFromCall (*iter_participant);
call = getAccountLink (currentAccountId)->getCall (*iter_participant);
// if one call is currently recording, the conference is in state recording
if(call->isRecording()) {
isRec = true;
}
offHoldCall (*iter_participant);
iter_participant++;
}
conf->setState (Conference::Active_Atached);
if(isRec) {
conf->setState (Conference::ACTIVE_ATTACHED_REC);
}
else {
conf->setState (Conference::ACTIVE_ATTACHED);
}
if (_dbus)
_dbus->getCallManager()->conferenceChanged (conf->getConfID(), conf->getStateStr());
......@@ -1120,8 +1131,7 @@ void ManagerImpl::addMainParticipant (const CallID& conference_id)
ParticipantSet::iterator iter_participant = participants.begin();
while (iter_participant != participants.end()) {
getMainBuffer()->bindCallID (*iter_participant,
default_id);
getMainBuffer()->bindCallID (*iter_participant, default_id);
iter_participant++;
}
......@@ -1137,7 +1147,7 @@ void ManagerImpl::addMainParticipant (const CallID& conference_id)
getMainBuffer()->flush (default_id);
conf->setState (Conference::Active_Atached);
conf->setState (Conference::ACTIVE_ATTACHED);
if (_dbus)
_dbus->getCallManager()->conferenceChanged (conference_id, conf->getStateStr());
......@@ -1151,6 +1161,7 @@ void ManagerImpl::addMainParticipant (const CallID& conference_id)
void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id2)
{
bool isRec = false;
_debug ("Manager: Join participants %s, %s", call_id1.c_str(), call_id2.c_str());
......@@ -1203,14 +1214,19 @@ void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id
iter_details = call1_details.find ("CALL_STATE");
_debug ("Manager: Process call %s state: %s", call_id1.c_str(), iter_details->second.c_str());
if (iter_details->second == "HOLD") {
std::string call1_state_str = iter_details->second;
if (call1_state_str == "HOLD") {
offHoldCall (call_id1);
} else if (iter_details->second == "INCOMING") {
} else if (call1_state_str == "INCOMING") {
answerCall (call_id1);
} else if (iter_details->second == "CURRENT") {
} else if (call1_state_str == "CURRENT") {
getMainBuffer()->unBindAll (call_id1);
conf->bindParticipant (call_id1);
} else if (iter_details->second == "INACTIVE") {
} else if (call1_state_str == "RECORD") {
getMainBuffer()->unBindAll(call_id1);
conf->bindParticipant(call_id1);
isRec = true;
} else if (call1_state_str == "INACTIVE") {
answerCall (call_id1);
} else {
_warn ("Manager: Call state not recognized");
......@@ -1224,14 +1240,19 @@ void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id
iter_details = call2_details.find ("CALL_STATE");
_debug ("Manager: Process call %s state: %s", call_id2.c_str(), iter_details->second.c_str());
if (iter_details->second == "HOLD") {
std::string call2_state_str = iter_details->second;
if (call2_state_str == "HOLD") {
offHoldCall (call_id2);
} else if (iter_details->second == "INCOMING") {
} else if (call2_state_str == "INCOMING") {
answerCall (call_id2);
} else if (iter_details->second == "CURRENT") {
} else if (call2_state_str == "CURRENT") {
getMainBuffer()->unBindAll (call_id2);
conf->bindParticipant (call_id2);
} else if (iter_details->second == "INACTIVE") {
} else if (call2_state_str == "RECORD") {
getMainBuffer()->unBindAll (call_id2);
conf->bindParticipant (call_id2);
isRec = true;
} else if (call2_state_str == "INACTIVE") {
answerCall (call_id2);
} else {
_warn ("Manager: Call state not recognized");
......@@ -1240,6 +1261,7 @@ void ManagerImpl::joinParticipant (const CallID& call_id1, const CallID& call_id
audioLayerMutexLock();
if (_audiodriver) {
conf->setState(Conference::ACTIVE_ATTACHED_REC);
conf->setRecordingSmplRate(_audiodriver->getSampleRate());
_audiodriver->getMainBuffer()->stateInfo();
}
......@@ -1305,7 +1327,7 @@ void ManagerImpl::detachParticipant (const CallID& call_id,
ConferenceMap::iterator iter = _conferencemap.find (current_call_id);
Conference *conf = iter->second;
conf->setState (Conference::Active_Detached);
conf->setState (Conference::ACTIVE_DETACHED);
if (_dbus)
_dbus->getCallManager()->conferenceChanged (conf->getConfID(), conf->getStateStr());
......@@ -2205,7 +2227,6 @@ void ManagerImpl::ringback ()
void ManagerImpl::ringtone (const AccountID& accountID)
{
std::string ringchoice;
AudioLayer *audiolayer;
AudioCodec *codecForTone;
int layer, samplerate;
bool loadFile;
......@@ -2282,7 +2303,7 @@ void ManagerImpl::ringtone (const AccountID& accountID)
audioLayerMutexLock();
// start audio if not started AND flush all buffers (main and urgent)
audiolayer->startStream();
_audiodriver->startStream();
audioLayerMutexUnlock();
} else {
......
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