diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 010921544..43926027b 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -239,57 +239,62 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve ms_warning("Receiving request for null or terminated op [%p], ignored",op); return; } - }else if (strcmp("INVITE",method)==0) { + }else{ /*handle the case where we are receiving a request with to tag but it is not belonging to any dialog*/ - belle_sip_header_to_t *to = belle_sip_message_get_header_by_type(req, belle_sip_header_to_t); - if (belle_sip_header_to_get_tag(to) != NULL){ - ms_warning("Receiving INVITE with to-tag but no know dialog here. Rejecting."); - resp=belle_sip_response_create_from_request(req,481); + if (strcmp("INVITE",method)==0 || strcmp("NOTIFY",method)==0) { + belle_sip_header_to_t *to = belle_sip_message_get_header_by_type(req, belle_sip_header_to_t); + if (belle_sip_header_to_get_tag(to) != NULL){ + ms_warning("Receiving %s with to-tag but no know dialog here. Rejecting.", method); + resp=belle_sip_response_create_from_request(req,481); + belle_sip_provider_send_response(sal->prov,resp); + return; + } + } + + if (strcmp("INVITE",method)==0) { + op=sal_op_new(sal); + op->dir=SalOpDirIncoming; + sal_op_call_fill_cbs(op); + }else if ((strcmp("SUBSCRIBE",method)==0 || strcmp("NOTIFY",method)==0) && (evh=belle_sip_message_get_header(BELLE_SIP_MESSAGE(req),"Event"))!=NULL) { + op=sal_op_new(sal); + op->dir=SalOpDirIncoming; + if (strncmp(belle_sip_header_get_unparsed_value(evh),"presence",strlen("presence"))==0){ + sal_op_presence_fill_cbs(op); + }else + sal_op_subscribe_fill_cbs(op); + }else if (strcmp("MESSAGE",method)==0) { + op=sal_op_new(sal); + op->dir=SalOpDirIncoming; + sal_op_message_fill_cbs(op); + }else if (strcmp("OPTIONS",method)==0) { + resp=belle_sip_response_create_from_request(req,200); + belle_sip_provider_send_response(sal->prov,resp); + return; + }else if (strcmp("INFO",method)==0) { + resp=belle_sip_response_create_from_request(req,481);/*INFO out of call dialogs are not allowed*/ + belle_sip_provider_send_response(sal->prov,resp); + return; + }else if (strcmp("BYE",method)==0) { + resp=belle_sip_response_create_from_request(req,481);/*out of dialog BYE */ + belle_sip_provider_send_response(sal->prov,resp); + return; + }else if (strcmp("CANCEL",method)==0) { + resp=belle_sip_response_create_from_request(req,481);/*out of dialog CANCEL */ + belle_sip_provider_send_response(sal->prov,resp); + return; + }else if (sal->enable_test_features && strcmp("PUBLISH",method)==0) { + resp=belle_sip_response_create_from_request(req,200);/*out of dialog BYE */ + belle_sip_message_add_header((belle_sip_message_t*)resp,belle_sip_header_create("SIP-Etag","4441929FFFZQOA")); + belle_sip_provider_send_response(sal->prov,resp); + return; + }else { + ms_error("sal process_request_event not implemented yet for method [%s]",belle_sip_request_get_method(req)); + resp=belle_sip_response_create_from_request(req,405); + belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp) + ,BELLE_SIP_HEADER(belle_sip_header_allow_create("INVITE, CANCEL, ACK, BYE, SUBSCRIBE, NOTIFY, MESSAGE, OPTIONS, INFO"))); belle_sip_provider_send_response(sal->prov,resp); return; } - op=sal_op_new(sal); - op->dir=SalOpDirIncoming; - sal_op_call_fill_cbs(op); - }else if ((strcmp("SUBSCRIBE",method)==0 || strcmp("NOTIFY",method)==0) && (evh=belle_sip_message_get_header(BELLE_SIP_MESSAGE(req),"Event"))!=NULL) { - op=sal_op_new(sal); - op->dir=SalOpDirIncoming; - if (strncmp(belle_sip_header_get_unparsed_value(evh),"presence",strlen("presence"))==0){ - sal_op_presence_fill_cbs(op); - }else - sal_op_subscribe_fill_cbs(op); - }else if (strcmp("MESSAGE",method)==0) { - op=sal_op_new(sal); - op->dir=SalOpDirIncoming; - sal_op_message_fill_cbs(op); - }else if (strcmp("OPTIONS",method)==0) { - resp=belle_sip_response_create_from_request(req,200); - belle_sip_provider_send_response(sal->prov,resp); - return; - }else if (strcmp("INFO",method)==0) { - resp=belle_sip_response_create_from_request(req,481);/*INFO out of call dialogs are not allowed*/ - belle_sip_provider_send_response(sal->prov,resp); - return; - }else if (strcmp("BYE",method)==0) { - resp=belle_sip_response_create_from_request(req,481);/*out of dialog BYE */ - belle_sip_provider_send_response(sal->prov,resp); - return; - }else if (strcmp("CANCEL",method)==0) { - resp=belle_sip_response_create_from_request(req,481);/*out of dialog CANCEL */ - belle_sip_provider_send_response(sal->prov,resp); - return; - }else if (sal->enable_test_features && strcmp("PUBLISH",method)==0) { - resp=belle_sip_response_create_from_request(req,200);/*out of dialog BYE */ - belle_sip_message_add_header((belle_sip_message_t*)resp,belle_sip_header_create("SIP-Etag","4441929FFFZQOA")); - belle_sip_provider_send_response(sal->prov,resp); - return; - }else { - ms_error("sal process_request_event not implemented yet for method [%s]",belle_sip_request_get_method(req)); - resp=belle_sip_response_create_from_request(req,405); - belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp) - ,BELLE_SIP_HEADER(belle_sip_header_allow_create("INVITE, CANCEL, ACK, BYE, SUBSCRIBE, NOTIFY, MESSAGE, OPTIONS, INFO"))); - belle_sip_provider_send_response(sal->prov,resp); - return; } if (!op->base.from_address) { @@ -1010,7 +1015,7 @@ int sal_generate_uuid(char *uuid, size_t len) { sal_uuid_t uuid_struct; int i; int written; - + if (len==0) return -1; /*create an UUID as described in RFC4122, 4.4 */ belle_sip_random_bytes((unsigned char*)&uuid_struct, sizeof(sal_uuid_t)); diff --git a/coreapi/bellesip_sal/sal_sdp.c b/coreapi/bellesip_sal/sal_sdp.c index 3f355aee5..2398fde30 100644 --- a/coreapi/bellesip_sal/sal_sdp.c +++ b/coreapi/bellesip_sal/sal_sdp.c @@ -126,7 +126,7 @@ static void add_rtcp_fb_attributes(belle_sdp_media_description_t *media_desc, co uint16_t trr_int = 0; general_trr_int = is_rtcp_fb_trr_int_the_same_for_all_payloads(stream, &trr_int); - if (general_trr_int == TRUE && trr_int != 0) { + if (general_trr_int == TRUE && trr_int != 0) { add_rtcp_fb_trr_int_attribute(media_desc, -1, trr_int); } if (stream->rtcp_fb.generic_nack_enabled == TRUE) { @@ -737,7 +737,7 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md, belle_sip_list_t *custom_attribute_it; const char* value; const char *mtype,*proto; - bool_t has_avpf_attributes; + bool_t has_avpf_attributes; stream=&md->streams[md->nb_streams]; media=belle_sdp_media_description_get_media ( media_desc ); @@ -850,16 +850,15 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md, /* Get ICE candidate attributes if any */ sdp_parse_media_ice_parameters(media_desc, stream); - has_avpf_attributes = sdp_parse_rtcp_fb_parameters(media_desc, stream); + has_avpf_attributes = sdp_parse_rtcp_fb_parameters(media_desc, stream); /* Get RTCP-FB attributes if any */ if (sal_stream_description_has_avpf(stream)) { enable_avpf_for_stream(stream); + }else if (has_avpf_attributes ){ + enable_avpf_for_stream(stream); + stream->implicit_rtcp_fb = TRUE; } - else if (has_avpf_attributes ){ - - stream->implicit_rtcp_fb = TRUE; - } /* Get RTCP-XR attributes if any */ stream->rtcp_xr = md->rtcp_xr; // Use session parameters if no stream parameters are defined diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 41b399e08..8f9f50690 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -495,7 +495,7 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o if (call->params->internal_call_update) call->params->internal_call_update = FALSE; - + #ifdef BUILD_UPNP if (call->upnp_session != NULL && rmd) { linphone_core_update_upnp_from_remote_media_description(call, rmd); @@ -511,12 +511,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.")); @@ -1063,7 +1063,7 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); LinphoneAddress *refer_to_addr = linphone_address_new(referto); char method[20] = ""; - + if(refer_to_addr) { const char *tmp = linphone_address_get_method_param(refer_to_addr); if(tmp) strncpy(method, tmp, sizeof(method)); @@ -1131,7 +1131,7 @@ static void parse_presence_requested(SalOp *op, const char *content_type, const static void convert_presence_to_xml_requested(SalOp *op, SalPresenceModel *presence, const char *contact, char **content) { /*for backward compatibility because still used by notify. No loguer used for publish*/ - + if(linphone_presence_model_get_presentity((LinphonePresenceModel*)presence) == NULL) { LinphoneAddress * presentity = linphone_address_new(contact); linphone_presence_model_set_presentity((LinphonePresenceModel*)presence, presentity); @@ -1313,8 +1313,8 @@ static void subscribe_response(SalOp *op, SalSubscribeStatus status){ static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, SalBodyHandler *body_handler){ LinphoneEvent *lev=(LinphoneEvent*)sal_op_get_user_pointer(op); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); - - if (lev==NULL) { + bool_t out_of_dialog = (lev==NULL); + if (out_of_dialog) { /*out of subscribe notify */ lev=linphone_event_new_with_out_of_dialog_op(lc,op,LinphoneSubscriptionOutgoing,eventname); } @@ -1328,6 +1328,11 @@ static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, SalB if (st!=SalSubscribeNone){ linphone_event_set_state(lev,linphone_subscription_state_from_sal(st)); } + + if (out_of_dialog) { + linphone_event_unref(lev); + } + } static void subscribe_received(SalOp *op, const char *eventname, const SalBodyHandler *body_handler){ diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 4b2aea12e..8e4696933 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -619,48 +619,52 @@ static void linphone_friend_list_close_subscriptions(LinphoneFriendList *list) { void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered) { const MSList *elem; - if (list->enable_subscriptions && list->rls_uri != NULL) { - LinphoneAddress *address = linphone_address_new(list->rls_uri); - char *xml_content = create_resource_list_xml(list); - if ((address != NULL) && (xml_content != NULL) && (linphone_friend_list_has_subscribe_inactive(list) == TRUE)) { - unsigned char digest[16]; - bctoolbox_md5((unsigned char *)xml_content, strlen(xml_content), digest); - if ((list->event != NULL) && (list->content_digest != NULL) && (memcmp(list->content_digest, digest, sizeof(digest)) == 0)) { - /* The content has not changed, only refresh the event. */ - linphone_event_refresh_subscribe(list->event); - } else { - LinphoneContent *content; - int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600); - list->expected_notification_version = 0; - if (list->content_digest != NULL) ms_free(list->content_digest); - list->content_digest = ms_malloc(sizeof(digest)); - memcpy(list->content_digest, digest, sizeof(digest)); - if (list->event != NULL) { - linphone_event_terminate(list->event); - linphone_event_unref(list->event); + if (list->rls_uri != NULL) { + if (list->enable_subscriptions) { + LinphoneAddress *address = linphone_address_new(list->rls_uri); + char *xml_content = create_resource_list_xml(list); + if ((address != NULL) && (xml_content != NULL) && (linphone_friend_list_has_subscribe_inactive(list) == TRUE)) { + unsigned char digest[16]; + bctoolbox_md5((unsigned char *)xml_content, strlen(xml_content), digest); + if ((list->event != NULL) && (list->content_digest != NULL) && (memcmp(list->content_digest, digest, sizeof(digest)) == 0)) { + /* The content has not changed, only refresh the event. */ + linphone_event_refresh_subscribe(list->event); + } else { + LinphoneContent *content; + int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600); + list->expected_notification_version = 0; + if (list->content_digest != NULL) ms_free(list->content_digest); + list->content_digest = ms_malloc(sizeof(digest)); + memcpy(list->content_digest, digest, sizeof(digest)); + if (list->event != NULL) { + linphone_event_terminate(list->event); + linphone_event_unref(list->event); + } + list->event = linphone_core_create_subscribe(list->lc, address, "presence", expires); + linphone_event_ref(list->event); + linphone_event_set_internal(list->event, TRUE); + linphone_event_add_custom_header(list->event, "Require", "recipient-list-subscribe"); + linphone_event_add_custom_header(list->event, "Supported", "eventlist"); + linphone_event_add_custom_header(list->event, "Accept", "multipart/related, application/pidf+xml, application/rlmi+xml"); + linphone_event_add_custom_header(list->event, "Content-Disposition", "recipient-list"); + content = linphone_core_create_content(list->lc); + linphone_content_set_type(content, "application"); + linphone_content_set_subtype(content, "resource-lists+xml"); + linphone_content_set_string_buffer(content, xml_content); + if (linphone_core_content_encoding_supported(list->lc, "deflate")) { + linphone_content_set_encoding(content, "deflate"); + linphone_event_add_custom_header(list->event, "Accept-Encoding", "deflate"); + } + linphone_event_send_subscribe(list->event, content); + linphone_content_unref(content); + linphone_event_set_user_data(list->event, list); } - list->event = linphone_core_create_subscribe(list->lc, address, "presence", expires); - linphone_event_ref(list->event); - linphone_event_set_internal(list->event, TRUE); - linphone_event_add_custom_header(list->event, "Require", "recipient-list-subscribe"); - linphone_event_add_custom_header(list->event, "Supported", "eventlist"); - linphone_event_add_custom_header(list->event, "Accept", "multipart/related, application/pidf+xml, application/rlmi+xml"); - linphone_event_add_custom_header(list->event, "Content-Disposition", "recipient-list"); - content = linphone_core_create_content(list->lc); - linphone_content_set_type(content, "application"); - linphone_content_set_subtype(content, "resource-lists+xml"); - linphone_content_set_string_buffer(content, xml_content); - if (linphone_core_content_encoding_supported(list->lc, "deflate")) { - linphone_content_set_encoding(content, "deflate"); - linphone_event_add_custom_header(list->event, "Accept-Encoding", "deflate"); - } - linphone_event_send_subscribe(list->event, content); - linphone_content_unref(content); - linphone_event_set_user_data(list->event, list); } + if (address != NULL) linphone_address_unref(address); + if (xml_content != NULL) ms_free(xml_content); + } else { + ms_message("Friends list [%p] subscription update skipped since subscriptions not enabled yet", list); } - if (address != NULL) linphone_address_unref(address); - if (xml_content != NULL) ms_free(xml_content); } else { for (elem = list->friends; elem != NULL; elem = elem->next) { LinphoneFriend *lf = (LinphoneFriend *)elem->data; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7626ac9f9..930025cbd 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -735,10 +735,10 @@ void linphone_call_make_local_media_description(LinphoneCall *call) { /*set audio capabilities */ - codec_hints.bandwidth_limit=params->audio_bw; - codec_hints.max_codecs=-1; - codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL; - l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs); + codec_hints.bandwidth_limit=params->audio_bw; + codec_hints.max_codecs=-1; + codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL; + l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs); if (params->has_audio && l != NULL) { strncpy(md->streams[call->main_audio_stream_index].rtp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtp_addr)); @@ -1503,7 +1503,14 @@ void linphone_call_fix_call_parameters(LinphoneCall *call, SalMediaDescription * if (rmd) { linphone_call_compute_streams_indexes(call, rmd); linphone_call_update_biggest_desc(call, rmd); - call->params->implicit_rtcp_fb &= sal_media_description_has_implicit_avpf(rmd); + /* Why disabling implicit_rtcp_fb ? It is a local policy choice actually. It doesn't disturb to propose it again and again + * even if the other end apparently doesn't support it. + * The following line of code is causing trouble, while for example making an audio call, then adding video. + * Due to the 200Ok response of the audio-only offer where no rtcp-fb attribute is present, implicit_rtcp_fb is set to + * FALSE, which is then preventing it to be eventually used when video is later added to the call. + * I did the choice of commenting it out. + */ + /*call->params->implicit_rtcp_fb &= sal_media_description_has_implicit_avpf(rmd);*/ } rcp = linphone_call_get_remote_params(call); if (rcp){ @@ -1827,9 +1834,9 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){ } else { call->current_params->media_encryption=LinphoneMediaEncryptionNone; } - break; + break; } - call->current_params->avpf_enabled = linphone_call_all_streams_avpf_enabled(call) && sal_media_description_has_avpf(md); + call->current_params->avpf_enabled = linphone_call_all_streams_avpf_enabled(call) && sal_media_description_has_avpf(md); if (call->current_params->avpf_enabled == TRUE) { call->current_params->avpf_rr_interval = linphone_call_get_avpf_rr_interval(call); } else { @@ -1848,7 +1855,7 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){ call->current_params->audio_multicast_enabled = FALSE; sd=sal_media_description_find_best_stream(md,SalVideo); - call->current_params->implicit_rtcp_fb = sd ? sal_stream_description_has_implicit_avpf(sd): FALSE; + call->current_params->implicit_rtcp_fb = sd ? sal_stream_description_has_implicit_avpf(sd): FALSE; call->current_params->video_dir=sd ? media_direction_from_sal_stream_dir(sd->dir) : LinphoneMediaDirectionInactive; if (call->current_params->video_dir != LinphoneMediaDirectionInactive) { rtp_addr = sd->rtp_addr[0]!='\0' ? sd->rtp_addr : call->resultdesc->addr; @@ -1856,8 +1863,6 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){ } else call->current_params->video_multicast_enabled = FALSE; - - } return call->current_params; @@ -4348,27 +4353,16 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ OrtpEventData *evd=ortp_event_get_data(ev); if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) { - LinphoneCallParams *params = linphone_call_params_copy(call->current_params); - switch (call->params->media_encryption) { - case LinphoneMediaEncryptionZRTP: - case LinphoneMediaEncryptionDTLS: - /* preserve media encryption param because at that time ZRTP/SRTP-DTLS negociation may still be ongoing*/ - params->media_encryption=call->params->media_encryption; - break; - case LinphoneMediaEncryptionSRTP: - case LinphoneMediaEncryptionNone: - /*keep all values to make sure a warning will be generated by compiler if new enum value is added*/ - break; - } - switch (ice_session_state(call->ice_session)) { case IS_Completed: case IS_Failed: /* At least one ICE session has succeeded, so perform a call update. */ if (ice_session_has_completed_check_list(call->ice_session) == TRUE) { - if (ice_session_role(call->ice_session) == IR_Controlling && params->update_call_when_ice_completed ) { + if (ice_session_role(call->ice_session) == IR_Controlling && call->params->update_call_when_ice_completed ) { + LinphoneCallParams *params = linphone_core_create_call_params(call->core, call); params->internal_call_update = TRUE; linphone_core_update_call(call->core, call, params); + linphone_call_params_unref(params); } start_dtls_on_all_streams(call); } @@ -4376,9 +4370,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ default: break; } - linphone_core_update_ice_state_in_call_stats(call); - linphone_call_params_unref(params); } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { if (evd->info.ice_processing_successful==FALSE) { ms_warning("No STUN answer from [%s], continuing without STUN",linphone_core_get_stun_server(call->core)); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f179f0a03..6513675b4 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1705,7 +1705,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve const MSList* friendLists = linphone_core_get_friends_lists(lc); while( friendLists != NULL ){ LinphoneFriendList* list = friendLists->data; - ms_warning("notify presence for list %p", list); + ms_message("notify presence for list %p", list); linphone_friend_list_notify_presence_received(list, lev, body); friendLists = friendLists->next; } diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index f9c4b019c..9083fbfc1 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1649,6 +1649,14 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall(JNIEnv* env return (jboolean)linphone_core_in_call((LinphoneCore*)lc); } + +extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_isPresenceReceived(JNIEnv* env + ,jobject thiz + ,jlong lf) { + + return (jboolean)linphone_friend_is_presence_received((LinphoneFriend*)lf); +} + extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInComingInvitePending(JNIEnv* env ,jobject thiz ,jlong lc) { diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 0676e2a74..81136fc73 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -198,7 +198,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL } matched->flags|=PAYLOAD_TYPE_FLAG_CAN_RECV|PAYLOAD_TYPE_FLAG_CAN_SEND; if (p2->flags & PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED) { - matched->flags |= PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED; + payload_type_set_flag(matched, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED); /* Negotiation of AVPF features (keep common features) */ matched->avpf.features &= p2->avpf.features; matched->avpf.rpsi_compatibility = p2->avpf.rpsi_compatibility; @@ -206,6 +206,8 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL if (p2->avpf.trr_interval < matched->avpf.trr_interval) { matched->avpf.trr_interval = matched->avpf.trr_interval; } + }else{ + payload_type_unset_flag(matched, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED); } res=ms_list_append(res,matched); /* we should use the remote numbering even when parsing a response */ @@ -518,7 +520,7 @@ static void initiate_incoming(MSFactory *factory, const SalStreamDescription *lo result->dtls_role = SalDtlsRoleInvalid; } result->rtcp_mux = remote_offer->rtcp_mux && local_cap->rtcp_mux; - result->implicit_rtcp_fb = local_cap->implicit_rtcp_fb && remote_offer->implicit_rtcp_fb; + result->implicit_rtcp_fb = local_cap->implicit_rtcp_fb && remote_offer->implicit_rtcp_fb; } diff --git a/coreapi/proxy.c b/coreapi/proxy.c index bc5845e0a..6cd24c61f 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -198,6 +198,7 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *cfg){ cfg->op=NULL; } if (cfg->long_term_event){ + linphone_event_terminate(cfg->long_term_event); linphone_event_unref(cfg->long_term_event); cfg->long_term_event=NULL; } diff --git a/coreapi/sal.c b/coreapi/sal.c index a1620d7c0..6a53b61d7 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -221,10 +221,7 @@ bool_t sal_stream_description_has_avpf(const SalStreamDescription *sd) { } bool_t sal_stream_description_has_implicit_avpf(const SalStreamDescription *sd){ - if (sd->implicit_rtcp_fb){ - return TRUE; - } - return FALSE; + return sd->implicit_rtcp_fb; } /*these are switch case, so that when a new proto is added we can't forget to modify this function*/ bool_t sal_stream_description_has_srtp(const SalStreamDescription *sd) { diff --git a/gtk/incall_view.c b/gtk/incall_view.c index cf97b5d53..ba90f7560 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -461,9 +461,9 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){ static void video_button_clicked(GtkWidget *button, LinphoneCall *call){ gboolean adding=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"adding_video")); LinphoneCore *lc=linphone_call_get_core(call); - LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); + LinphoneCallParams *params = linphone_core_create_call_params(lc, call); gtk_widget_set_sensitive(button,FALSE); - linphone_call_params_enable_video(params,adding); + linphone_call_params_enable_video(params, adding); linphone_core_update_call(lc,call,params); linphone_call_params_destroy(params); } diff --git a/gtk/main.c b/gtk/main.c index 014c733f7..0a145bc58 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1277,7 +1277,7 @@ static void on_call_updated_response(GtkWidget *dialog, gint responseid, gpointe LinphoneCall *call = (LinphoneCall *)g_object_get_data(G_OBJECT(dialog), "call"); if (linphone_call_get_state(call)==LinphoneCallUpdatedByRemote){ LinphoneCore *lc=linphone_call_get_core(call); - LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); + LinphoneCallParams *params = linphone_core_create_call_params(lc, call); linphone_call_params_enable_video(params,responseid==GTK_RESPONSE_YES); linphone_core_accept_call_update(lc,call,params); linphone_call_params_destroy(params); diff --git a/java/common/org/linphone/core/LinphoneFriend.java b/java/common/org/linphone/core/LinphoneFriend.java index 2e23c2a96..d210833eb 100644 --- a/java/common/org/linphone/core/LinphoneFriend.java +++ b/java/common/org/linphone/core/LinphoneFriend.java @@ -102,6 +102,12 @@ public interface LinphoneFriend { * @return true is subscription is activated for this friend. */ boolean isSubscribesEnabled(); + + /** + * get presence received status if already setted + * @return true if presence is received from this friend. + */ + boolean isPresenceReceived(); /** * @brief Get the status of a friend * @return OnlineStatus diff --git a/java/impl/org/linphone/core/LinphoneFriendImpl.java b/java/impl/org/linphone/core/LinphoneFriendImpl.java index 5db973977..a50288240 100644 --- a/java/impl/org/linphone/core/LinphoneFriendImpl.java +++ b/java/impl/org/linphone/core/LinphoneFriendImpl.java @@ -30,6 +30,7 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable { private native int getIncSubscribePolicy(long nativePtr); private native void enableSubscribes(long nativePtr,boolean value); private native boolean isSubscribesEnabled(long nativePtr); + private native boolean isPresenceReceived(long nativePtr); private native int getStatus(long nativePtr); private native Object getPresenceModel(long nativePtr); private native void setPresenceModel(long nativePtr, long presencePtr); @@ -82,6 +83,9 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable { public boolean isSubscribesEnabled() { return isSubscribesEnabled(nativePtr); } + public boolean isPresenceReceived() { + return isPresenceReceived(nativePtr); + } public OnlineStatus getStatus() { return OnlineStatus.fromInt(getStatus(nativePtr)); } diff --git a/mediastreamer2 b/mediastreamer2 index 375b7f3cf..26cf83eee 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 375b7f3cfeb3fa878ed797d8663dceb5caf6679f +Subproject commit 26cf83eee5d0a20818a0044b85a27fff5f602d7f diff --git a/tester/player_tester.c b/tester/player_tester.c index 7625329ed..5f68c7ba2 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -33,19 +33,14 @@ static void eof_callback(LinphonePlayer *player, void *user_data) { } static void play_file(const char *filename, bool_t supported_format, const char *audio_mime, const char *video_mime) { - LinphoneCoreManager *lc_manager; + LinphoneCoreManager *lc_manager = linphone_core_manager_new("marie_rc"); LinphonePlayer *player; - int res, time = 0; + int res, timer = 0; bool_t eof = FALSE; - bool_t audio_codec_supported; - bool_t video_codec_supported; - lc_manager = linphone_core_manager_new("marie_rc"); - BC_ASSERT_PTR_NOT_NULL(lc_manager); - if(lc_manager == NULL) return; - - audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), audio_mime)); - video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), video_mime)); + bool_t audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), audio_mime)); + bool_t video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), video_mime)); + int expected_res = (supported_format && (audio_codec_supported || video_codec_supported)) ? 0 : -1; player = linphone_core_create_local_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_factory_get_snd_card_manager(linphone_core_get_ms_factory((void *)lc_manager->lc))), @@ -54,19 +49,15 @@ static void play_file(const char *filename, bool_t supported_format, const char if(player == NULL) goto fail; res = linphone_player_open(player, filename, eof_callback, &eof); - if(supported_format && (audio_codec_supported || video_codec_supported)) { - BC_ASSERT_EQUAL(res, 0, int, "%d"); - } else { - BC_ASSERT_EQUAL(res, -1, int, "%d"); - } - + BC_ASSERT_EQUAL(res, expected_res, int, "%d"); + if(res == -1) goto fail; res = linphone_player_start(player); BC_ASSERT_EQUAL(res, 0, int, "%d"); if(res == -1) goto fail; - BC_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, (int)(linphone_player_get_duration(player) * 1.05))); + BC_ASSERT_TRUE(wait_for_eof(&eof, &timer, 100, (int)(linphone_player_get_duration(player) * 1.05))); linphone_player_close(player); diff --git a/tester/presence_server_tester.c b/tester/presence_server_tester.c index 0cf173a0d..a82f83898 100644 --- a/tester/presence_server_tester.c +++ b/tester/presence_server_tester.c @@ -66,6 +66,7 @@ static void simple(void) { BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityDinner, int, "%d"); } + linphone_friend_unref(f); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -249,7 +250,7 @@ static void subscribe_with_late_publish(void) { BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityBreakfast, 0, int,"%i"); BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityAppointment, 1, int,"%i"); - + linphone_friend_unref(lf); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -316,6 +317,7 @@ static void test_forked_subscribe_notify_publish(void) { /*wait for new status*/ BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphonePresenceActivityMeeting,1,3000)); + linphone_friend_unref(lf); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); linphone_core_manager_destroy(pauline); @@ -554,12 +556,12 @@ static void test_presence_list_subscription_expire_for_unknown(void) { linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc)); linphone_core_add_friend_list(laure->lc, lfl); linphone_friend_list_update_subscriptions(lfl,NULL,FALSE); - linphone_friend_list_unref(lfl); /* wait for refresh*/ BC_ASSERT_FALSE(wait_for_until(laure->lc, NULL, &laure->stat.number_of_NotifyPresenceReceived, 1, 4000)); + linphone_friend_unref(lf); linphone_core_manager_destroy(laure); } @@ -583,8 +585,10 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) { linphone_friend_list_set_rls_uri(lfl, rls_uri); lf = linphone_core_create_friend_with_address(laure->lc, pauline_identity); linphone_friend_list_add_friend(lfl, lf); + linphone_friend_unref(lf); lf = linphone_core_create_friend_with_address(laure->lc, "sip:michelle@sip.inexistentdomain.com"); linphone_friend_list_add_friend(lfl, lf); + linphone_friend_unref(lf); linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc)); linphone_core_add_friend_list(laure->lc, lfl); linphone_friend_list_unref(lfl); @@ -712,14 +716,14 @@ static void long_term_presence_list(void) { test_t presence_server_tests[] = { TEST_NO_TAG("Simple", simple), TEST_NO_TAG("Fast activity change", fast_activity_change), - TEST_ONE_TAG("Subscriber no longer reachable using server",subscriber_no_longer_reachable, "presence"), - TEST_ONE_TAG("Subscribe with late publish", subscribe_with_late_publish, "LeaksMemory"), - TEST_ONE_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish, "LeaksMemory"), - TEST_ONE_TAG("Presence list", test_presence_list, "LeaksMemory"), - TEST_ONE_TAG("Presence list without compression", test_presence_list_without_compression, "LeaksMemory"), - TEST_ONE_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown, "LeaksMemory"), - TEST_ONE_TAG("Presence list, silent subscription expiration", presence_list_subscribe_dialog_expire, "LeaksMemory"), - TEST_ONE_TAG("Presence list, io error",presence_list_subscribe_io_error, "LeaksMemory"), + TEST_NO_TAG("Subscriber no longer reachable using server",subscriber_no_longer_reachable), + TEST_NO_TAG("Subscribe with late publish", subscribe_with_late_publish), + TEST_NO_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish), + TEST_NO_TAG("Presence list", test_presence_list), + TEST_NO_TAG("Presence list without compression", test_presence_list_without_compression), + TEST_NO_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown), + TEST_NO_TAG("Presence list, silent subscription expiration", presence_list_subscribe_dialog_expire), + TEST_NO_TAG("Presence list, io error",presence_list_subscribe_io_error), TEST_NO_TAG("Long term presence existing friend",long_term_presence_existing_friend), TEST_NO_TAG("Long term presence inexistent friend",long_term_presence_inexistent_friend), TEST_NO_TAG("Long term presence list",long_term_presence_list), diff --git a/tester/tester.c b/tester/tester.c index 2b35d0618..f64402c23 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -263,6 +263,10 @@ bool_t transport_supported(LinphoneTransportType transport) { return supported; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic push +#endif +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { char *rc_path = NULL; char *hellopath = bc_tester_res("sounds/hello8000.wav"); @@ -270,14 +274,7 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { mgr->v_table.registration_state_changed=registration_state_changed; mgr->v_table.auth_info_requested=auth_info_requested; mgr->v_table.call_state_changed=call_state_changed; -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic push -#endif -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" mgr->v_table.text_received=text_message_received; -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic pop -#endif mgr->v_table.message_received=message_received; mgr->v_table.is_composing_received=is_composing_received; mgr->v_table.new_subscription_requested=new_subscription_requested; @@ -341,6 +338,9 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { if (rc_path) ms_free(rc_path); } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies) { LinphoneProxyConfig* proxy;