From bff1f2961a314c0d63eec9fad90e925b94089e02 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Thu, 10 Mar 2011 18:17:39 -0500
Subject: [PATCH] [#3950] Remove call being transfered from calltree

---
 sflphone-client-gnome/src/actions.c           |  3 +++
 sflphone-client-gnome/src/contacts/calltree.c |  1 +
 sflphone-common/src/sip/sipvoiplink.cpp       | 19 ++++++-------------
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c
index 8ecc3893bc..ec0243fcb9 100644
--- a/sflphone-client-gnome/src/actions.c
+++ b/sflphone-client-gnome/src/actions.c
@@ -466,8 +466,10 @@ sflphone_pick_up()
                 sflphone_new_call();
                 break;
             case CALL_STATE_TRANSFERT:
+                DEBUG("TRANSFER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                 dbus_transfert (selectedCall);
                 set_timestamp (&selectedCall->_time_stop);
+                calltree_remove_call(current_calls, selectedCall, NULL);
                 break;
             case CALL_STATE_CURRENT:
             case CALL_STATE_RECORD:
@@ -816,6 +818,7 @@ sflphone_keypad (guint keyval, gchar * key)
                     case 65421: /* ENTER numpad */
                         dbus_transfert (c);
                         set_timestamp (&c->_time_stop);
+                        calltree_remove_call(current_calls, c, NULL);
                         break;
                     case 65307: /* ESCAPE */
                         sflphone_unset_transfert (c);
diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c
index 0cd39f053e..91bc3f1923 100644
--- a/sflphone-client-gnome/src/contacts/calltree.c
+++ b/sflphone-client-gnome/src/contacts/calltree.c
@@ -1860,6 +1860,7 @@ static void menuitem_response( gchar *string )
     else if(g_strcmp0(string, SFL_TRANSFER_CALL) == 0) {
         g_print("Calltree: Transfering call %s, to %s", selected_call->_peer_number, dragged_call->_peer_number);
         dbus_attended_transfer(selected_call, dragged_call);
+        calltree_remove_call(current_calls, selected_call, NULL);
     }
     else {
         g_print("CallTree: Error unknown option selected in menu %s", string);
diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index 1dd2aa22ff..c5891f70a5 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -758,10 +758,6 @@ SIPVoIPLink::answer (const CallID& id)
 //    AccountID account_id = Manager::instance().getAccountFromCall (id);
 //    SIPAccount *account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (account_id));
 
-    _error ("UserAgent: pool capacity %d", pj_pool_get_capacity (_pool));
-    _error ("UserAgent: pool size %d", pj_pool_get_used_size (_pool));
-
-
     if (call==0) {
         _debug ("UserAgent: SIPCall %s doesn't exists while answering", id.c_str());
         return false;
@@ -3450,14 +3446,10 @@ void transaction_state_changed_cb (pjsip_inv_session *inv UNUSED, pjsip_transact
 
         if (e && e->body.rx_msg.rdata) {
 
-
-            _debug ("Event");
             r_data = e->body.rx_msg.rdata;
 
             if (r_data && r_data->msg_info.msg->line.req.method.id == PJSIP_OTHER_METHOD) {
 
-                _debug ("R_data");
-
                 std::string method_info = "INFO";
                 std::string method_notify = "NOTIFY";
 
@@ -3465,14 +3457,15 @@ void transaction_state_changed_cb (pjsip_inv_session *inv UNUSED, pjsip_transact
 
                 _debug ("UserAgent: %s", request.c_str());
 
-                if (request.find (method_notify) != (size_t)-1) {
-
+                if (request.find (method_notify) != std::string::npos) {
+                	// Attempt to to get feedback of call transfer status
+//                	std::string contentType(e->body.rx_msg.rdata.msg_info.ctype.media.type->ptr,
+//                			e->body.rx_msg.rdata.msg_info.ctype.media.type->slen);
+//                	_debug("OK: %s", contentType.c_str());
                 }
                 // Must reply 200 OK on SIP INFO request
-                else if (request.find (method_info) != (size_t)-1) {
-
+                else if (request.find (method_info) != std::string::npos) {
                     pjsip_dlg_create_response (inv->dlg, r_data, PJSIP_SC_OK, NULL, &t_data);
-
                     pjsip_dlg_send_response (inv->dlg, tsx, t_data);
                 }
             }
-- 
GitLab