diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 2f0d25b0d..1f7ff42fd 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -344,7 +344,7 @@ static void call_accepted(SalOp *op){ linphone_call_set_state(call,LinphoneCallConnected,"Connected"); if (call->referer) linphone_core_notify_refer_state(lc,call->referer,call); } - if (md && !sal_media_description_empty(md)){ + if (md && !sal_media_description_empty(md) && !linphone_core_incompatible_security(lc,md)){ if (sal_media_description_has_dir(md,SalStreamSendOnly) || sal_media_description_has_dir(md,SalStreamInactive)){ if (lc->vtable.display_status){ @@ -393,7 +393,7 @@ static void call_accepted(SalOp *op){ }else{ /*send a bye*/ ms_error("Incompatible SDP offer received in 200Ok, need to abort the call"); - linphone_core_abort_call(lc,call,_("Incompatible, check codecs...")); + linphone_core_abort_call(lc,call,_("Incompatible, check codecs or security settings...")); } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c6fc73590..4a0c3851b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -65,6 +65,7 @@ static void linphone_core_run_hooks(LinphoneCore *lc); static void linphone_core_free_hooks(LinphoneCore *lc); #include "enum.h" + const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc); void linphone_core_get_local_ip(LinphoneCore *lc, const char *dest, char *result); static void toggle_video_preview(LinphoneCore *lc, bool_t val); @@ -2549,6 +2550,19 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){ return FALSE; } +bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md){ + if (linphone_core_is_media_encryption_mandatory(lc) && linphone_core_get_media_encryption(lc)==LinphoneMediaEncryptionSRTP){ + int i; + for(i=0;instreams;i++){ + SalStreamDescription *sd=&md->streams[i]; + if (sd->proto!=SalProtoRtpSavp){ + return TRUE; + } + } + } + return FALSE; +} + void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ char *barmesg; char *tmp; @@ -2560,10 +2574,12 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc); md=sal_call_get_final_media_description(call->op); - if (md && sal_media_description_empty(md)){ - sal_call_decline(call->op,SalReasonMedia,NULL); - linphone_call_unref(call); - return; + if (md){ + if (sal_media_description_empty(md) || linphone_core_incompatible_security(lc,md)){ + sal_call_decline(call->op,SalReasonMedia,NULL); + linphone_call_unref(call); + return; + } } from_parsed=linphone_address_new(sal_op_get_from(call->op)); diff --git a/coreapi/private.h b/coreapi/private.h index c171fac88..29d31b7c6 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -299,6 +299,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call); int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call); void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call); void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call); +bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md); extern SalCallbacks linphone_sal_callbacks; void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error); bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc); diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 9e32e29c7..130b7e7c5 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -216,10 +216,10 @@ Set Maximum Transmission Unit: - False True True False + False True @@ -256,10 +256,10 @@ Send DTMFs as SIP info - False True True False + False True @@ -272,11 +272,11 @@ Use IPv6 instead of IPv4 - False True True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -324,7 +324,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 + 7 2 @@ -364,7 +364,7 @@ 3 - 4 + 5 @@ -380,30 +380,20 @@ 4 - - - False - Tunnel - - - 5 - 6 - - gtk-edit - False True True + False True 1 2 - 5 - 6 + 6 + 7 @@ -439,25 +429,25 @@ DSCP fields - 4 - 5 + 5 + 6 gtk-edit - False True True True + False True 1 2 - 4 - 5 + 5 + 6 @@ -506,10 +496,10 @@ Fixed - False True True False + False True @@ -573,10 +563,10 @@ Fixed - False True True False + False True @@ -594,6 +584,33 @@ 3 + + + False + Tunnel + + + 6 + 7 + + + + + Media encryption is mandatory + True + True + False + False + True + + + + 1 + 2 + 4 + 5 + + @@ -628,10 +645,10 @@ Direct connection to the Internet - False True True False + False True True @@ -649,10 +666,10 @@ Behind NAT / Firewall (specify gateway IP below) - False True True False + False True True no_nat @@ -717,10 +734,10 @@ Behind NAT / Firewall (use STUN to resolve) - False True True False + False True no_nat @@ -734,10 +751,10 @@ Behind NAT / Firewall (use ICE) - False True True False + False True no_nat @@ -875,9 +892,6 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 6 2 - - - True @@ -899,11 +913,11 @@ gtk-media-play - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -1076,10 +1090,10 @@ Enable echo cancellation - False True True False + False True @@ -1090,6 +1104,9 @@ 6 + + + @@ -1425,10 +1442,10 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True True True + False @@ -1472,11 +1489,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1520,11 +1537,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1568,11 +1585,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1661,11 +1678,11 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1847,11 +1864,11 @@ gtk-go-up - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -1864,11 +1881,11 @@ gtk-go-down - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False True @@ -1880,11 +1897,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -1928,11 +1945,11 @@ - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False @@ -2095,10 +2112,10 @@ Enable adaptive rate control - False True True False + False 0 True @@ -2124,7 +2141,7 @@ 2 3 GTK_FILL - + @@ -2250,10 +2267,10 @@ Show advanced settings - False True True False + False True @@ -2330,11 +2347,11 @@ end - False True True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 90b2bf947..ea0095fca 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -880,19 +880,35 @@ void linphone_gtk_ui_level_toggled(GtkWidget *w) { linphone_gtk_ui_level_adapt(top); } +static void linphone_gtk_set_media_encryption_mandatory_sensitive(GtkWidget *propbox, gboolean val){ + GtkWidget *w=linphone_gtk_get_widget(propbox,"media_encryption_mandatory"); + gtk_widget_set_sensitive(w,val); +} + static void linphone_gtk_media_encryption_changed(GtkWidget *combo){ char *selected=gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo)); LinphoneCore *lc=linphone_gtk_get_core(); + GtkWidget *toplevel=gtk_widget_get_toplevel(combo); if (selected!=NULL){ - if (strcasecmp(selected,"SRTP")==0) + if (strcasecmp(selected,"SRTP")==0){ linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionSRTP); - else if (strcasecmp(selected,"ZRTP")==0) + linphone_gtk_set_media_encryption_mandatory_sensitive(toplevel,TRUE); + }else if (strcasecmp(selected,"ZRTP")==0){ linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionZRTP); - else linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionNone); + linphone_gtk_set_media_encryption_mandatory_sensitive(toplevel,FALSE); + } + else { + linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionNone); + linphone_gtk_set_media_encryption_mandatory_sensitive(toplevel,FALSE); + } g_free(selected); }else g_warning("gtk_combo_box_get_active_text() returned NULL"); } +void linphone_gtk_set_media_encryption_mandatory(GtkWidget *button){ + linphone_core_set_media_encryption_mandatory(linphone_gtk_get_core(),gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))); +} + static void linphone_gtk_show_media_encryption(GtkWidget *pb){ LinphoneCore *lc=linphone_gtk_get_core(); GtkWidget *combo=linphone_gtk_get_widget(pb,"media_encryption_combo"); @@ -928,21 +944,30 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){ /*hide this setting*/ gtk_widget_hide(combo); gtk_widget_hide(linphone_gtk_get_widget(pb,"media_encryption_label")); + gtk_widget_hide(linphone_gtk_get_widget(pb,"media_encryption_mandatory")); }else{ LinphoneMediaEncryption menc=linphone_core_get_media_encryption(lc); switch(menc){ case LinphoneMediaEncryptionNone: gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0); + linphone_gtk_set_media_encryption_mandatory_sensitive(pb,FALSE); break; case LinphoneMediaEncryptionSRTP: - if (srtp_id!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),srtp_id); + if (srtp_id!=-1) { + gtk_combo_box_set_active(GTK_COMBO_BOX(combo),srtp_id); + linphone_gtk_set_media_encryption_mandatory_sensitive(pb,TRUE); + } break; case LinphoneMediaEncryptionZRTP: - if (zrtp_id!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),zrtp_id); + if (zrtp_id!=-1) { + gtk_combo_box_set_active(GTK_COMBO_BOX(combo),zrtp_id); + linphone_gtk_set_media_encryption_mandatory_sensitive(pb,FALSE); + } break; } g_signal_connect(G_OBJECT(combo),"changed",(GCallback)linphone_gtk_media_encryption_changed,NULL); } + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"media_encryption_mandatory")),linphone_core_is_media_encryption_mandatory(lc)); g_object_unref(G_OBJECT(model)); } diff --git a/mediastreamer2 b/mediastreamer2 index 6874ac86f..1ac1a481d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6874ac86f173b5cf57b87e5ee529652ba6676295 +Subproject commit 1ac1a481d8b8ae72cba1d908b315e5e1f6b0da16