diff --git a/console/commands.c b/console/commands.c index cf462b990..6f527831e 100644 --- a/console/commands.c +++ b/console/commands.c @@ -414,7 +414,8 @@ linphonec_parse_command_line(LinphoneCore *lc, char *cl) { while ( isdigit(*cl) || *cl == '#' || *cl == '*' ) { - linphone_core_send_dtmf(lc, *cl); + if (linphone_core_get_current_call(lc)) + linphone_call_send_dtmf(linphone_core_get_current_call(lc), *cl); linphone_core_play_dtmf (lc,*cl,100); ms_sleep(1); // be nice ++cl; @@ -2336,12 +2337,12 @@ static int lpc_cmd_echolimiter(LinphoneCore *lc, char *args){ static int lpc_cmd_mute_mic(LinphoneCore *lc, char *args) { - linphone_core_mute_mic(lc, 1); + linphone_core_enable_mic(lc, 0); return 1; } static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){ - linphone_core_mute_mic(lc, 0); + linphone_core_enable_mic(lc, 1); return 1; } diff --git a/console/linphonec.c b/console/linphonec.c index 709940269..ee7b76617 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -102,7 +102,7 @@ static int linphonec_main_loop (LinphoneCore * opm); static int linphonec_idle_call (void); #ifdef HAVE_READLINE static int linphonec_initialize_readline(void); -static int linphonec_finish_readline(); +static int linphonec_finish_readline(void); static char **linephonec_readline_completion(const char *text, int start, int end); #endif diff --git a/coreapi/bellesip_sal/sal_op_events.c b/coreapi/bellesip_sal/sal_op_events.c index 631e23b36..802e5d334 100644 --- a/coreapi/bellesip_sal/sal_op_events.c +++ b/coreapi/bellesip_sal/sal_op_events.c @@ -61,10 +61,20 @@ static void subscribe_process_io_error(void *user_ctx, const belle_sip_io_error_ } static void subscribe_process_dialog_terminated(void *ctx, const belle_sip_dialog_terminated_event_t *event) { + belle_sip_dialog_t *dialog = belle_sip_dialog_terminated_event_get_dialog(event); SalOp* op= (SalOp*)ctx; if (op->dialog) { op->dialog=NULL; + if (!belle_sip_dialog_is_server(dialog) && belle_sip_dialog_terminated_event_is_expired(event)){ + /*notify the app that our subscription is dead*/ + const char *eventname = NULL; + if (op->event){ + eventname = belle_sip_header_get_unparsed_value(op->event); + } + op->base.root->callbacks.notify(op, SalSubscribeTerminated, eventname, NULL); + } sal_op_unref(op); + } } @@ -198,7 +208,6 @@ int sal_subscribe(SalOp *op, const char *from, const char *to, const char *event if (!op->dialog){ sal_op_subscribe_fill_cbs(op); - /*???sal_exosip_fix_route(op); make sure to ha ;lr*/ req=sal_op_build_request(op,"SUBSCRIBE"); if( req == NULL ) { return -1; diff --git a/coreapi/bellesip_sal/sal_op_presence.c b/coreapi/bellesip_sal/sal_op_presence.c index f5ec79ad8..dab484b1a 100644 --- a/coreapi/bellesip_sal/sal_op_presence.c +++ b/coreapi/bellesip_sal/sal_op_presence.c @@ -58,8 +58,17 @@ static void presence_process_dialog_terminated(void *ctx, const belle_sip_dialog if (!op->op_released){ op->base.root->callbacks.subscribe_presence_closed(op, sal_op_get_from(op)); } + set_or_update_dialog(op, NULL); + }else{ + if (belle_sip_dialog_terminated_event_is_expired(event)){ + ms_warning("Outgoing presence subscription expired."); + if (op->refresher){ + /*send a new SUBSCRIBE, that will attempt to establish a new dialog*/ + sal_subscribe_presence(op,NULL,NULL,-1); + } + } } - set_or_update_dialog(op, NULL); + } } diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 1694c7e4f..6811d4c08 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -503,10 +503,7 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o if (call->params->internal_call_update) call->params->internal_call_update = FALSE; - /* Handle remote ICE attributes if any. */ - if (call->ice_session != NULL && rmd) { - linphone_call_update_ice_from_remote_media_description(call, rmd); - } + #ifdef BUILD_UPNP if (call->upnp_session != NULL && rmd) { linphone_core_update_upnp_from_remote_media_description(call, rmd); @@ -522,6 +519,12 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o md = NULL; } if (md){ /*there is a valid SDP in the response, either offer or answer, and we're able to start/update the streams*/ + + /* Handle remote ICE attributes if any. */ + if (call->ice_session != NULL && rmd) { + linphone_call_update_ice_from_remote_media_description(call, rmd, FALSE); + } + switch (call->state){ case LinphoneCallResuming: linphone_core_notify_display_status(lc,_("Call resumed.")); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2869a00a4..a8a9e5bdf 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -932,6 +932,7 @@ static void port_config_set(LinphoneCall *call, int stream_index, int min_port, static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){ int min_port, max_port; ms_message("New LinphoneCall [%p] initialized (LinphoneCore version: %s)",call,linphone_core_get_version()); + call->core->send_call_stats_periodical_updates = lp_config_get_int(call->core->config, "misc", "send_call_stats_periodical_updates", 0); call->main_audio_stream_index = LINPHONE_CALL_STATS_AUDIO; call->main_video_stream_index = LINPHONE_CALL_STATS_VIDEO; call->main_text_stream_index = LINPHONE_CALL_STATS_TEXT; @@ -2236,7 +2237,7 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){ if (call->params->realtimetext_enabled) _linphone_call_prepare_ice_for_stream(call,call->main_text_stream_index,TRUE); /*start ICE gathering*/ if (incoming_offer) - linphone_call_update_ice_from_remote_media_description(call,remote); /*this may delete the ice session*/ + linphone_call_update_ice_from_remote_media_description(call, remote, TRUE); /*this may delete the ice session*/ if (call->ice_session && !ice_session_candidates_gathered(call->ice_session)){ if (call->audiostream->ms.state==MSStreamInitialized) audio_stream_prepare_sound(call->audiostream, NULL, NULL); @@ -4169,20 +4170,22 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_download_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_down_bw(ts)*1e-3) : 0.f; call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_upload_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_up_bw(ts)*1e-3) : 0.f; - call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; - if (as) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); + if (call->core->send_call_stats_periodical_updates){ + call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; + if (as_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; - if (vs) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; + if (vs_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); - call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); - call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; - if (ts) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); + call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); + call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; + if (ts_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); + } ms_message( "Bandwidth usage for call [%p]:\n" @@ -4313,8 +4316,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_update_ice_state_in_call_stats(call); } } else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) { - ice_session_restart(call->ice_session); - ice_session_set_role(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); linphone_core_update_call(call->core, call, call->current_params); } } @@ -4373,6 +4375,28 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){ } } +static MediaStream * linphone_call_get_media_stream(LinphoneCall *call, int stream_index){ + if (stream_index == call->main_audio_stream_index) + return (MediaStream*)call->audiostream; + if (stream_index == call->main_video_stream_index) + return (MediaStream*)call->videostream; + if (stream_index == call->main_text_stream_index) + return (MediaStream*)call->textstream; + ms_error("linphone_call_get_media_stream(): no stream index %i", stream_index); + return NULL; +} + +static OrtpEvQueue *linphone_call_get_event_queue(LinphoneCall *call, int stream_index){ + if (stream_index == call->main_audio_stream_index) + return call->audiostream_app_evq; + if (stream_index == call->main_video_stream_index) + return call->videostream_app_evq; + if (stream_index == call->main_text_stream_index) + return call->textstream_app_evq; + ms_error("linphone_call_get_event_queue(): no stream index %i", stream_index); + return NULL; +} + void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ MediaStream *ms = stream_index == call->main_audio_stream_index ? (MediaStream *)call->audiostream : (stream_index == call->main_video_stream_index ? (MediaStream *)call->videostream : (MediaStream *)call->textstream); OrtpEvQueue *evq; @@ -4401,11 +4425,15 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ } } /*yes the event queue has to be taken at each iteration, because ice events may perform operations re-creating the streams*/ - while ((evq = stream_index == call->main_audio_stream_index ? call->audiostream_app_evq : (stream_index == call->main_video_stream_index ? call->videostream_app_evq : call->textstream_app_evq)) && (NULL != (ev=ortp_ev_queue_get(evq)))){ + while((evq = linphone_call_get_event_queue(call, stream_index)) != NULL && NULL != (ev=ortp_ev_queue_get(evq))){ OrtpEventType evt=ortp_event_get_type(ev); OrtpEventData *evd=ortp_event_get_data(ev); - int stats_index = stream_index == call->main_audio_stream_index ? LINPHONE_CALL_STATS_AUDIO : (stream_index == call->main_video_stream_index ? LINPHONE_CALL_STATS_VIDEO : LINPHONE_CALL_STATS_TEXT); + + /*and yes the MediaStream must be taken at each iteration, because it may have changed due to the handling of events + * in this loop*/ + ms = linphone_call_get_media_stream(call, stream_index); + if (ms) linphone_call_stats_fill(&call->stats[stats_index],ms,ev); linphone_call_notify_stats_updated(call,stats_index); @@ -4790,8 +4818,10 @@ MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index) return MSVideo; } else if (stream_index == call->main_text_stream_index) { return MSText; + } else if (stream_index == call->main_audio_stream_index){ + return MSAudio; } - return MSAudio; + return MSUnknownMedia; } RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index) { @@ -4850,6 +4880,7 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ /*First, make sure that the proxy from which we received this call, or to which we routed this call is registered*/ if (!call->dest_proxy || linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return; + if (!call->core->media_network_reachable) return; switch (call->state){ case LinphoneCallStreamsRunning: @@ -4857,8 +4888,7 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ case LinphoneCallPausedByRemote: ms_message("LinphoneCall[%p] is going to be updated (reINVITE) in order to recover from lost connectivity", call); if (call->ice_session){ - ice_session_restart(call->ice_session); - ice_session_set_role(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); } params = linphone_core_create_call_params(call->core, call); linphone_core_update_call(call->core, call, params); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 55361ead9..3a76389bb 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7080,7 +7080,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para params->realtimetext_enabled = linphone_core_realtime_text_enabled(lc); params->privacy=LinphonePrivacyDefault; params->avpf_enabled=linphone_core_get_avpf_mode(lc); - params->implicit_rtcp_fb = lp_config_get_int(lc->config,"rtp","rtcp_fb_implicit_rtcp_fb",TRUE); + params->implicit_rtcp_fb = lp_config_get_int(lc->config,"rtp","rtcp_fb_implicit_rtcp_fb",TRUE); params->audio_dir=LinphoneMediaDirectionSendRecv; params->video_dir=LinphoneMediaDirectionSendRecv; params->real_early_media=lp_config_get_int(lc->config,"misc","real_early_media",FALSE); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d0d6fa2bd..31aee17a5 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1252,7 +1252,7 @@ typedef enum _LinphoneChatMessageState { * @param ud application user data * @deprecated */ -typedef LINPHONE_DEPRECATED void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); +typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); /** * Call back used to notify message delivery status diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index a952908ac..94911a48d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -944,8 +944,11 @@ public: callobj = getCall(env, call); if (stats->type == LINPHONE_CALL_STATS_AUDIO) env->CallVoidMethod(callobj, ljb->callSetAudioStatsId, statsobj); - else + else if (stats->type == LINPHONE_CALL_STATS_VIDEO){ env->CallVoidMethod(callobj, ljb->callSetVideoStatsId, statsobj); + }else{ + //text stats not updated yet. + } env->CallVoidMethod(lcData->listener, ljb->callStatsUpdatedId, lcData->core, callobj, statsobj); handle_possible_java_exception(env, lcData->listener); if (statsobj) env->DeleteLocalRef(statsobj); diff --git a/coreapi/misc.c b/coreapi/misc.c index 4f4e7fd82..996d3d867 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -945,8 +945,7 @@ void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMedi } } -void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) -{ +void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer){ const SalStreamDescription *stream; IceCheckList *cl = NULL; bool_t default_candidate = FALSE; @@ -976,14 +975,14 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, if (ice_params_found) { /* Check for ICE restart and set remote credentials. */ if ((strcmp(md->addr, "0.0.0.0") == 0) || (strcmp(md->addr, "::0") == 0)) { - ice_session_restart(call->ice_session); + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; } else { for (i = 0; i < md->nb_streams; i++) { stream = &md->streams[i]; cl = ice_session_check_list(call->ice_session, i); if (cl && (strcmp(stream->rtp_addr, "0.0.0.0") == 0)) { - ice_session_restart(call->ice_session); + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; break; } @@ -993,7 +992,7 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); } else if (ice_session_remote_credentials_changed(call->ice_session, md->ice_ufrag, md->ice_pwd)) { if (ice_restarted == FALSE) { - ice_session_restart(call->ice_session); + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; } ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); @@ -1006,8 +1005,8 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, if (ice_restarted == FALSE && ice_check_list_get_remote_ufrag(cl) && ice_check_list_get_remote_pwd(cl)) { - /* restart onlu if remote ufrag/paswd was already set*/ - ice_session_restart(call->ice_session); + /* restart only if remote ufrag/paswd was already set*/ + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; } ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); diff --git a/coreapi/private.h b/coreapi/private.h index 5ad4da91c..94aa96ac1 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -152,16 +152,17 @@ struct _LinphoneCallParams{ bool_t has_audio; bool_t has_video; bool_t avpf_enabled; /* RTCP feedback messages are enabled */ - bool_t implicit_rtcp_fb; + bool_t implicit_rtcp_fb; + bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/ bool_t in_conference; /*in conference mode */ - bool_t low_bandwidth; bool_t no_user_consent;/*when set to TRUE an UPDATE request will be used instead of reINVITE*/ + uint16_t avpf_rr_interval; /*in milliseconds*/ - bool_t internal_call_update; /*use mark that call update was requested internally (might be by ice) - unused for the moment*/ bool_t video_multicast_enabled; + bool_t audio_multicast_enabled; bool_t realtimetext_enabled; bool_t update_call_when_ice_completed; @@ -487,7 +488,7 @@ void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEve void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result); void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy); void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call); -void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); +void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer); void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md); bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md); @@ -931,7 +932,8 @@ struct _LinphoneCore bool_t ringstream_autorelease; bool_t vtables_running; - bool_t pad[3]; + bool_t send_call_stats_periodical_updates; + bool_t pad[2]; char localip[LINPHONE_IPADDR_SIZE]; int device_rotation; int max_calls; diff --git a/coreapi/upnp.c b/coreapi/upnp.c index ef8b544aa..b41b8292c 100644 --- a/coreapi/upnp.c +++ b/coreapi/upnp.c @@ -89,7 +89,7 @@ bool_t linphone_core_upnp_hook(void *data); void linphone_upnp_update(UpnpContext *ctx); bool_t linphone_upnp_is_blacklisted(UpnpContext *ctx); -UpnpPortBinding *linphone_upnp_port_binding_new(); +UpnpPortBinding *linphone_upnp_port_binding_new(void); UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_protocol protocol, int local_port, int external_port); UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port); UpnpPortBinding *linphone_upnp_port_binding_copy(const UpnpPortBinding *port); @@ -1089,7 +1089,7 @@ int linphone_core_update_local_media_description_from_upnp(SalMediaDescription * * uPnP Port Binding */ -UpnpPortBinding *linphone_upnp_port_binding_new() { +UpnpPortBinding *linphone_upnp_port_binding_new(void) { UpnpPortBinding *port = NULL; port = ms_new0(UpnpPortBinding,1); ms_mutex_init(&port->mutex, NULL); @@ -1221,7 +1221,7 @@ void linphone_upnp_port_binding_release(UpnpPortBinding *port) { * uPnP Stream */ -UpnpStream* linphone_upnp_stream_new() { +UpnpStream* linphone_upnp_stream_new(void) { UpnpStream *stream = ms_new0(UpnpStream,1); stream->state = LinphoneUpnpStateIdle; stream->rtp = NULL; diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index cacb65dee..ff819df51 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -89,6 +89,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") target_compile_options(linphone_tester_runtime PRIVATE "/wd4996") target_link_libraries(linphone_tester_runtime linphone_tester_static) set_target_properties(linphone_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE) + set_target_properties(linphone_tester_runtime PROPERTIES LIBRARY_OUTPUT_NAME "BelledonneCommunications.Linphone.Tester") + set_target_properties(linphone_tester_runtime PROPERTIES LINK_FLAGS "/WINMDFILE:BelledonneCommunications.Linphone.Tester.winmd") install(TARGETS linphone_tester_runtime RUNTIME DESTINATION bin @@ -96,7 +98,13 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") ARCHIVE DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/linphone_tester_runtime.winmd" DESTINATION bin) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BelledonneCommunications.Linphone.Tester.winmd" DESTINATION lib) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/BelledonneCommunications.Linphone.Tester.pdb + DESTINATION lib + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + endif() else() add_executable(liblinphone_tester ${SOURCE_FILES}) set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX) diff --git a/tester/call_tester.c b/tester/call_tester.c index 9daeed75c..e86a37bf7 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -43,6 +43,7 @@ extern void libmsopenh264_init(void); #endif #endif + void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){ 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); @@ -96,9 +97,6 @@ void call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCall int tab_size = sizeof (counters->audio_download_bandwidth)/sizeof(int); int index = (counters->current_bandwidth_index++) % tab_size; - counters->current_audio_download_bandwidth = counters->audio_download_bandwidth + index; - counters->current_audio_upload_bandwidth = counters->audio_upload_bandwidth +index; - counters->audio_download_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->download_bandwidth; counters->audio_upload_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->upload_bandwidth; counters->video_download_bandwidth[index] = (int)linphone_call_get_video_stats(call)->download_bandwidth; @@ -532,7 +530,7 @@ static void call_outbound_with_multiple_proxy(void) { LinphoneProxyConfig* lpc = NULL; LinphoneProxyConfig* registered_lpc = linphone_core_create_proxy_config(marie->lc); - linphone_core_get_default_proxy(marie->lc, &lpc); + lpc = linphone_core_get_default_proxy_config(marie->lc); linphone_core_set_default_proxy(marie->lc,NULL); BC_ASSERT_FATAL(lpc != NULL); @@ -824,7 +822,7 @@ static void simple_call_compatibility_mode(void) { char*tmp; LCSipTransports transport; - linphone_core_get_default_proxy(lc_marie,&proxy); + proxy = linphone_core_get_default_proxy_config(lc_marie); BC_ASSERT_PTR_NOT_NULL (proxy); identity = linphone_proxy_config_get_identity_address(proxy); @@ -1466,7 +1464,8 @@ static void call_paused_resumed_with_video_base(bool_t sdp_200_ack vpol.automatically_initiate = TRUE; /* needed to present a video mline*/ linphone_core_set_video_policy(marie->lc, &vpol); - linphone_core_enable_video(marie->lc, TRUE, TRUE); + linphone_core_enable_video_capture(marie->lc, TRUE); + linphone_core_enable_video_display(marie->lc, TRUE); vpol.automatically_accept = FALSE; vpol.automatically_initiate = TRUE; @@ -2696,7 +2695,7 @@ static void call_with_privacy(void) { end_call(pauline, marie); /*test proxy config privacy*/ - linphone_core_get_default_proxy(pauline->lc,&pauline_proxy); + pauline_proxy = linphone_core_get_default_proxy_config(pauline->lc); linphone_proxy_config_set_privacy(pauline_proxy,LinphonePrivacyId); BC_ASSERT_TRUE(call(pauline,marie)); @@ -2730,7 +2729,7 @@ static void call_with_privacy2(void) { params=linphone_core_create_call_params(pauline->lc, NULL); linphone_call_params_set_privacy(params,LinphonePrivacyId); - linphone_core_get_default_proxy(pauline->lc,&pauline_proxy); + pauline_proxy = linphone_core_get_default_proxy_config(pauline->lc); linphone_proxy_config_edit(pauline_proxy); linphone_proxy_config_enable_register(pauline_proxy,FALSE); linphone_proxy_config_done(pauline_proxy); @@ -5475,7 +5474,6 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); MSList *lcs = NULL; - int ice_reinvite = use_ice ? 1 : 0; bool_t call_ok; lcs = ms_list_append(lcs, marie->lc); @@ -5509,11 +5507,22 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh linphone_core_set_network_reachable(marie->lc, TRUE); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 2)); - /*pauline shall receive a reINVITE to update the session*/ - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1+ice_reinvite)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1+ice_reinvite)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2+ice_reinvite)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2+ice_reinvite)); + if (use_ice){ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 3)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 3)); + /*now comes the ICE reINVITE*/ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 4)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 4)); + }else{ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); + } /*check that media is back*/ check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInvalid); @@ -5540,7 +5549,7 @@ static void call_with_network_switch_and_socket_refresh(void){ _call_with_network_switch(TRUE, TRUE); } -static void call_with_sip_and_rtp_independant_switches(){ +static void call_with_sip_and_rtp_independant_switches(void){ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); MSList *lcs = NULL; @@ -5574,24 +5583,35 @@ static void call_with_sip_and_rtp_independant_switches(){ } /*marie looses the SIP network and reconnects*/ linphone_core_set_sip_network_reachable(marie->lc, FALSE); + linphone_core_set_media_network_reachable(marie->lc, FALSE); wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); /*marie will reconnect and register*/ linphone_core_set_sip_network_reachable(marie->lc, TRUE); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 2)); - wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); + wait_for_until(marie->lc, pauline->lc, NULL, 0, 5000); /*at this stage, no reINVITE is expected to be send*/ - BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallUpdating, 1, int, "%i"); /*1: because of ICE reinvite*/ + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallUpdating, 0, int, "%i"); /*now we notify the a reconnection of media network*/ - linphone_core_set_media_network_reachable(marie->lc, FALSE); linphone_core_set_media_network_reachable(marie->lc, TRUE); - /*pauline shall receive a reINVITE to update the session*/ - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 2)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 2)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 3)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 3)); + if (use_ice){ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 3)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 3)); + /*now comes the ICE reINVITE*/ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 4)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 4)); + }else{ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); + } /*check that media is back*/ check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInvalid); diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index d16134b4e..ee1b2eec8 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -234,9 +234,7 @@ typedef struct _stats { int number_of_LinphoneCoreLogCollectionUploadStateNotDelivered; int number_of_LinphoneCoreLogCollectionUploadStateInProgress; int audio_download_bandwidth[3]; - int *current_audio_download_bandwidth; int audio_upload_bandwidth[3]; - int *current_audio_upload_bandwidth; int video_download_bandwidth[3]; int video_upload_bandwidth[3]; diff --git a/tester/liblinphone_tester_windows.cpp b/tester/liblinphone_tester_windows.cpp index 790f696c8..015af02d2 100644 --- a/tester/liblinphone_tester_windows.cpp +++ b/tester/liblinphone_tester_windows.cpp @@ -2,7 +2,7 @@ #include "liblinphone_tester_windows.h" -using namespace linphone_tester_runtime; +using namespace BelledonneCommunications::Linphone::Tester; using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Storage; @@ -14,7 +14,7 @@ using namespace Windows::System::Threading; static OutputTraceListener^ sTraceListener; -LibLinphoneTester^ LibLinphoneTester::_instance = ref new LibLinphoneTester(); +NativeTester^ NativeTester::_instance = ref new NativeTester(); static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args) { @@ -45,27 +45,27 @@ static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args) } } -static void libLinphoneNativeOutputTraceHandler(OrtpLogLevel lev, const char *fmt, va_list args) +static void libLinphoneNativeOutputTraceHandler(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args) { nativeOutputTraceHandler((int)lev, fmt, args); } -LibLinphoneTester::LibLinphoneTester() +NativeTester::NativeTester() { } -LibLinphoneTester::~LibLinphoneTester() +NativeTester::~NativeTester() { liblinphone_tester_uninit(); } -void LibLinphoneTester::setOutputTraceListener(OutputTraceListener^ traceListener) +void NativeTester::setOutputTraceListener(OutputTraceListener^ traceListener) { sTraceListener = traceListener; } -void LibLinphoneTester::initialize(StorageFolder^ writableDirectory, Platform::Boolean ui) +void NativeTester::initialize(StorageFolder^ writableDirectory, Platform::Boolean ui) { if (ui) { liblinphone_tester_init(nativeOutputTraceHandler); @@ -91,7 +91,7 @@ void LibLinphoneTester::initialize(StorageFolder^ writableDirectory, Platform::B } } -bool LibLinphoneTester::run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose) +bool NativeTester::run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose) { std::wstring all(L"ALL"); std::wstring wssuitename = suiteName->Data(); @@ -111,7 +111,7 @@ bool LibLinphoneTester::run(Platform::String^ suiteName, Platform::String^ caseN return bc_tester_run_tests(wssuitename == all ? 0 : csuitename, wscasename == all ? 0 : ccasename) != 0; } -void LibLinphoneTester::runAllToXml() +void NativeTester::runAllToXml() { auto workItem = ref new WorkItemHandler([this](IAsyncAction ^workItem) { bc_tester_start(NULL); @@ -120,12 +120,12 @@ void LibLinphoneTester::runAllToXml() _asyncAction = ThreadPool::RunAsync(workItem); } -unsigned int LibLinphoneTester::nbTestSuites() +unsigned int NativeTester::nbTestSuites() { return bc_tester_nb_suites(); } -unsigned int LibLinphoneTester::nbTests(Platform::String^ suiteName) +unsigned int NativeTester::nbTests(Platform::String^ suiteName) { std::wstring suitename = suiteName->Data(); char cname[MAX_SUITE_NAME_SIZE] = { 0 }; @@ -133,7 +133,7 @@ unsigned int LibLinphoneTester::nbTests(Platform::String^ suiteName) return bc_tester_nb_tests(cname); } -Platform::String^ LibLinphoneTester::testSuiteName(int index) +Platform::String^ NativeTester::testSuiteName(int index) { const char *cname = bc_tester_suite_name(index); wchar_t wcname[MAX_SUITE_NAME_SIZE]; @@ -141,7 +141,7 @@ Platform::String^ LibLinphoneTester::testSuiteName(int index) return ref new String(wcname); } -Platform::String^ LibLinphoneTester::testName(Platform::String^ suiteName, int testIndex) +Platform::String^ NativeTester::testName(Platform::String^ suiteName, int testIndex) { std::wstring suitename = suiteName->Data(); char csuitename[MAX_SUITE_NAME_SIZE] = { 0 }; diff --git a/tester/liblinphone_tester_windows.h b/tester/liblinphone_tester_windows.h index c7701143c..dec64cb48 100644 --- a/tester/liblinphone_tester_windows.h +++ b/tester/liblinphone_tester_windows.h @@ -3,39 +3,45 @@ #include "linphonecore.h" #include "liblinphone_tester.h" -namespace linphone_tester_runtime +namespace BelledonneCommunications { - public interface class OutputTraceListener + namespace Linphone { - public: - void outputTrace(Platform::String^ lev, Platform::String^ msg); - }; - - public ref class LibLinphoneTester sealed - { - public: - void setOutputTraceListener(OutputTraceListener^ traceListener); - unsigned int nbTestSuites(); - unsigned int nbTests(Platform::String^ suiteName); - Platform::String^ testSuiteName(int index); - Platform::String^ testName(Platform::String^ suiteName, int testIndex); - void initialize(Windows::Storage::StorageFolder^ writableDirectory, Platform::Boolean ui); - bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose); - void runAllToXml(); - - static property LibLinphoneTester^ Instance + namespace Tester { - LibLinphoneTester^ get() { return _instance; } - } - property Windows::Foundation::IAsyncAction^ AsyncAction - { - Windows::Foundation::IAsyncAction^ get() { return _asyncAction; } - } - private: - LibLinphoneTester(); - ~LibLinphoneTester(); + public interface class OutputTraceListener + { + public: + void outputTrace(Platform::String^ lev, Platform::String^ msg); + }; - static LibLinphoneTester^ _instance; - Windows::Foundation::IAsyncAction^ _asyncAction; - }; + public ref class NativeTester sealed + { + public: + void setOutputTraceListener(OutputTraceListener^ traceListener); + unsigned int nbTestSuites(); + unsigned int nbTests(Platform::String^ suiteName); + Platform::String^ testSuiteName(int index); + Platform::String^ testName(Platform::String^ suiteName, int testIndex); + void initialize(Windows::Storage::StorageFolder^ writableDirectory, Platform::Boolean ui); + bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose); + void runAllToXml(); + + static property NativeTester^ Instance + { + NativeTester^ get() { return _instance; } + } + property Windows::Foundation::IAsyncAction^ AsyncAction + { + Windows::Foundation::IAsyncAction^ get() { return _asyncAction; } + } + private: + NativeTester(); + ~NativeTester(); + + static NativeTester^ _instance; + Windows::Foundation::IAsyncAction^ _asyncAction; + }; + } + } } \ No newline at end of file diff --git a/tester/tester.c b/tester/tester.c index 6bfd4972e..2486450a5 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -327,6 +327,8 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { } linphone_core_set_user_certificates_path(mgr->lc,bc_tester_get_writable_dir_prefix()); + /*for now, we need the periodical updates facility to compute bandwidth measurements correctly during tests*/ + lp_config_set_int(linphone_core_get_config(mgr->lc), "misc", "send_call_stats_periodical_updates", 1); if (rc_path) ms_free(rc_path); }