]> sjero.net Git - linphone/commitdiff
enforce "media_encryption_mandatory" policy for incoming calls too.
authorSimon Morlat <simon.morlat@linphone.org>
Tue, 15 Jan 2013 10:53:33 +0000 (11:53 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Tue, 15 Jan 2013 10:53:33 +0000 (11:53 +0100)
add toggle button for this into gtk interface.

coreapi/callbacks.c
coreapi/linphonecore.c
coreapi/private.h
gtk/parameters.ui
gtk/propertybox.c
mediastreamer2

index 2f0d25b0d87f8e015cda7b1d84906c32428a6493..1f7ff42fd19636c1c02678b74f7bc70e0cdaca41 100644 (file)
@@ -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..."));
        }
 }
 
index c6fc735907ea7e087eee44d86456680eca728812..4a0c3851bbb8e5ff8ab5f6e784f5b9f856880c1d 100644 (file)
@@ -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;i<md->nstreams;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));
index c171fac883d9382a73cab429327787fbf4b2e8d4..29d31b7c6f62260c5534df2c34d238a17f11e7da 100644 (file)
@@ -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);
index 9e32e29c7e500e2e5534b141027c8fda3626d5d7..130b7e7c5db51bbb9fda99d2de3ac3b1dba58780 100644 (file)
                                 <child>
                                   <object class="GtkCheckButton" id="mtu_set">
                                     <property name="label" translatable="yes">Set Maximum Transmission Unit:</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="draw_indicator">True</property>
                                     <signal name="toggled" handler="linphone_gtk_mtu_set" swapped="no"/>
                                   </object>
                             <child>
                               <object class="GtkCheckButton" id="dtmf_sipinfo">
                                 <property name="label" translatable="yes">Send DTMFs as SIP info</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_use_sip_info_dtmf_toggled" swapped="no"/>
                               </object>
                             <child>
                               <object class="GtkCheckButton" id="ipv6_enabled">
                                 <property name="label" translatable="yes">Use IPv6 instead of IPv4</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_ipv6_toggled" swapped="no"/>
                               </object>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="n_rows">6</property>
+                            <property name="n_rows">7</property>
                             <property name="n_columns">2</property>
                             <child>
                               <object class="GtkComboBox" id="proto_combo">
                               </object>
                               <packing>
                                 <property name="top_attach">3</property>
-                                <property name="bottom_attach">4</property>
+                                <property name="bottom_attach">5</property>
                               </packing>
                             </child>
                             <child>
                                 <property name="bottom_attach">4</property>
                               </packing>
                             </child>
-                            <child>
-                              <object class="GtkLabel" id="tunnel_label">
-                                <property name="can_focus">False</property>
-                                <property name="label" translatable="yes">Tunnel</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">5</property>
-                                <property name="bottom_attach">6</property>
-                              </packing>
-                            </child>
                             <child>
                               <object class="GtkButton" id="tunnel_edit_button">
                                 <property name="label">gtk-edit</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_stock">True</property>
                                 <signal name="clicked" handler="linphone_gtk_edit_tunnel" swapped="no"/>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
                                 <property name="right_attach">2</property>
-                                <property name="top_attach">5</property>
-                                <property name="bottom_attach">6</property>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
                               </packing>
                             </child>
                             <child>
                                 <property name="label" translatable="yes">DSCP fields</property>
                               </object>
                               <packing>
-                                <property name="top_attach">4</property>
-                                <property name="bottom_attach">5</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkButton" id="dscp_edit_button">
                                 <property name="label">gtk-edit</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_stock">True</property>
                                 <signal name="clicked" handler="linphone_gtk_dscp_edit" swapped="no"/>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
                                 <property name="right_attach">2</property>
-                                <property name="top_attach">4</property>
-                                <property name="bottom_attach">5</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
                               </packing>
                             </child>
                             <child>
                                 <child>
                                   <object class="GtkCheckButton" id="fixed_audio_port">
                                     <property name="label" translatable="yes">Fixed</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="draw_indicator">True</property>
                                     <signal name="toggled" handler="linphone_gtk_fixed_audio_port_toggle" swapped="no"/>
                                   </object>
                                 <child>
                                   <object class="GtkCheckButton" id="fixed_video_port">
                                     <property name="label" translatable="yes">Fixed</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="draw_indicator">True</property>
                                     <signal name="toggled" handler="linphone_gtk_fixed_video_port_toggle" swapped="no"/>
                                   </object>
                                 <property name="bottom_attach">3</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkLabel" id="tunnel_label">
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Tunnel</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">6</property>
+                                <property name="bottom_attach">7</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="media_encryption_mandatory">
+                                <property name="label" translatable="yes">Media encryption is mandatory</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="draw_indicator">True</property>
+                                <signal name="toggled" handler="linphone_gtk_set_media_encryption_mandatory" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
                         <child>
                           <object class="GtkRadioButton" id="no_nat">
                             <property name="label" translatable="yes">Direct connection to the Internet</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                             <signal name="toggled" handler="linphone_gtk_no_firewall_toggled" swapped="no"/>
                             <child>
                               <object class="GtkRadioButton" id="use_nat_address">
                                 <property name="label" translatable="yes">Behind NAT / Firewall (specify gateway IP below)</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="active">True</property>
                                 <property name="draw_indicator">True</property>
                                 <property name="group">no_nat</property>
                         <child>
                           <object class="GtkRadioButton" id="use_stun">
                             <property name="label" translatable="yes">Behind NAT / Firewall (use STUN to resolve)</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">no_nat</property>
                             <signal name="toggled" handler="linphone_gtk_use_stun_toggled" swapped="no"/>
                         <child>
                           <object class="GtkRadioButton" id="use_ice">
                             <property name="label" translatable="yes">Behind NAT / Firewall (use ICE)</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">no_nat</property>
                             <signal name="toggled" handler="linphone_gtk_use_ice_toggled" swapped="no"/>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="n_rows">6</property>
                             <property name="n_columns">2</property>
