From 42261f4900f6ab42c9ce62f0f6ed18829c584bb8 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Wed, 14 Aug 2013 14:50:36 +0200 Subject: [PATCH] Make the call transfer even if the call ends --- README | 2 +- console/shell.c | 2 +- coreapi/bellesip_sal/sal_op_call_transfer.c | 3 ++ coreapi/callbacks.c | 3 ++ gtk/main.c | 1 + tester/call_tester.c | 53 +++++++++++++++++++-- 6 files changed, 59 insertions(+), 5 deletions(-) diff --git a/README b/README index 4a658cb17..0efd14949 100644 --- a/README +++ b/README @@ -32,7 +32,7 @@ This is Linphone, a free (GPL) video softphone based on the SIP protocol. Here is the command line to get these dependencies installed for Ubuntu && Debian - $ sudo apt-get install libtool intltool libgtk2.0-dev libosip2-dev libexosip2-dev libspeexdsp-dev libavcodec-dev libswscale-dev libx11-dev libvxl1-dev libgl1-mesa-dev libglew1.6-dev libv4l-dev + $ sudo apt-get install libtool intltool libgtk2.0-dev libosip2-dev libexosip2-dev libspeexdsp-dev libavcodec-dev libswscale-dev libx11-dev libvx-dev libgl1-mesa-dev libglew1.6-dev libv4l-dev + for optional library $ sudo apt-get install libreadline-dev libgsm1-dev libtheora-dev libsoup2.4-dev libsqlite3-dev libupnp4-dev diff --git a/console/shell.c b/console/shell.c index e61a6e514..bfc758bf8 100644 --- a/console/shell.c +++ b/console/shell.c @@ -25,9 +25,9 @@ #ifdef WIN32 +#include #include #include -#include #include #include #else diff --git a/coreapi/bellesip_sal/sal_op_call_transfer.c b/coreapi/bellesip_sal/sal_op_call_transfer.c index c7fca7241..c996ab723 100644 --- a/coreapi/bellesip_sal/sal_op_call_transfer.c +++ b/coreapi/bellesip_sal/sal_op_call_transfer.c @@ -148,6 +148,9 @@ static int send_notify_for_refer(SalOp* op, const char *sipfrag){ } int sal_call_notify_refer_state(SalOp *op, SalOp *newcall){ + if(belle_sip_dialog_get_state(op->dialog) == BELLE_SIP_DIALOG_TERMINATED){ + return 0; + } belle_sip_dialog_state_t state=newcall->dialog?belle_sip_dialog_get_state(newcall->dialog):BELLE_SIP_DIALOG_NULL; switch(state) { case BELLE_SIP_DIALOG_NULL: diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 534b488d0..16fa1ed1f 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -540,6 +540,9 @@ static void call_terminated(SalOp *op, const char *from){ break; } ms_message("Current call terminated..."); + if (call->refer_pending){ + linphone_core_start_refered_call(lc,call); + } //we stop the call only if we have this current call or if we are in call if (lc->ringstream!=NULL && ( (ms_list_size(lc->calls) == 1) || linphone_core_in_call(lc) )) { linphone_core_stop_ringing(lc); diff --git a/gtk/main.c b/gtk/main.c index 7b0bbe9b1..65a7859e9 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef WIN32 #define chdir _chdir +#include "direct.h" #endif #if defined(HAVE_NOTIFY1) || defined(HAVE_NOTIFY4) diff --git a/tester/call_tester.c b/tester/call_tester.c index c57954843..8486d003f 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -80,6 +80,7 @@ void linphone_transfer_state_changed(LinphoneCore *lc, LinphoneCall *transfered, } } +#ifdef VIDEO_ENABLED static void linphone_call_cb(LinphoneCall *call,void * user_data) { char* to=linphone_address_as_string(linphone_call_get_call_log(call)->to); char* from=linphone_address_as_string(linphone_call_get_call_log(call)->from); @@ -91,8 +92,7 @@ static void linphone_call_cb(LinphoneCall *call,void * user_data) { counters = (stats*)get_stats(lc); counters->number_of_IframeDecoded++; } - - +#endif bool_t call_with_params(LinphoneCoreManager* caller_mgr ,LinphoneCoreManager* callee_mgr @@ -870,10 +870,10 @@ static void call_with_declined_srtp(void) { } #ifdef VIDEO_ENABLED static void srtp_video_ice_call(void) { + int i=0; #else static void srtp_ice_call(void) { #endif - int i=0; LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); @@ -993,6 +993,52 @@ static void simple_call_transfer(void) { ms_list_free(lcs); } +static void mean_call_transfer(void) { + LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); + LinphoneCoreManager* laure = linphone_core_manager_new( "laure_rc"); + LinphoneCall* pauline_called_by_marie; + + char* laure_identity=linphone_address_as_string(laure->identity); + MSList* lcs=ms_list_append(NULL,marie->lc); + lcs=ms_list_append(lcs,pauline->lc); + lcs=ms_list_append(lcs,laure->lc); + + + CU_ASSERT_TRUE(call(marie,pauline)); + pauline_called_by_marie=linphone_core_get_current_call(marie->lc); + + reset_counters(&marie->stat); + reset_counters(&pauline->stat); + reset_counters(&laure->stat); + + linphone_core_transfer_call(marie->lc,pauline_called_by_marie,laure_identity); + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000)); + + /*marie ends the call */ + linphone_core_terminate_call(marie->lc,pauline_called_by_marie); + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); + + /*Pauline starts the transfer*/ + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000)); + linphone_core_accept_call(laure->lc,linphone_core_get_current_call(laure->lc)); + CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000)); + + CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000)); + + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); + linphone_core_manager_destroy(laure); + ms_list_free(lcs); +} + static void call_transfer_existing_call_outgoing_call(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); @@ -1097,6 +1143,7 @@ test_t call_tests[] = { { "Call with privacy", call_with_privacy }, { "Simple conference", simple_conference }, { "Simple call transfer", simple_call_transfer }, + { "Mean call transfer", mean_call_transfer }, { "Call transfer existing call outgoing call", call_transfer_existing_call_outgoing_call }, { "Call with ICE", call_with_ice }, { "Call with custom headers",call_with_custom_headers}