From 2058b0cd210fad744e2f8f7789a7738f264575aa Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 6 Dec 2013 18:22:03 +0100 Subject: [PATCH 1/5] update ms2 (android bugfix) --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 11eb5f602..6920f363d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 11eb5f6021a145a8b2f0a65ba409814acfda0f01 +Subproject commit 6920f363d8f6db7c98f6dc471a045f43e4f26200 From a610adecf47d9c2d0719d8d4bee8e0777ae71e58 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 9 Dec 2013 12:19:13 +0100 Subject: [PATCH 2/5] add supported header --- coreapi/bellesip_sal/sal_impl.c | 1 + coreapi/bellesip_sal/sal_impl.h | 2 ++ coreapi/bellesip_sal/sal_op_call.c | 2 +- coreapi/bellesip_sal/sal_op_impl.c | 23 ++++++++++++++--------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 7f55d453c..37384f3e9 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -857,6 +857,7 @@ int sal_create_uuid(Sal*ctx, char *uuid, size_t len){ belle_sip_response_t* sal_create_response_from_request ( Sal* sal, belle_sip_request_t* req, int code ) { belle_sip_response_t *resp=belle_sip_response_create_from_request(req,code); belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),BELLE_SIP_HEADER(sal->user_agent)); + belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),sal_make_supported_header(sal)); return resp; } diff --git a/coreapi/bellesip_sal/sal_impl.h b/coreapi/bellesip_sal/sal_impl.h index 371153ea5..4ae34095b 100644 --- a/coreapi/bellesip_sal/sal_impl.h +++ b/coreapi/bellesip_sal/sal_impl.h @@ -157,4 +157,6 @@ bool_t sal_op_get_body(SalOp *op, belle_sip_message_t *msg, SalBody *salbody); SalReason sal_reason_to_sip_code(SalReason r); +belle_sip_header_t * sal_make_supported_header(Sal *sal); + #endif /* SAL_IMPL_H_ */ diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index b434a1c38..a286001b2 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -647,7 +647,7 @@ int sal_call_accept(SalOp*h){ belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(create_allow())); if (h->base.root->session_expires!=0){ if (h->supports_session_timers) { - belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),belle_sip_header_create( "Supported", "timer")); + belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),belle_sip_header_create("Supported", "timer")); } } diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index 4c6a1091a..49fa7c5f8 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -111,6 +111,10 @@ belle_sip_header_contact_t* sal_op_create_contact(SalOp *op){ return contact_header; } +belle_sip_header_t * sal_make_supported_header(Sal *sal){ + return belle_sip_header_create("Supported","replaces, outbound"); +} + belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) { belle_sip_header_from_t* from_header; belle_sip_header_to_t* to_header; @@ -133,16 +137,16 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) { to_header = belle_sip_header_to_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_to_address(op)),NULL); req=belle_sip_request_create( - req_uri, - method, - belle_sip_provider_create_call_id(prov), - belle_sip_header_cseq_create(20,method), - from_header, - to_header, - belle_sip_header_via_new(), - 70); + req_uri, + method, + belle_sip_provider_create_call_id(prov), + belle_sip_header_cseq_create(20,method), + from_header, + to_header, + belle_sip_header_via_new(), + 70); - if (op->privacy&SalPrivacyId) { + if (op->privacy & SalPrivacyId) { belle_sip_header_p_preferred_identity_t* p_preferred_identity=belle_sip_header_p_preferred_identity_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_from_address(op))); belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(p_preferred_identity)); } @@ -162,6 +166,7 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) { belle_sip_header_privacy_add_privacy(privacy_header,sal_privacy_to_string(SalPrivacyUser)); belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(privacy_header)); } + belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),sal_make_supported_header(op->base.root)); return req; } From 21447a20b2bea6242c45daaa780b0a829ec8767c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 9 Dec 2013 12:26:49 +0100 Subject: [PATCH 3/5] add privacy api in java. --- coreapi/linphonecore_jni.cc | 22 +++++++++++++++++++ .../org/linphone/core/LinphoneCallParams.java | 12 ++++++++++ .../linphone/core/LinphoneProxyConfig.java | 13 +++++++++++ .../linphone/core/LinphoneCallParamsImpl.java | 12 ++++++++++ .../core/LinphoneProxyConfigImpl.java | 11 ++++++++++ 5 files changed, 70 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index fa583f144..65438fc19 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2568,6 +2568,20 @@ extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setMediaEncryption linphone_call_params_set_media_encryption((LinphoneCallParams*)cp,(LinphoneMediaEncryption)jmenc); } +extern "C" jint Java_org_linphone_core_LinphoneCallParamsImpl_getPrivacy(JNIEnv* env + ,jobject thiz + ,jlong cp + ) { + return (jint)linphone_call_params_get_privacy((LinphoneCallParams*)cp); +} + +extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_setPrivacy(JNIEnv* env + ,jobject thiz + ,jlong cp + ,jint privacy) { + linphone_call_params_set_privacy((LinphoneCallParams*)cp,privacy); +} + extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_audioBandwidth(JNIEnv *env, jobject thiz, jlong lcp, jint bw){ linphone_call_params_set_audio_bandwidth_limit((LinphoneCallParams*)lcp, bw); } @@ -2719,6 +2733,14 @@ extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getExpires(JNIEnv return linphone_proxy_config_get_expires((LinphoneProxyConfig *) ptr); } +extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setPrivacy(JNIEnv* env,jobject thiz,jlong ptr,jint privacy) { + linphone_proxy_config_set_privacy((LinphoneProxyConfig *) ptr, (int) privacy); +} + +extern "C" jint Java_org_linphone_core_LinphoneProxyConfigImpl_getPrivacy(JNIEnv* env,jobject thiz,jlong ptr) { + return linphone_proxy_config_get_privacy((LinphoneProxyConfig *) ptr); +} + extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) { return (jint)linphone_call_get_duration((LinphoneCall *) ptr); } diff --git a/java/common/org/linphone/core/LinphoneCallParams.java b/java/common/org/linphone/core/LinphoneCallParams.java index b6d5ef33d..530cf63b9 100644 --- a/java/common/org/linphone/core/LinphoneCallParams.java +++ b/java/common/org/linphone/core/LinphoneCallParams.java @@ -93,4 +93,16 @@ public interface LinphoneCallParams { * @return value for the header, or null if it doesn't exist. */ String getCustomHeader(String name); + + /** + * Set the privacy for the call. + * @param privacy_mask a or'd int of values defined in interface {@link org.linphone.core.Privacy} + */ + void setPrivacy(int privacy_mask); + + /** + * Get the privacy mask requested for this call. + * @return the privacy mask as defined in interface {@link org.linphone.core.Privacy} + */ + int getPrivacy(); } diff --git a/java/common/org/linphone/core/LinphoneProxyConfig.java b/java/common/org/linphone/core/LinphoneProxyConfig.java index f06df31b9..8a5da47a8 100644 --- a/java/common/org/linphone/core/LinphoneProxyConfig.java +++ b/java/common/org/linphone/core/LinphoneProxyConfig.java @@ -152,6 +152,19 @@ public interface LinphoneProxyConfig { */ int getExpires(); + /** + * Set the privacy for all calls or chat sessions using the identity exposed by this LinphoneProxyConfig + * @param privacy_mask a or'd int of values defined in interface {@link org.linphone.core.Privacy} + */ + void setPrivacy(int privacy_mask); + + /** + * Get the privacy mask requested for this proxy config. + * @return the privacy mask as defined in interface {@link org.linphone.core.Privacy} + */ + int getPrivacy(); + + /** * Sets parameters for the contact * @param parameters to add diff --git a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java index 83cc95f54..aaafe9186 100644 --- a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java @@ -106,5 +106,17 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public String getCustomHeader(String name) { return getCustomHeader(nativePtr,name); } + + private native void setPrivacy(long nativePtr, int mask); + @Override + public void setPrivacy(int privacy_mask) { + setPrivacy(nativePtr,privacy_mask); + } + + private native int getPrivacy(long nativePtr); + @Override + public int getPrivacy() { + return getPrivacy(nativePtr); + } } diff --git a/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java b/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java index b2e019cb4..dfa9c5170 100644 --- a/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java +++ b/java/impl/org/linphone/core/LinphoneProxyConfigImpl.java @@ -176,4 +176,15 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig { public Reason getError() { return Reason.fromInt(getReason(nativePtr)); } + private native void setPrivacy(long nativePtr, int mask); + @Override + public void setPrivacy(int privacy_mask) { + setPrivacy(nativePtr,privacy_mask); + } + + private native int getPrivacy(long nativePtr); + @Override + public int getPrivacy() { + return getPrivacy(nativePtr); + } } From b9f614744fcb1dfa6628f6a0b8f45b6406522bd8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 9 Dec 2013 13:19:46 +0100 Subject: [PATCH 4/5] fix crash in gtk app when updating sip ports call linphone_call_fix_parameters() when INVITEs and reINVITEs, but not during early-media --- coreapi/callbacks.c | 8 ++++++-- coreapi/linphonecall.c | 3 --- coreapi/linphonecore.c | 4 +++- coreapi/private.h | 2 +- gtk/propertybox.c | 4 +++- tester/call_tester.c | 1 + 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 4c931cc33..da674aac6 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -391,7 +391,10 @@ static void call_accepted(SalOp *op){ } } } - linphone_core_update_streams (lc,call,md); + linphone_core_update_streams(lc,call,md); + /*also reflect the change if the "wished" params, in order to avoid to propose SAVP or video again + * further in the call, for example during pause,resume, conferencing reINVITEs*/ + linphone_call_fix_call_parameters(call); if (!call->current_params.in_conference) lc->current_call=call; linphone_call_set_state(call, LinphoneCallStreamsRunning, "Streams running"); @@ -440,8 +443,9 @@ static void call_accept_update(LinphoneCore *lc, LinphoneCall *call){ linphone_call_update_remote_session_id_and_ver(call); sal_call_accept(call->op); md=sal_call_get_final_media_description(call->op); - if (md && !sal_media_description_empty(md)) + if (md && !sal_media_description_empty(md)){ linphone_core_update_streams(lc,call,md); + } } static void call_resumed(LinphoneCore *lc, LinphoneCall *call){ diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 59ad78c19..908157e48 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1909,9 +1909,6 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut LinphoneMediaEncryptionSRTP : LinphoneMediaEncryptionNone; } - /*also reflect the change if the "wished" params, in order to avoid to propose SAVP or video again - * further in the call, for example during pause,resume, conferencing reINVITEs*/ - linphone_call_fix_call_parameters(call); if ((call->ice_session != NULL) && (ice_session_state(call->ice_session) != IS_Completed)) { ice_session_start_connectivity_checks(call->ice_session); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a2f1def5c..e36410d09 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3087,8 +3087,10 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call) sal_call_set_local_media_description(call->op,call->localdesc); sal_call_accept(call->op); md=sal_call_get_final_media_description(call->op); - if (md && !sal_media_description_empty(md)) + if (md && !sal_media_description_empty(md)){ linphone_core_update_streams (lc,call,md); + linphone_call_fix_call_parameters(call); + } linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); return 0; } diff --git a/coreapi/private.h b/coreapi/private.h index e4ddd59c0..37ff460ae 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -341,7 +341,7 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag void linphone_core_play_tone(LinphoneCore *lc); void linphone_call_init_stats(LinphoneCallStats *stats, int type); - +void linphone_call_fix_call_parameters(LinphoneCall *call); void linphone_call_init_audio_stream(LinphoneCall *call); void linphone_call_init_video_stream(LinphoneCall *call); void linphone_call_init_media_streams(LinphoneCall *call); diff --git a/gtk/propertybox.c b/gtk/propertybox.c index c4dcd72ae..dd6424dac 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1132,15 +1132,17 @@ static void port_config_free(PortConfigCtx *ctx){ g_free(ctx); } -static void apply_transports(PortConfigCtx *ctx){ +static gboolean apply_transports(PortConfigCtx *ctx){ GtkWidget *mw=linphone_gtk_get_main_window(); LCSipTransports tp; LinphoneCore *lc=linphone_gtk_get_core(); linphone_core_get_sip_transports(lc,&tp); tp.udp_port=ctx->tp.udp_port; tp.tcp_port=ctx->tp.tcp_port; + g_message("new transports: %i, %i, %i",(int)tp.udp_port,(int)tp.tcp_port,(int)tp.tls_port); linphone_core_set_sip_transports(lc,&tp); g_object_set_data(G_OBJECT(mw),"port_config",NULL); + return FALSE; } static void transport_changed(GtkWidget *parameters){ diff --git a/tester/call_tester.c b/tester/call_tester.c index 58c72ad20..b166cb86e 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -885,6 +885,7 @@ static void simple_conference(void) { marie_call_laure=linphone_core_get_current_call(marie->lc); + CU_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure); linphone_core_add_to_conference(marie->lc,marie_call_laure); CU_ASSERT_TRUE(wait_for(marie->lc,laure->lc,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1)); From 55af0b6aa58ed9b9a78c97f0a2667fa2a64b6df7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 9 Dec 2013 14:01:02 +0100 Subject: [PATCH 5/5] fix transport selection for outgoing messages when the proxy config selected has sips. --- coreapi/linphonecore.c | 16 +++++----------- gtk/propertybox.c | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e36410d09..5698d2272 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2417,18 +2417,12 @@ static MSList *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneA ret=ms_list_append(ret,sal_address_clone((SalAddress*)srv_route)); } if (ret==NULL){ - /*still no route, so try to build a route from proxy transport + identity host, - *in order to force using the transport required for this proxy, if any.*/ + /*if the proxy address matches the domain part of the destination, then use the same transport + * as the one used for registration. This is done by forcing a route to this proxy.*/ SalAddress *proxy_addr=sal_address_new(linphone_proxy_config_get_addr(proxy)); - const char *transport=sal_address_get_transport_name(proxy_addr); - if (transport){ - SalAddress *route=sal_address_new(NULL); - sal_address_set_domain(route,sal_address_get_domain((SalAddress*)dest)); - sal_address_set_port(route,sal_address_get_port((SalAddress*)dest)); - sal_address_set_transport_name(route,transport); - ret=ms_list_append(ret,route); - } - sal_address_destroy(proxy_addr); + if (strcmp(sal_address_get_domain(proxy_addr),linphone_address_get_domain(dest))==0){ + ret=ms_list_append(ret,proxy_addr); + }else sal_address_destroy(proxy_addr); } return ret; } diff --git a/gtk/propertybox.c b/gtk/propertybox.c index dd6424dac..8579fc2f4 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1139,7 +1139,6 @@ static gboolean apply_transports(PortConfigCtx *ctx){ linphone_core_get_sip_transports(lc,&tp); tp.udp_port=ctx->tp.udp_port; tp.tcp_port=ctx->tp.tcp_port; - g_message("new transports: %i, %i, %i",(int)tp.udp_port,(int)tp.tcp_port,(int)tp.tls_port); linphone_core_set_sip_transports(lc,&tp); g_object_set_data(G_OBJECT(mw),"port_config",NULL); return FALSE;