From 4b6fb1d0cc74dba427653dc167ddd97539e471bd Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.net> Date: Fri, 28 Aug 2009 14:09:39 -0400 Subject: [PATCH] [#2006] Fix addParticipant method in managerImpl to handle incoming/answered calls --- sflphone-client-gnome/src/actions.c | 13 ++++++++-- sflphone-client-gnome/src/actions.h | 4 ++++ sflphone-client-gnome/src/contacts/calltree.c | 2 +- .../src/dbus/callmanager-introspec.xml | 1 + sflphone-client-gnome/src/dbus/dbus.c | 24 ++++++++++++++++++- sflphone-client-gnome/src/dbus/dbus.h | 2 +- .../src/dbus/callmanager-introspec.xml | 1 + sflphone-common/src/managerimpl.cpp | 18 +++++++++++++- 8 files changed, 59 insertions(+), 6 deletions(-) diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 818ab4fd62..7e69cabc3b 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -848,16 +848,25 @@ sflphone_detach_participant() void sflphone_join_participant(const gchar* sel_callID, const gchar* drag_callID) { - DEBUG("sflphone join participant from conference"); + DEBUG("sflphone join participants %s and %s", sel_callID, drag_callID); + dbus_join_participant(sel_callID, drag_callID); } + + void +sflphone_add_participant(const gchar* callID, const gchar* confID) +{ + DEBUG("sflphone add participant %s to conference %s", callID, confID); + + dbus_add_participant(callID, confID); +} + void sflphone_add_conference() { DEBUG("sflphone add a conference to tree view"); - // dbus_join_participant(selected_call, dragged_call); } diff --git a/sflphone-client-gnome/src/actions.h b/sflphone-client-gnome/src/actions.h index bdddd5bf7e..975aead4c2 100644 --- a/sflphone-client-gnome/src/actions.h +++ b/sflphone-client-gnome/src/actions.h @@ -182,4 +182,8 @@ void sflphone_fill_history (void); void sflphone_save_history (void); +void sflphone_join_participant(const gchar* sel_callID, const gchar* drag_callID); + +void sflphone_add_participant(const gchar* callID, const gchar* confID); + #endif diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 3e0725ea31..db5b7aa20c 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -921,7 +921,7 @@ static void drag_end_cb(GtkWidget * widget, GdkDragContext * context, gpointer d else if(selected_type == A_CALL && dragged_type == A_CONFERENCE) { // TODO: dragged a single call on a conference - sflphone_join_participant(selected_call_id, dragged_call_id); + sflphone_add_participant(selected_call_id, dragged_call_id); } else if(selected_type == A_CONFERENCE && dragged_type == A_CALL) { diff --git a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml index 82985df2aa..e5632590c5 100644 --- a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml @@ -126,6 +126,7 @@ </signal> <signal name="conferenceChanged"> + <arg type="s" name="confID" direction="out"/> </signal> <method name="getParticipantList"> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index eb8079cf6a..f0c939b560 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -205,6 +205,7 @@ call_state_cb (DBusGProxy *proxy UNUSED, static void conference_changed_cb (DBusGProxy *proxy UNUSED, + const gchar* confID, void * foo UNUSED ) { DEBUG ("Conference changed\n"); @@ -402,7 +403,7 @@ dbus_connect () dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal (callManagerProxy, - "conferenceChanged", G_TYPE_INVALID); + "conferenceChanged", G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (callManagerProxy, "conferenceChanged", G_CALLBACK(conference_changed_cb), NULL, NULL); @@ -1316,6 +1317,27 @@ dbus_join_participant(const gchar* sel_callID, const gchar* drag_callID) } + +dbus_add_participant(const gchar* callID, const gchar* confID) +{ + + DEBUG("dbus_add_participant %s and %s\n", callID, confID); + + GError* error = NULL; + + org_sflphone_SFLphone_CallManager_add_participant ( + callManagerProxy, + callID, + confID, + &error); + if(error) + { + g_error_free(error); + } + +} + + void dbus_detach_participant(const callable_obj_t * c) { diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index 9a7c0b8d21..46c0a31507 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -449,7 +449,7 @@ void dbus_set_stun_server( gchar* server); gint dbus_stun_is_enabled (void); void dbus_enable_stun (void); -void dbus_add_participant(const callable_obj_t * c); +void dbus_add_participant(const gchar* callID, const gchar* confID); void dbus_set_record (const callable_obj_t * c); diff --git a/sflphone-common/src/dbus/callmanager-introspec.xml b/sflphone-common/src/dbus/callmanager-introspec.xml index f2acd1232f..f5770851db 100644 --- a/sflphone-common/src/dbus/callmanager-introspec.xml +++ b/sflphone-common/src/dbus/callmanager-introspec.xml @@ -126,6 +126,7 @@ </signal> <signal name="conferenceChanged"> + <arg type="s" name="confID" direction="out"/> </signal> <method name="getParticipantList"> diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 6ed3d43b45..f5ec73d902 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -743,7 +743,10 @@ ManagerImpl::addParticipant(const CallID& call_id, const CallID& conference_id) _debug("ManagerImpl::addParticipant(%s, %s)\n", call_id.c_str(), conference_id.c_str()); // _debug(" Current call ID %s\n", getCurrentCallId().c_str()); + std::map<std::string, std::string> call_details = getCallDetails(call_id); + ConferenceMap::iterator iter = _conferencemap.find(conference_id); + std::map<std::string, std::string>::iterator iter_details; if(iter == _conferencemap.end()) { @@ -762,7 +765,20 @@ ManagerImpl::addParticipant(const CallID& call_id, const CallID& conference_id) _conferencecall.insert(pair<CallID, Conference*>(call_id, conf)); - answerCall(call_id); + iter_details = call_details.find("CALL_STATE"); + + if (iter_details->second == "HOLD") + { + _debug(" OFFHOLD %s\n", call_id.c_str()); + offHoldCall(call_id); + } + else if(iter_details->second == "INCOMING") + { + _debug(" ANSWER %s\n", call_id.c_str()); + answerCall(call_id); + } + + _dbus->getCallManager()->conferenceChanged(conference_id); } } -- GitLab