-                            <child>
-                              <placeholder/>
-                            </child>
                             <child>
                               <object class="GtkHBox" id="ring_sound_box">
                                 <property name="visible">True</property>
                                 <child>
                                   <object class="GtkButton" id="play_ring">
                                     <property name="label">gtk-media-play</property>
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <property name="use_stock">True</property>
                                     <signal name="clicked" handler="linphone_gtk_play_ring_file" swapped="no"/>
                                   </object>
                             <child>
                               <object class="GtkCheckButton" id="echo_cancelation">
                                 <property name="label" translatable="yes">Enable echo cancellation</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_echo_cancelation_toggled" swapped="no"/>
                               </object>
                                 <property name="bottom_attach">6</property>
                               </packing>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                         </child>
                       </object>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                 <child>
                                   <object class="GtkButton" id="wizard">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_show_assistant" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox5">
                                 </child>
                                 <child>
                                   <object class="GtkButton" id="add_proxy">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_add_proxy" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox14">
                                 </child>
                                 <child>
                                   <object class="GtkButton" id="edit_proxy">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_edit_proxy" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox16">
                                 </child>
                                 <child>
                                   <object class="GtkButton" id="remove_proxy">
-                                    <property name="use_action_appearance">False</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                    <property name="use_action_appearance">False</property>
                                     <signal name="clicked" handler="linphone_gtk_remove_proxy" swapped="no"/>
                                     <child>
                                       <object class="GtkHBox" id="hbox7">
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <child>
                               <object class="GtkButton" id="erase_passwords">
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="use_action_appearance">False</property>
                                 <signal name="clicked" handler="linphone_gtk_clear_passwords" swapped="no"/>
                                 <child>
                                   <object class="GtkHBox" id="hbox18">
                                     <child>
                                       <object class="GtkButton" id="button4">
                                         <property name="label">gtk-go-up</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <property name="use_stock">True</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_up" swapped="no"/>
                                       </object>
                                     <child>
                                       <object class="GtkButton" id="up_codec">
                                         <property name="label">gtk-go-down</property>
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <property name="use_stock">True</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_down" swapped="no"/>
                                       </object>
                                     </child>
                                     <child>
                                       <object class="GtkButton" id="enable_codec">
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_enable" swapped="no"/>
                                         <child>
                                           <object class="GtkHBox" id="hbox8">
                                     </child>
                                     <child>
                                       <object class="GtkButton" id="disable_codec">
-                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                        <property name="use_action_appearance">False</property>
                                         <signal name="clicked" handler="linphone_gtk_codec_disable" swapped="no"/>
                                         <child>
                                           <object class="GtkHBox" id="hbox9">
                             <child>
                               <object class="GtkCheckButton" id="adaptive_rate_control">
                                 <property name="label" translatable="yes">Enable adaptive rate control</property>
-                                <property name="use_action_appearance">False</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="xalign">0</property>
                                 <property name="draw_indicator">True</property>
                                 <signal name="toggled" handler="linphone_gtk_adaptive_rate_control_toggled" swapped="no"/>
                                 <property name="top_attach">2</property>
                                 <property name="bottom_attach">3</property>
                                 <property name="x_options">GTK_FILL</property>
-                                <property name="y_options"/>
+                                <property name="y_options"></property>
                               </packing>
                             </child>
                           </object>
                         <child>
                           <object class="GtkCheckButton" id="ui_level">
                             <property name="label" translatable="yes">Show advanced settings</property>
-                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="draw_indicator">True</property>
                             <signal name="toggled" handler="linphone_gtk_ui_level_toggled" swapped="no"/>
                           </object>
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="button5">
-                <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="use_action_appearance">False</property>
                 <signal name="clicked" handler="linphone_gtk_parameters_closed" swapped="no"/>
                 <child>
                   <object class="GtkHBox" id="hbox3">
index 90b2bf94742aa7c277bb51338b76a607f5d910b7..ea0095fcaf33582bb2c8ad186a32b2381fde3438 100644 (file)
@@ -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));
 }
 
index 6874ac86f173b5cf57b87e5ee529652ba6676295..1ac1a481d8b8ae72cba1d908b315e5e1f6b0da16 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 6874ac86f173b5cf57b87e5ee529652ba6676295
+Subproject commit 1ac1a481d8b8ae72cba1d908b315e5e1f6b0da16