From 4b648c11582e892a3ca579c01e39f3192557081d Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Wed, 31 May 2017 15:25:47 +0200 Subject: [PATCH] Use of BCTBX_NO_BREAK instead of LINPHONE_NO_BREAK --- coreapi/bellesip_sal/sal_op_call.c | 18 +-- coreapi/callbacks.c | 25 ++-- coreapi/linphonecall.c | 8 +- coreapi/linphonecore.c | 11 +- gtk/main.c | 5 +- include/linphone/defs.h | 10 -- tester/call_single_tester.c | 178 +++++++++++++++-------------- 7 files changed, 126 insertions(+), 129 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index df06c1e8e..b81582078 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "sal_impl.h" #include "offeranswer.h" +#include + static int extract_sdp(SalOp* op,belle_sip_message_t* message,belle_sdp_session_description_t** session_desc, SalReason *error); /*used for calls terminated before creation of a dialog*/ @@ -149,10 +151,10 @@ static void call_process_io_error(void *user_ctx, const belle_sip_io_error_event if (op->state == SalOpStateTerminated) return; if (op->pending_client_trans && (belle_sip_transaction_get_state(BELLE_SIP_TRANSACTION(op->pending_client_trans)) == BELLE_SIP_TRANSACTION_INIT)) { - + sal_error_info_set(&op->error_info, SalReasonIOError, "SIP", 503, "IO error", NULL); op->base.root->callbacks.call_failure(op); - + if (!op->dialog || belle_sip_dialog_get_state(op->dialog) != BELLE_SIP_DIALOG_CONFIRMED){ /* Call terminated very very early, before INVITE is even sent, probably DNS resolution timeout. */ op->state = SalOpStateTerminating; @@ -223,7 +225,7 @@ void sal_call_cancel_invite(SalOp* op) { sal_op_send_request(op,cancel); }else if (op->dialog){ belle_sip_dialog_state_t state = belle_sip_dialog_get_state(op->dialog);; - /*case where the response received is invalid (could not establish a dialog), but the transaction is not cancellable + /*case where the response received is invalid (could not establish a dialog), but the transaction is not cancellable * because already terminated*/ switch(state){ case BELLE_SIP_DIALOG_EARLY: @@ -412,7 +414,7 @@ static void call_process_transaction_terminated(void *user_ctx, const belle_sip_ resp=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(server_transaction)); } if (resp) code = belle_sip_response_get_status_code(resp); - + if (op->state == SalOpStateTerminating && strcmp("BYE",belle_sip_request_get_method(req))==0 && (!resp || (belle_sip_response_get_status_code(resp) != 401 @@ -611,7 +613,7 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t drop_op = TRUE; } break; - } /* else same behavior as for EARLY state, thus NO BREAK*/ + }BCTBX_NO_BREAK; /* else same behavior as for EARLY state, thus NO BREAK*/ } case BELLE_SIP_DIALOG_EARLY: { if (strcmp("CANCEL",method)==0) { @@ -646,7 +648,7 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t case BELLE_SIP_DIALOG_CONFIRMED: /*great ACK received*/ if (strcmp("ACK",method)==0) { - if (!op->pending_client_trans || + if (!op->pending_client_trans || !belle_sip_transaction_state_is_transient(belle_sip_transaction_get_state((belle_sip_transaction_t*)op->pending_client_trans))){ if (op->sdp_offering){ SalReason reason; @@ -990,7 +992,7 @@ int sal_call_decline_with_error_info(SalOp *op, const SalErrorInfo *info, const belle_sip_header_contact_t* contact=NULL; int status = info->protocol_code; belle_sip_transaction_t *trans; - + if (info->reason==SalReasonRedirect){ if (redirection!=NULL) { if (strstr(redirection,"sip:")!=0) status=302; @@ -1098,7 +1100,7 @@ int sal_call_terminate_with_error(SalOp *op, const SalErrorInfo *info){ p_sei = &sei; } else{ p_sei = info; - + } belle_sip_dialog_state_t dialog_state=op->dialog?belle_sip_dialog_get_state(op->dialog):BELLE_SIP_DIALOG_NULL; if (op->state==SalOpStateTerminating || op->state==SalOpStateTerminated) { diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 99c187683..600953dea 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "private.h" #include "mediastreamer2/mediastream.h" #include "linphone/lpconfig.h" +#include // stat #ifndef _WIN32 @@ -255,7 +256,7 @@ static LinphoneCall * look_for_broken_call_to_replace(SalOp *h, LinphoneCore *lc } it = bctbx_list_next(it); } - + return NULL; } @@ -277,7 +278,7 @@ static void call_received(SalOp *h){ linphone_call_replace_op(replaced_call, h); return; } - + p_asserted_id = sal_custom_header_find(sal_op_get_recv_custom_header(h),"P-Asserted-Identity"); /*in some situation, better to trust the network rather than the UAC*/ if (lp_config_get_int(lc->config,"sip","call_logs_use_asserted_id_instead_of_from",0)) { @@ -332,7 +333,7 @@ static void call_received(SalOp *h){ sal_op_release(h); return; } - + if (sal_op_get_privacy(h) == SalPrivacyNone) { from_address_to_search_if_me=linphone_address_clone(from_addr); @@ -569,10 +570,10 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o switch (call->state){ case LinphoneCallResuming: linphone_core_notify_display_status(lc,_("Call resumed.")); - LINPHONE_NO_BREAK; /*intentionally no break*/ + BCTBX_NO_BREAK; /*intentionally no break*/ case LinphoneCallConnected: if (call->referer) linphone_core_notify_refer_state(lc,call->referer,call); - LINPHONE_NO_BREAK; /*intentionally no break*/ + BCTBX_NO_BREAK; /*intentionally no break*/ case LinphoneCallUpdating: case LinphoneCallUpdatedByRemote: if (!sal_media_description_has_dir(call->localdesc, SalStreamInactive) && @@ -741,7 +742,7 @@ static void call_updated(LinphoneCore *lc, LinphoneCall *call, SalOp *op, bool_t case LinphoneCallResuming: sal_error_info_set(&sei,SalReasonInternalError, "SIP", 0, NULL, NULL); sal_call_decline_with_error_info(call->op, &sei,NULL); - LINPHONE_NO_BREAK; /*no break*/ + BCTBX_NO_BREAK; /*no break*/ case LinphoneCallIdle: case LinphoneCallOutgoingInit: case LinphoneCallEnd: @@ -764,7 +765,7 @@ static void call_updating(SalOp *op, bool_t is_update){ LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); SalMediaDescription *rmd=sal_call_get_remote_media_description(op); SalErrorInfo sei = {0}; - + if (!call) { ms_error("call_updating(): call doesn't exist anymore"); return ; @@ -903,12 +904,12 @@ static void call_failure(SalOp *op){ LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); bool_t stop_ringing = TRUE; bctbx_list_t *calls = lc->calls; - + if (call==NULL){ ms_warning("Call faillure reported on already terminated call."); return ; } - + referer=call->referer; linphone_core_notify_show_interface(lc); @@ -1296,7 +1297,7 @@ static bool_t fill_auth_info(LinphoneCore *lc, SalAuthInfo* sai) { fill_auth_info_with_client_certificate(lc, sai); } } - + if (sai->realm && !ai->realm){ /*if realm was not known, then set it so that ha1 may eventually be calculated and clear text password dropped*/ linphone_auth_info_set_realm(ai, sai->realm); @@ -1423,7 +1424,7 @@ static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, SalB if (out_of_dialog){ /*out of dialog NOTIFY do not create an implicit subscription*/ linphone_event_set_state(lev, LinphoneSubscriptionTerminated); - }else if (st!=SalSubscribeNone){ + }else if (st!=SalSubscribeNone){ linphone_event_set_state(lev,linphone_subscription_state_from_sal(st)); } } @@ -1534,5 +1535,3 @@ SalCallbacks linphone_sal_callbacks={ on_expire, on_notify_response }; - - diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 67eabe457..d0bc3962d 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -41,6 +41,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mediastreamer2/mssndcard.h" #include "mediastreamer2/msrtt4103.h" +#include + static const char *EC_STATE_STORE = ".linphone.ecstate"; #define EC_STATE_MAX_LEN 1048576 // 1Mo @@ -2540,7 +2542,7 @@ static void setZrtpCryptoTypesParameters(MSZrtpParams *params, LinphoneCore *lc) break; case MS_AES_CM_256_SHA1_80: ms_warning("Deprecated crypto suite MS_AES_CM_256_SHA1_80, use MS_AES_256_SHA1_80 instead"); - LINPHONE_NO_BREAK; + BCTBX_NO_BREAK; case MS_AES_256_SHA1_80: params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES3; params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS80; @@ -3090,7 +3092,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m *used_pt = payload_type_get_number(pt); } } - + if (pt->flags & PAYLOAD_TYPE_BITRATE_OVERRIDE){ ms_message("Payload type [%s/%i] has explicit bitrate [%i] kbit/s", pt->mime_type, pt->clock_rate, pt->normal_bitrate/1000); pt->normal_bitrate=get_min_bandwidth(pt->normal_bitrate,bw*1000); @@ -3798,7 +3800,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, LinphoneCallState nex if (linphone_core_get_remote_ringback_tone(lc)){ call->playing_ringbacktone = TRUE; } - LINPHONE_NO_BREAK; + BCTBX_NO_BREAK; case LinphoneCallOutgoingEarlyMedia: if (!call->params->real_early_media){ call->all_muted = TRUE; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 67a237e11..44e743ed6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include #include +#include #include "mediastreamer2/dtmfgen.h" #include "mediastreamer2/mediastream.h" #include "mediastreamer2/msequalizer.h" @@ -460,16 +461,16 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) { case ORTP_TRACE: case ORTP_DEBUG: mask |= ORTP_DEBUG; - LINPHONE_NO_BREAK; + BCTBX_NO_BREAK; case ORTP_MESSAGE: mask |= ORTP_MESSAGE; - LINPHONE_NO_BREAK; + BCTBX_NO_BREAK; case ORTP_WARNING: mask |= ORTP_WARNING; - LINPHONE_NO_BREAK; + BCTBX_NO_BREAK; case ORTP_ERROR: mask |= ORTP_ERROR; - LINPHONE_NO_BREAK; + BCTBX_NO_BREAK; case ORTP_FATAL: mask |= ORTP_FATAL; break; @@ -3487,7 +3488,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const bool_t defer = FALSE; LinphoneCallParams *cp; - if (!(!linphone_call_params_audio_enabled(params) || + if (!(!linphone_call_params_audio_enabled(params) || linphone_call_params_get_audio_direction(params) == LinphoneMediaDirectionInactive || linphone_call_params_get_local_conference_mode(params) == TRUE ) diff --git a/gtk/main.c b/gtk/main.c index b32b922c2..579fc8296 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "linphone/lpconfig.h" #include "liblinphone_gitversion.h" #include +#include #include #include @@ -303,7 +304,7 @@ static void linphone_gtk_init_liblinphone(const char *config_file, if (chat_messages_db_file) linphone_core_set_chat_database_path(the_core,chat_messages_db_file); if (call_logs_db_file) linphone_core_set_call_logs_database_path(the_core, call_logs_db_file); if (friends_db_file) linphone_core_set_friends_database_path(the_core, friends_db_file); - + // Disable the generic OpenGL displaying filter msfactory = linphone_core_get_ms_factory(the_core); ogl_filter_desc = ms_factory_lookup_filter_by_id(msfactory, MS_OGL_ID); @@ -1417,7 +1418,7 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call case LinphoneCallPausing: linphone_gtk_enable_hold_button(call,TRUE,FALSE); linphone_gtk_call_update_tab_header(call,FALSE); - LINPHONE_NO_BREAK; + BCTBX_NO_BREAK; case LinphoneCallPausedByRemote: linphone_gtk_in_call_view_set_paused(call); linphone_gtk_call_update_tab_header(call,TRUE); diff --git a/include/linphone/defs.h b/include/linphone/defs.h index c3b5c0a31..fc26222cb 100644 --- a/include/linphone/defs.h +++ b/include/linphone/defs.h @@ -48,15 +48,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define LINPHONE_DEPRECATED MS2_DEPRECATED #endif -/* Macro telling GCC that a 'break' statement has been deliberately omitted - * in switch block */ -#ifndef LINPHONE_NO_BREAK -#if defined(__GNUC__) && __GNUC__ >= 7 -#define LINPHONE_NO_BREAK __attribute__((fallthrough)) -#else -#define LINPHONE_NO_BREAK -#endif // __GNUC__ -#endif // LINPHONE_NO_BREAK - #endif /* LINPHONE_DEFS_H_ */ diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 416a5c74b..5725e1c44 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -25,6 +25,7 @@ #include "liblinphone_tester.h" #include "mediastreamer2/msutils.h" #include "belle-sip/sipstack.h" +#include #ifdef _WIN32 #define unlink _unlink @@ -395,8 +396,8 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallEncryptedOn,initial_callee.number_of_LinphoneCallEncryptedOn+1); /* when caller is encryptionNone but callee is ZRTP, we expect ZRTP to take place */ - if ((linphone_core_get_media_encryption(caller_mgr->lc) == LinphoneMediaEncryptionNone) - && (linphone_core_get_media_encryption(callee_mgr->lc) == LinphoneMediaEncryptionZRTP) + if ((linphone_core_get_media_encryption(caller_mgr->lc) == LinphoneMediaEncryptionNone) + && (linphone_core_get_media_encryption(callee_mgr->lc) == LinphoneMediaEncryptionZRTP) && linphone_core_media_encryption_supported(caller_mgr->lc, LinphoneMediaEncryptionZRTP)) { const LinphoneCallParams* call_param = linphone_call_get_current_params(callee_call); BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param), LinphoneMediaEncryptionZRTP, int, "%d"); @@ -1004,7 +1005,7 @@ static void terminate_call_with_error(void) { const LinphoneErrorInfo *rei ; LinphoneCoreManager *callee_mgr = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *caller_mgr = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - + LinphoneCall* out_call = linphone_core_invite_address(caller_mgr->lc,callee_mgr->identity); @@ -1015,20 +1016,20 @@ static void terminate_call_with_error(void) { BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallOutgoingInit,1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, 1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallOutgoingProgress, 1)); - + call_callee = linphone_core_get_current_call(callee_mgr->lc); BC_ASSERT_PTR_NOT_NULL(call_callee); - + BC_ASSERT_EQUAL( linphone_core_accept_call(callee_mgr->lc,call_callee), 0 , int, "%d"); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallConnected,1)); - + BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, 1)); - + rei = ei; - + linphone_call_terminate_with_error_info(out_call,rei); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallEnd,1)); @@ -1044,7 +1045,7 @@ static void terminate_call_with_error(void) { BC_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallEnd,1, int, "%d"); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallReleased,1)); - + linphone_error_info_unref(ei); linphone_call_unref(out_call); linphone_core_manager_destroy(callee_mgr); @@ -1212,24 +1213,24 @@ static void call_busy_when_calling_self(void) { static void call_declined_with_error(void) { LinphoneCoreManager* callee_mgr = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* caller_mgr = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - + LinphoneCall* in_call = NULL; LinphoneCall* out_call = linphone_core_invite_address(caller_mgr->lc,callee_mgr->identity); LinphoneFactory* factory = linphone_factory_get(); const LinphoneErrorInfo* rcvd_ei; const LinphoneErrorInfo* sub_rcvd_ei; - + LinphoneErrorInfo *ei = linphone_factory_create_error_info(factory); LinphoneErrorInfo *reason_ei = linphone_factory_create_error_info(factory); - + linphone_error_info_set(ei, "SIP", LinphoneReasonUnknown, 603, "Decline", NULL); //ordre des arguments à vérifier linphone_error_info_set(reason_ei, "hardware", LinphoneReasonUnknown, 66, "J'ai plus de batterie", NULL); linphone_error_info_set_sub_error_info(ei, reason_ei); - + BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallIncomingReceived,1)); BC_ASSERT_PTR_NOT_NULL(in_call=linphone_core_get_current_call(callee_mgr->lc)); - + linphone_call_ref(out_call); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallIncomingReceived,1)); BC_ASSERT_PTR_NOT_NULL(in_call=linphone_core_get_current_call(callee_mgr->lc)); @@ -1242,7 +1243,7 @@ static void call_declined_with_error(void) { rcvd_ei = linphone_call_get_error_info(out_call); sub_rcvd_ei = linphone_error_info_get_sub_error_info(rcvd_ei); - + BC_ASSERT_STRING_EQUAL(linphone_error_info_get_phrase(rcvd_ei), "Decline"); BC_ASSERT_STRING_EQUAL(linphone_error_info_get_protocol(rcvd_ei), "SIP"); BC_ASSERT_STRING_EQUAL(linphone_error_info_get_phrase(sub_rcvd_ei), "J'ai plus de batterie"); @@ -1252,8 +1253,8 @@ static void call_declined_with_error(void) { BC_ASSERT_EQUAL(linphone_call_log_get_status(linphone_call_get_call_log(in_call)),LinphoneCallDeclined, int, "%d"); BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonDeclined, int, "%d"); BC_ASSERT_EQUAL(linphone_call_log_get_status(linphone_call_get_call_log(out_call)),LinphoneCallDeclined, int, "%d"); - - + + BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallReleased,1)); BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallReleased,1)); linphone_call_unref(in_call); @@ -1345,7 +1346,7 @@ int check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *call BC_ASSERT_PTR_NOT_NULL(c1); BC_ASSERT_PTR_NOT_NULL(c2); if (!c1 || !c2) return FALSE; - + if (c1) { c1_ret = c1->nb_media_starts == caller_nb_media_starts; BC_ASSERT_EQUAL(c1->nb_media_starts, caller_nb_media_starts, unsigned int, "%u"); @@ -1476,7 +1477,7 @@ static void ice_added_by_reinvite(void){ lp_config_set_int(linphone_core_get_config(marie->lc), "net", "allow_late_ice", 1); lp_config_set_int(linphone_core_get_config(pauline->lc), "net", "allow_late_ice", 1); - + BC_ASSERT_TRUE((call_ok=call(pauline,marie))); if (!call_ok) goto end; liblinphone_tester_check_rtcp(marie,pauline); @@ -1538,7 +1539,7 @@ static void call_with_custom_headers(void) { linphone_call_params_add_custom_header(params,"Working","yes"); if (!BC_ASSERT_TRUE(call_with_caller_params(pauline,marie,params))) goto end; - + call_marie=linphone_core_get_current_call(marie->lc); call_pauline=linphone_core_get_current_call(pauline->lc); @@ -1575,7 +1576,7 @@ static void call_with_custom_headers(void) { ms_free(marie_remote_contact_header); end_call(pauline, marie); - + end: linphone_call_params_unref(params); linphone_core_manager_destroy(marie); @@ -1656,7 +1657,7 @@ static void call_with_custom_sdp_attributes(void) { static void call_with_custom_header_or_sdp_cb(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message) { - + const char *value; if (cstate == LinphoneCallOutgoingInit){ @@ -1697,7 +1698,7 @@ static void call_caller_with_custom_header_or_sdp_attributes(void) { LinphoneCallParams *caller_params; // *callee_params ; LinphoneCoreVTable *vtable; - + LinphoneCallTestParams caller_test_params = {0}; LinphoneCallTestParams callee_test_params = {0}; @@ -1705,7 +1706,7 @@ static void call_caller_with_custom_header_or_sdp_attributes(void) { stats initial_callee=callee_mgr->stat; bool_t result=FALSE; bool_t did_receive_call; - + //Create caller params with custom header and custom SDP caller_params = linphone_core_create_call_params(caller_mgr->lc, NULL); linphone_call_params_add_custom_header(caller_params, "weather", "thunderstorm"); @@ -1713,24 +1714,24 @@ static void call_caller_with_custom_header_or_sdp_attributes(void) { caller_test_params.base = (LinphoneCallParams*)caller_params; callee_test_params.base = NULL; - + /* TODO: This should be handled correctly inside the liblinphone library but meanwhile handle this here. */ linphone_core_manager_wait_for_stun_resolution(caller_mgr); linphone_core_manager_wait_for_stun_resolution(callee_mgr); - + setup_sdp_handling(&caller_test_params, caller_mgr); setup_sdp_handling(&callee_test_params, callee_mgr); - + // Assign dedicated callback to vtable for caller and callee vtable = linphone_core_v_table_new(); vtable->call_state_changed = call_with_custom_header_or_sdp_cb; linphone_core_add_listener(callee_mgr->lc, vtable); linphone_core_add_listener(caller_mgr->lc, vtable); - + //Caller initates the call with INVITE // caller params not null BC_ASSERT_PTR_NOT_NULL((call_caller=linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params))); - + BC_ASSERT_PTR_NULL(linphone_call_get_remote_params(call_caller)); /*assert that remote params are NULL when no response is received yet*/ // Wait for Incoming received @@ -1739,29 +1740,29 @@ static void call_caller_with_custom_header_or_sdp_attributes(void) { ,&callee_mgr->stat.number_of_LinphoneCallIncomingReceived ,initial_callee.number_of_LinphoneCallIncomingReceived+1); BC_ASSERT_EQUAL(did_receive_call, !callee_test_params.sdp_simulate_error, int, "%d"); - + linphone_call_params_unref(caller_params); - + sal_default_set_sdp_handling(caller_mgr->lc->sal, SalOpSDPNormal); sal_default_set_sdp_handling(callee_mgr->lc->sal, SalOpSDPNormal); - + // Wait for Outgoing Progress if (linphone_core_get_calls_nb(callee_mgr->lc)<=1) BC_ASSERT_TRUE(linphone_core_inc_invite_pending(callee_mgr->lc)); BC_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress,initial_caller.number_of_LinphoneCallOutgoingProgress+1, int, "%d"); - + LinphoneCallParams *default_params=linphone_core_create_call_params(callee_mgr->lc,call_callee); ms_message("Created default call params with video=%i", linphone_call_params_video_enabled(default_params)); linphone_core_accept_call_with_params(callee_mgr->lc,call_callee,default_params); linphone_call_params_unref(default_params); - + BC_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1)); BC_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallConnected,initial_caller.number_of_LinphoneCallConnected+1)); - + result = wait_for_until(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_caller.number_of_LinphoneCallStreamsRunning+1, 2000) && wait_for_until(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_callee.number_of_LinphoneCallStreamsRunning+1, 2000); @@ -1775,9 +1776,9 @@ static void call_caller_with_custom_header_or_sdp_attributes(void) { linphone_core_update_call(caller_mgr->lc, call_caller, caller_params); linphone_call_params_unref(caller_params); - + end_call(caller_mgr, callee_mgr); - + linphone_core_manager_destroy(callee_mgr); linphone_core_manager_destroy(caller_mgr); } @@ -1786,17 +1787,17 @@ static void call_caller_with_custom_header_or_sdp_attributes(void) { static void call_callee_with_custom_header_or_sdp_cb(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message) { - - + + const char *value; if (cstate == LinphoneCallOutgoingInit){ LinphoneCallParams *params = linphone_call_params_copy(linphone_call_get_params(call)); linphone_call_params_add_custom_sdp_attribute(params, "working", "maybe"); linphone_call_set_params(call, params); linphone_call_params_unref(params); - + } - + else if (cstate == LinphoneCallIncomingReceived){ const LinphoneCallParams *tparams = linphone_call_get_remote_params(call); LinphoneCallParams *params = linphone_call_params_copy(tparams); @@ -1805,7 +1806,7 @@ static void call_callee_with_custom_header_or_sdp_cb(LinphoneCore *lc, LinphoneC if (value) BC_ASSERT_STRING_EQUAL(value, "maybe"); linphone_call_set_params(call, params); linphone_call_params_unref(params); - + } } @@ -1817,60 +1818,60 @@ static void call_callee_with_custom_header_or_sdp_attributes(void) { LinphoneCoreManager *caller_mgr = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); LinphoneCall *call_caller = NULL, *call_callee = NULL; LinphoneCallParams *callee_params, *caller_params ; - + LinphoneCoreVTable *vtable; const char *value; LinphoneCallTestParams caller_test_params = {0}; LinphoneCallTestParams callee_test_params = {0}; - + stats initial_caller=caller_mgr->stat; stats initial_callee=callee_mgr->stat; bool_t did_receive_call; const LinphoneCallParams *caller_remote_params; - + caller_params = linphone_core_create_call_params(caller_mgr->lc, NULL); - + callee_test_params.base = NULL; caller_test_params.base = NULL; - + /* TODO: This should be handled correctly inside the liblinphone library but meanwhile handle this here. */ linphone_core_manager_wait_for_stun_resolution(caller_mgr); linphone_core_manager_wait_for_stun_resolution(callee_mgr); - + setup_sdp_handling(&caller_test_params, caller_mgr); setup_sdp_handling(&callee_test_params, callee_mgr); - + // Assign dedicated callback to vtable for caller and callee vtable = linphone_core_v_table_new(); vtable->call_state_changed = call_callee_with_custom_header_or_sdp_cb; linphone_core_add_listener(callee_mgr->lc, vtable); linphone_core_add_listener(caller_mgr->lc, vtable); - + //Caller initates the call with INVITE // caller params not null BC_ASSERT_PTR_NOT_NULL((call_caller=linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params))); - + BC_ASSERT_PTR_NULL(linphone_call_get_remote_params(call_caller)); /*assert that remote params are NULL when no response is received yet*/ - + // Wait for Incoming received did_receive_call = wait_for(callee_mgr->lc ,caller_mgr->lc ,&callee_mgr->stat.number_of_LinphoneCallIncomingReceived ,initial_callee.number_of_LinphoneCallIncomingReceived+1); BC_ASSERT_EQUAL(did_receive_call, !callee_test_params.sdp_simulate_error, int, "%d"); - - - + + + sal_default_set_sdp_handling(caller_mgr->lc->sal, SalOpSDPNormal); sal_default_set_sdp_handling(callee_mgr->lc->sal, SalOpSDPNormal); - + // Wait for Outgoing Progress if (linphone_core_get_calls_nb(callee_mgr->lc)<=1) BC_ASSERT_TRUE(linphone_core_inc_invite_pending(callee_mgr->lc)); BC_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress,initial_caller.number_of_LinphoneCallOutgoingProgress+1, int, "%d"); - - + + //Create callee params with custom header and custom SDP @@ -1881,17 +1882,17 @@ static void call_callee_with_custom_header_or_sdp_attributes(void) { ms_message("Created default call params with video=%i", linphone_call_params_video_enabled(callee_params)); linphone_core_accept_call_with_params(callee_mgr->lc,call_callee,callee_params); linphone_call_params_unref(callee_params); - - + + BC_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallConnected,initial_callee.number_of_LinphoneCallConnected+1)); BC_ASSERT_TRUE(wait_for(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallConnected,initial_caller.number_of_LinphoneCallConnected+1)); - + result = wait_for_until(callee_mgr->lc,caller_mgr->lc,&caller_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_caller.number_of_LinphoneCallStreamsRunning+1, 2000) && wait_for_until(callee_mgr->lc,caller_mgr->lc,&callee_mgr->stat.number_of_LinphoneCallStreamsRunning,initial_callee.number_of_LinphoneCallStreamsRunning+1, 2000); - + BC_ASSERT_TRUE(result); - + caller_remote_params = linphone_call_get_remote_params(call_caller); value = linphone_call_params_get_custom_sdp_attribute(caller_remote_params, "working"); BC_ASSERT_PTR_NOT_NULL(value); @@ -1903,7 +1904,7 @@ static void call_callee_with_custom_header_or_sdp_attributes(void) { linphone_call_params_unref(caller_params); end_call(caller_mgr, callee_mgr); - + linphone_core_manager_destroy(callee_mgr); linphone_core_manager_destroy(caller_mgr); } @@ -2220,9 +2221,9 @@ static void audio_call_with_ice_no_matching_audio_codecs(void) { BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallError, 1, 6000)); BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d"); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d"); - + logs = linphone_core_get_call_logs(pauline->lc); - + BC_ASSERT_EQUAL(bctbx_list_size(logs), 1, int, "%d"); if (logs){ const LinphoneErrorInfo *ei; @@ -2642,9 +2643,9 @@ static void _call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enab } linphone_core_set_video_device(pauline->lc,liblinphone_tester_mire_id); linphone_core_set_video_device(marie->lc,liblinphone_tester_mire_id); - + if (plays_nothing){ - /*This case was for trying to replicate an issue because + /*This case was for trying to replicate an issue because * zrtp_iterate() was only called when packets are received, which * creates a big problem because no retransmission of HELLO packet will occur * if the remote sends nothing. @@ -2886,7 +2887,7 @@ static void early_media_call_with_ringing_base(bool_t network_change){ BC_ASSERT_TRUE(marie_call->all_muted); liblinphone_tester_check_rtcp(marie, pauline); - + /* this is a hack to simulate an incoming OK with a different IP address * in the 'c' SDP field. */ if (network_change) { @@ -3335,7 +3336,7 @@ static void call_rejected_because_wrong_credentials_with_params(const char* user ((VTableReference*)(marie->lc->vtable_refs->data))->cbs->vtable->auth_info_requested=NULL; linphone_core_add_auth_info(marie->lc,wrong_auth_info); } - + BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(marie->lc,marie->identity)); @@ -3399,6 +3400,7 @@ void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, bctbx_l break; case LinphoneMediaDirectionRecvOnly: BC_ASSERT_LOWER((int)stats->upload_bandwidth, 5, int, "%i"); + BCTBX_NO_BREAK; /*intentionally no break*/ case LinphoneMediaDirectionSendRecv: expected_recv_iframe = 1; break; @@ -3704,7 +3706,7 @@ static void incoming_invite_with_invalid_sdp(void) { BC_ASSERT_EQUAL(caller->stat.number_of_LinphoneCallError,1, int, "%d"); /*call will be drop before presented to the application, because it is invalid*/ BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d"); - + logs = linphone_core_get_call_logs(callee->lc); BC_ASSERT_EQUAL(bctbx_list_size(logs), 1, int, "%i"); if (logs){ @@ -3810,7 +3812,7 @@ void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ice ){ lcs = bctbx_list_append(lcs,pauline->lc); if (use_ice){ linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); - /* We need RTP symmetric because ICE will put the STUN address in the C line, and no relay is made in this + /* We need RTP symmetric because ICE will put the STUN address in the C line, and no relay is made in this * scenario.*/ lp_config_set_int(linphone_core_get_config(pauline->lc), "rtp", "symmetric", 1); } @@ -4663,7 +4665,7 @@ static void call_record_with_custom_rtp_modifier(void) { static void recovered_call_on_network_switch_in_early_state(LinphoneCoreManager* callerMgr) { const LinphoneCallParams *remote_params; LinphoneCall *incoming_call; - + LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); linphone_core_invite_address(callerMgr->lc, pauline->identity); @@ -4692,7 +4694,7 @@ static void recovered_call_on_network_switch_in_early_state(LinphoneCoreManager* BC_ASSERT_TRUE(wait_for(callerMgr->lc, pauline->lc, &callerMgr->stat.number_of_LinphoneCallReleased, 1)); BC_ASSERT_TRUE(wait_for(callerMgr->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1)); end: - + linphone_core_manager_destroy(pauline); } static void recovered_call_on_network_switch_in_early_state_1(void) { @@ -5124,7 +5126,7 @@ static void call_with_network_switch_no_recovery(void){ lcs = bctbx_list_append(lcs, marie->lc); lcs = bctbx_list_append(lcs, pauline->lc); - + linphone_core_set_nortp_timeout(marie->lc, 50000); BC_ASSERT_TRUE((call_ok=call_with_params(pauline, marie, pauline_params, NULL))); @@ -5140,14 +5142,14 @@ static void call_with_network_switch_no_recovery(void){ * We have to wait 32 seconds so that the BYE transaction is terminated, and dialog removed. * This is the condition to receive a 481 when marie sends the reINVITE.*/ wait_for_list(lcs, NULL, 0, 32500); - + /*marie will reconnect, register, and send an automatic reINVITE to try to repair the call*/ linphone_core_set_network_reachable(marie->lc, TRUE); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 2)); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); /*This reINVITE should of course fail, so marie's call should be terminated.*/ BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); - + end: if (pauline_params) { linphone_call_params_unref(pauline_params); @@ -5691,18 +5693,18 @@ static void call_with_encryption_mandatory(bool_t caller_has_encryption_mandator LinphoneCallStats *marie_stats, *pauline_stats; /*marie doesn't support ZRTP at all*/ marie->lc->zrtp_not_available_simulation=1; - + /*pauline requests encryption to be mandatory*/ linphone_core_set_media_encryption(pauline->lc, LinphoneMediaEncryptionZRTP); linphone_core_set_media_encryption_mandatory(pauline->lc, TRUE); - + if (!caller_has_encryption_mandatory){ if (!BC_ASSERT_TRUE(quick_call(marie, pauline))) goto end; }else{ if (!BC_ASSERT_TRUE(quick_call(pauline, marie))) goto end; } wait_for_until(pauline->lc, marie->lc, NULL, 0, 2000); - + /*assert that no RTP packets have been sent or received by Pauline*/ /*testing packet_sent doesn't work, because packets dropped by the transport layer are counted as if they were sent.*/ #if 0 @@ -5734,11 +5736,11 @@ static void v6_to_v4_call_without_relay(void){ LinphoneCoreManager* marie; LinphoneCoreManager* pauline; bctbx_list_t *lcs = NULL; - + if (liblinphone_tester_ipv4_available() && liblinphone_tester_ipv6_available()){ marie = linphone_core_manager_new("marie_rc"); pauline = linphone_core_manager_new2("pauline_tcp_rc", FALSE); - + lcs = bctbx_list_append(lcs, marie->lc); lcs = bctbx_list_append(lcs, pauline->lc); linphone_core_enable_ipv6(pauline->lc, FALSE); @@ -5756,7 +5758,7 @@ static void v6_to_v4_call_without_relay(void){ linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); bctbx_list_free(lcs); - + }else ms_warning("Test skipped, dual stack not available"); } @@ -5854,17 +5856,17 @@ static void call_with_network_reachable_down_in_callback(void){ LinphoneCoreManager* marie; LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get()); LinphoneCall *call; - + linphone_core_cbs_set_call_state_changed(cbs, my_call_state_changed_cb); - + marie = linphone_core_manager_new("laure_rc_udp"); - + linphone_core_add_callbacks(marie->lc, cbs); - + call = linphone_core_invite(marie->lc, "inexistant_username_xbfuuuf"); BC_ASSERT_PTR_NOT_NULL(call); BC_ASSERT_TRUE(wait_for(marie->lc, NULL, &marie->stat.number_of_LinphoneCallError, 1)); - + linphone_core_cbs_unref(cbs); linphone_core_manager_destroy(marie); }