]> sjero.net Git - linphone/commitdiff
Merge remote-tracking branch 'private/srtp'
authorSimon Morlat <simon.morlat@linphone.org>
Fri, 4 Nov 2011 09:32:08 +0000 (10:32 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Fri, 4 Nov 2011 09:32:08 +0000 (10:32 +0100)
Conflicts:
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/sal_eXosip2.c
java/common/org/linphone/core/LinphoneCore.java
oRTP

12 files changed:
1  2 
coreapi/callbacks.c
coreapi/conference.c
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/linphonecore_jni.cc
coreapi/private.h
coreapi/sal_eXosip2.c
gtk/parameters.ui
gtk/propertybox.c
java/common/org/linphone/core/LinphoneCore.java
oRTP

Simple merge
Simple merge
index dee7a21cc79a7393221dafb1fc99880f5a31bf51,aa121a057b006c9cea582f39cfc7f97e7269feea..918fb18951a5ee4044decdda4d63521b5721178d
@@@ -41,6 -42,27 +42,27 @@@ static MSWebCam *get_nowebcam_device()
  }
  #endif
  
 -      if (crypto_get_random(tmp, key_length)) {
+ static bool_t generate_b64_crypto_key(int key_length, char* key_out) {
+       int b64_size;
+       uint8_t* tmp = (uint8_t*) malloc(key_length);                   
++      if (ortp_crypto_get_random(tmp, key_length)!=0) {
+               ms_error("Failed to generate random key");
+               free(tmp);
+               return FALSE;
+       }
+       
+       b64_size = b64_encode((const char*)tmp, key_length, NULL, 0);
+       if (b64_size == 0) {
+               ms_error("Failed to b64 encode key");
+               free(tmp);
+               return FALSE;
+       }
+       key_out[b64_size] = '\0';
+       b64_encode((const char*)tmp, key_length, key_out, 40);
+       free(tmp);
+       return TRUE;
+ }
  LinphoneCore *linphone_call_get_core(const LinphoneCall *call){
        return call->core;
  }
@@@ -408,7 -442,7 +447,7 @@@ void linphone_call_set_state(LinphoneCa
                if (call->state==LinphoneCallEnd || call->state==LinphoneCallError){
                        if (cstate!=LinphoneCallReleased){
                                ms_warning("Spurious call state change from %s to %s, ignored.",linphone_call_state_to_string(call->state),
--                         linphone_call_state_to_string(cstate));
++                                 linphone_call_state_to_string(cstate));
                                return;
                        }
                }
                }
                if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){
               if (call->reason==LinphoneReasonDeclined){
--                 call->log->status=LinphoneCallDeclined;
--             }
--            linphone_call_set_terminated (call);
++                              call->log->status=LinphoneCallDeclined;
++                      }
++                      linphone_call_set_terminated (call);
+               }
 -        if (cstate == LinphoneCallConnected) {
 -            call->log->status=LinphoneCallSuccess;
 -        }
 -              
++              if (cstate == LinphoneCallConnected) {
++                      call->log->status=LinphoneCallSuccess;
 +              }
-         if (cstate == LinphoneCallConnected) {
-             call->log->status=LinphoneCallSuccess;
-         }
 +
                if (lc->vtable.call_state_changed)
                        lc->vtable.call_state_changed(lc,call,cstate,message);
                if (cstate==LinphoneCallReleased){
@@@ -989,11 -1021,16 +1037,16 @@@ static void linphone_call_start_audio_s
        LinphoneCore *lc=call->core;
        int jitt_comp=lc->rtp_conf.audio_jitt_comp;
        int used_pt=-1;
+       /* look for savp stream first */
        const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
+                                               SalProtoRtpSavp,SalAudio);
+       /* no savp audio stream, use avp */
+       if (!stream)
+               stream=sal_media_description_find_stream(call->resultdesc,
                                                SalProtoRtpAvp,SalAudio);
 -      
 +
        if (stream && stream->dir!=SalStreamInactive && stream->port!=0){
 -              MSSndCard *playcard=lc->sound_conf.lsd_card ? 
 +              MSSndCard *playcard=lc->sound_conf.lsd_card ?
                        lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
                MSSndCard *captcard=lc->sound_conf.capt_sndcard;
                const char *playfile=lc->play_file;
                                /*transform the graph to connect it to the conference filter */
                                linphone_call_add_to_conf(call);
                        }
+                       
+                       if (stream->proto == SalProtoRtpSavp) {
+                               const SalStreamDescription *local_st_desc=sal_media_description_find_stream(call->localdesc,
+                                               SalProtoRtpSavp,SalAudio);
+                                               
+                               audio_stream_enable_strp(
+                                       call->audiostream, 
+                                       stream->crypto[0].algo,
+                                       local_st_desc->crypto[0].master_key,
+                                       stream->crypto[0].master_key);                          
+                       }
                }else ms_warning("No audio stream accepted ?");
 -      }       
 +      }
  }
  
  static void linphone_call_start_video_stream(LinphoneCall *call, const char *cname,bool_t all_inputs_muted){
index 66334ea0f4e3022a7ac8062f6d6bb324dbcf2151,715d0f2c7da7b30731ee5058098edf4e069e8fed..c4b5dbb6e91ea720f2a5234a7d3716b7495ff6be
@@@ -23,6 -23,6 +23,7 @@@ Foundation, Inc., 59 Temple Place - Sui
  #include "private.h"
  
  #include <ortp/telephonyevents.h>
++#include <ortp/zrtp.h>
  #include "mediastreamer2/mediastream.h"
  #include "mediastreamer2/mseventqueue.h"
  #include "mediastreamer2/msvolume.h"
  #endif
  #endif
  
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
  /*#define UNSTANDART_GSM_11K 1*/
  
 +#define ROOT_CA_FILE PACKAGE_DATA_DIR "/linphone/rootca.pem"
 +
  static const char *liblinphone_version=LIBLINPHONE_VERSION;
  static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime);
  static void linphone_core_run_hooks(LinphoneCore *lc);
@@@ -518,12 -518,8 +523,12 @@@ static void sip_config_read(LinphoneCor
                ms_free(contact);
        }
  
 +#ifdef __linux
        sal_root_ca(lc->sal, lp_config_get_string(lc->config,"sip","root_ca", "/etc/ssl/certs"));
 +#else
 +      sal_root_ca(lc->sal, lp_config_get_string(lc->config,"sip","root_ca", ROOT_CA_FILE));
 +#endif
+       
        tmp=lp_config_get_int(lc->config,"sip","guess_hostname",1);
        linphone_core_set_guess_hostname(lc,tmp);
  
@@@ -4363,7 -4333,7 +4368,6 @@@ void linphone_core_set_zrtp_secrets_fil
        lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL;
  }
  
--//                            if (stringUri.equals(call.getRemoteAddress().asStringUriOnly())) {
  const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri) {
        if (uri == NULL) return NULL;
        MSList *calls=lc->calls;
        return NULL;
  }
  
 -enum LinphoneMediaEncryption linphone_core_get_media_encryption(LinphoneCore *lc) {
 +
 +/**
 + * Check if a call will need the sound resources.
 + *
 + * @ingroup call_control
 + * @param lc The LinphoneCore
 +**/
 +bool_t linphone_core_sound_resources_locked(LinphoneCore *lc){
 +      MSList *calls=lc->calls;
 +      while(calls) {
 +              LinphoneCall *c=(LinphoneCall*)calls->data;
 +              calls=calls->next;
 +              switch (c->state) {
 +                      case LinphoneCallOutgoingInit:
 +                      case LinphoneCallOutgoingProgress:
 +                      case LinphoneCallOutgoingRinging:
 +                      case LinphoneCallOutgoingEarlyMedia:
 +                      case LinphoneCallConnected:
 +                      case LinphoneCallRefered:
 +                      case LinphoneCallIncomingEarlyMedia:
 +                      case LinphoneCallUpdated:
 +                              return TRUE;
 +                      default:
 +                              break;
 +              }
 +      }
 +      return FALSE;
 +}
++
+ void linphone_core_set_srtp_enabled(LinphoneCore *lc, bool_t enabled) {
+       lp_config_set_int(lc->config,"sip","srtp",(int)enabled);
+ }
++/**
++ * Returns whether a media encryption scheme is supported by the LinphoneCore engine
++**/
++bool_t linphone_core_media_encryption_supported(const LinphoneCore *lc, LinphoneMediaEncryption menc){
++      switch(menc){
++              case LinphoneMediaEncryptionSRTP:
++                      return ortp_srtp_supported();
++              case LinphoneMediaEncryptionZRTP:
++                      return ortp_zrtp_available();
++              case LinphoneMediaEncryptionNone:
++                      return TRUE;
++      }
++      return FALSE;
++}
++
+ void linphone_core_set_media_encryption(LinphoneCore *lc, enum LinphoneMediaEncryption menc) {
+       if (menc == LinphoneMediaEncryptionSRTP)
+               lp_config_set_string(lc->config,"sip","media_encryption","srtp");
+       else if (menc == LinphoneMediaEncryptionZRTP)
+               lp_config_set_string(lc->config,"sip","media_encryption","zrtp");
+       else
+               lp_config_set_string(lc->config,"sip","media_encryption","none");
+ }
++LinphoneMediaEncryption linphone_core_get_media_encryption(LinphoneCore *lc) {
+       const char* menc = lp_config_get_string(lc->config, "sip", "media_encryption", NULL);
+       
+       if (menc == NULL)
+               return LinphoneMediaEncryptionNone;
+       else if (strcmp(menc, "srtp")==0)
+               return LinphoneMediaEncryptionSRTP;
+       else if (strcmp(menc, "zrtp")==0)
+               return LinphoneMediaEncryptionZRTP;
+       else
+               return LinphoneMediaEncryptionNone;
+ }
+ bool_t linphone_core_is_media_encryption_mandatory(LinphoneCore *lc) {
+       return (bool_t)lp_config_get_int(lc->config, "sip", "media_encryption_mandatory", 0);
+ }
+ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) {
+       lp_config_set_int(lc->config, "sip", "media_encryption_mandatory", (int)m);
+ }
+ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) {
+       params->has_video=linphone_core_video_enabled(lc);
+       params->media_encryption=linphone_core_get_media_encryption(lc);        
+       params->in_conference=FALSE;
+ }
++
index 0f49a4593e561decd055992ab718fc1d9a404971,1697ea87c2aaffeed3f33d33eefa99a61bb7ab0b..f4bb368c61240e1c40ed9ee7b10e1e69fa41ffe8
@@@ -156,8 -156,12 +156,14 @@@ typedef struct _LinphoneCallLog
        struct _LinphoneCore *lc;
  } LinphoneCallLog;
  
+ enum LinphoneMediaEncryption {
+       LinphoneMediaEncryptionNone,
+       LinphoneMediaEncryptionSRTP,
+       LinphoneMediaEncryptionZRTP
+ };
  
++typedef enum LinphoneMediaEncryption LinphoneMediaEncryption;
 +
  /*public: */
  void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up);
  void *linphone_call_log_get_user_pointer(const LinphoneCallLog *cl);
@@@ -1030,9 -1033,24 +1036,29 @@@ float linphone_core_get_conference_loca
  int linphone_core_terminate_conference(LinphoneCore *lc);
  int linphone_core_get_conference_size(LinphoneCore *lc);
  
 +int linphone_core_get_max_calls(LinphoneCore *lc);
 +bool_t linphone_core_sound_resources_locked(LinphoneCore *lc);
 +
++bool_t linphone_core_media_encryption_supported(const LinphoneCore *lc, LinphoneMediaEncryption menc);
++
+ /**
+  * Choose media encryption policy to be used for RTP packets
+  */
+ void linphone_core_set_media_encryption(LinphoneCore *lc, enum LinphoneMediaEncryption menc);
+ enum LinphoneMediaEncryption linphone_core_get_media_encryption(LinphoneCore *lc);
+ bool_t linphone_core_is_media_encryption_mandatory(LinphoneCore *lc);
+ /**
+  * Defines Linphone behaviour when encryption parameters negociation fails on outoing call.
+  * If set to TRUE call will fail; if set to FALSE will resend an INVITE with encryption disabled
+  */
+ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m);
+ /**
+  * Init call params using LinphoneCore's current configuration
+  */
+ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params);
  #ifdef __cplusplus
  }
  #endif
Simple merge
Simple merge
index 772997b6b67b876bcb938ac3fe07b2494454b28d,e4f4547ac82d67349a560ef10bca865cb19b0218..5314bb28160b83b06ce7e4bbda891b710034fe30
@@@ -546,11 -551,11 +552,14 @@@ int sal_call(SalOp *h, const char *from
        sal_op_set_from(h,from);
        sal_op_set_to(h,to);
        sal_exosip_fix_route(h);
 -      err=eXosip_call_build_initial_invite(&invite,to,from,sal_op_get_route(h),"Phone call");
+       
+       h->terminated = FALSE;
++
 +      route = sal_op_get_route(h);
 +      err=eXosip_call_build_initial_invite(&invite,to,from,route,"Phone call");
        if (err!=0){
 -              ms_error("Could not create call.");
 +              ms_error("Could not create call. Error %d (from=%s to=%s route=%s)",
 +                              err, from, to, route);
                return -1;
        }
        osip_message_set_allow(invite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO");
index 3bec2e63ed2fb1be6e368bac06afe80c868f0282,8b43f12aa706d9f3bb660164c0779ca1ea5a4adb..d853a4bb019c8de96f5b4da71747b6ab4ae41305
                          <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                          <property name="left_padding">12</property>
                          <child>
-                           <object class="GtkVBox" id="vbox6">
+                           <object class="GtkTable" id="table1">
                              <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">4</property>
+                             <property name="n_columns">2</property>
                              <child>
-                               <placeholder/>
 -                              <object class="GtkSpinButton" id="video_rtp_port">
++                              <object class="GtkComboBox" id="proto_combo">
+                                 <property name="visible">True</property>
 -                                <property name="can_focus">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="primary_icon_activatable">False</property>
 -                                <property name="secondary_icon_activatable">False</property>
 -                                <property name="primary_icon_sensitive">True</property>
 -                                <property name="secondary_icon_sensitive">True</property>
 -                                <property name="adjustment">adjustment2</property>
 -                                <signal name="value-changed" handler="linphone_gtk_video_port_changed" swapped="no"/>
++                                <property name="can_focus">False</property>
++                                <property name="model">model8</property>
++                                <child>
++                                  <object class="GtkCellRendererText" id="renderer1"/>
++                                  <attributes>
++                                    <attribute name="text">0</attribute>
++                                  </attributes>
++                                </child>
+                               </object>
 -                              <packing>
 -                                <property name="left_attach">1</property>
 -                                <property name="right_attach">2</property>
 -                                <property name="top_attach">3</property>
 -                                <property name="bottom_attach">4</property>
 -                              </packing>
+                             </child>
+                             <child>
 -                              <object class="GtkSpinButton" id="audio_rtp_port">
++                              <object class="GtkSpinButton" id="proto_port">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">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="invisible_char">•</property>
++                                <property name="invisible_char_set">True</property>
+                                 <property name="primary_icon_activatable">False</property>
+                                 <property name="secondary_icon_activatable">False</property>
 -                                <property name="primary_icon_sensitive">True</property>
 -                                <property name="secondary_icon_sensitive">True</property>
 -                                <property name="adjustment">adjustment3</property>
 -                                <signal name="value-changed" handler="linphone_gtk_audio_port_changed" swapped="no"/>
++                                <property name="adjustment">adjustment7</property>
+                               </object>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
 -                                <property name="top_attach">2</property>
 -                                <property name="bottom_attach">3</property>
+                               </packing>
+                             </child>
+                             <child>
 -                              <object class="GtkSpinButton" id="tcp_sip_port">
++                              <object class="GtkSpinButton" id="video_rtp_port">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">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="invisible_char">•</property>
++                                <property name="invisible_char_set">True</property>
+                                 <property name="primary_icon_activatable">False</property>
+                                 <property name="secondary_icon_activatable">False</property>
 -                                <property name="primary_icon_sensitive">True</property>
 -                                <property name="secondary_icon_sensitive">True</property>
 -                                <property name="adjustment">adjustment_tcp_port</property>
 -                                <signal name="value-changed" handler="linphone_gtk_tcp_sip_port_changed" swapped="no"/>
++                                <property name="adjustment">adjustment2</property>
++                                <signal name="value-changed" handler="linphone_gtk_video_port_changed" swapped="no"/>
+                               </object>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
+                                 <property name="top_attach">1</property>
+                                 <property name="bottom_attach">2</property>
+                               </packing>
                              </child>
                              <child>
-                               <object class="GtkTable" id="table1">
 -                              <object class="GtkSpinButton" id="udp_sip_port">
++                              <object class="GtkSpinButton" id="audio_rtp_port">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">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="invisible_char">•</property>
++                                <property name="invisible_char_set">True</property>
+                                 <property name="primary_icon_activatable">False</property>
+                                 <property name="secondary_icon_activatable">False</property>
 -                                <property name="primary_icon_sensitive">True</property>
 -                                <property name="secondary_icon_sensitive">True</property>
 -                                <property name="adjustment">adjustment4</property>
 -                                <signal name="value-changed" handler="linphone_gtk_udp_sip_port_changed" swapped="no"/>
++                                <property name="adjustment">adjustment3</property>
++                                <signal name="value-changed" handler="linphone_gtk_audio_port_changed" swapped="no"/>
+                               </object>
+                               <packing>
+                                 <property name="left_attach">1</property>
+                                 <property name="right_attach">2</property>
++                                <property name="top_attach">2</property>
++                                <property name="bottom_attach">3</property>
+                               </packing>
+                             </child>
+                             <child>
+                               <object class="GtkLabel" id="label7">
                                  <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">3</property>
-                                 <property name="n_columns">2</property>
-                                 <child>
-                                   <object class="GtkComboBox" id="proto_combo">
-                                     <property name="visible">True</property>
-                                     <property name="can_focus">False</property>
-                                     <property name="model">model8</property>
-                                     <child>
-                                       <object class="GtkCellRendererText" id="renderer1"/>
-                                       <attributes>
-                                         <attribute name="text">0</attribute>
-                                       </attributes>
-                                     </child>
-                                   </object>
-                                 </child>
-                                 <child>
-                                   <object class="GtkSpinButton" id="proto_port">
-                                     <property name="visible">True</property>
-                                     <property name="can_focus">True</property>
-                                     <property name="invisible_char">•</property>
-                                     <property name="invisible_char_set">True</property>
-                                     <property name="primary_icon_activatable">False</property>
-                                     <property name="secondary_icon_activatable">False</property>
-                                     <property name="adjustment">adjustment7</property>
-                                   </object>
-                                   <packing>
-                                     <property name="left_attach">1</property>
-                                     <property name="right_attach">2</property>
-                                   </packing>
-                                 </child>
-                                 <child>
-                                   <object class="GtkSpinButton" id="video_rtp_port">
-                                     <property name="visible">True</property>
-                                     <property name="can_focus">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="invisible_char">•</property>
-                                     <property name="invisible_char_set">True</property>
-                                     <property name="primary_icon_activatable">False</property>
-                                     <property name="secondary_icon_activatable">False</property>
-                                     <property name="adjustment">adjustment2</property>
-                                     <signal name="value-changed" handler="linphone_gtk_video_port_changed" swapped="no"/>
-                                   </object>
-                                   <packing>
-                                     <property name="left_attach">1</property>
-                                     <property name="right_attach">2</property>
-                                     <property name="top_attach">1</property>
-                                     <property name="bottom_attach">2</property>
-                                   </packing>
-                                 </child>
-                                 <child>
-                                   <object class="GtkSpinButton" id="audio_rtp_port">
-                                     <property name="visible">True</property>
-                                     <property name="can_focus">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="invisible_char">•</property>
-                                     <property name="invisible_char_set">True</property>
-                                     <property name="primary_icon_activatable">False</property>
-                                     <property name="secondary_icon_activatable">False</property>
-                                     <property name="adjustment">adjustment3</property>
-                                     <signal name="value-changed" handler="linphone_gtk_audio_port_changed" swapped="no"/>
-                                   </object>
-                                   <packing>
-                                     <property name="left_attach">1</property>
-                                     <property name="right_attach">2</property>
-                                     <property name="top_attach">2</property>
-                                     <property name="bottom_attach">3</property>
-                                   </packing>
-                                 </child>
-                                 <child>
-                                   <object class="GtkLabel" id="label7">
-                                     <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="label" translatable="yes">Video RTP/UDP:</property>
-                                     <property name="justify">right</property>
-                                   </object>
-                                   <packing>
-                                     <property name="top_attach">1</property>
-                                     <property name="bottom_attach">2</property>
-                                   </packing>
-                                 </child>
-                                 <child>
-                                   <object class="GtkLabel" id="label6">
-                                     <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="label" translatable="yes">Audio RTP/UDP:</property>
-                                     <property name="justify">right</property>
-                                   </object>
-                                   <packing>
-                                     <property name="top_attach">2</property>
-                                     <property name="bottom_attach">3</property>
-                                   </packing>
-                                 </child>
+                                 <property name="label" translatable="yes">Video RTP/UDP:</property>
+                                 <property name="justify">right</property>
                                </object>
                                <packing>
-                                 <property name="expand">True</property>
-                                 <property name="fill">True</property>
-                                 <property name="position">1</property>
 -                                <property name="top_attach">3</property>
 -                                <property name="bottom_attach">4</property>
++                                <property name="top_attach">1</property>
++                                <property name="bottom_attach">2</property>
+                               </packing>
+                             </child>
+                             <child>
+                               <object class="GtkLabel" id="label6">
+                                 <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="label" translatable="yes">Audio RTP/UDP:</property>
+                                 <property name="justify">right</property>
+                               </object>
+                               <packing>
+                                 <property name="top_attach">2</property>
+                                 <property name="bottom_attach">3</property>
+                               </packing>
+                             </child>
+                             <child>
 -                              <object class="GtkLabel" id="label_tcp_port">
++                              <object class="GtkLabel" id="media_encryption_label">
+                                 <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="label" translatable="yes">SIP (TCP):</property>
 -                                <property name="justify">right</property>
++                                <property name="label" translatable="yes">Media encryption type</property>
+                               </object>
+                               <packing>
 -                                <property name="top_attach">1</property>
 -                                <property name="bottom_attach">2</property>
++                                <property name="top_attach">3</property>
++                                <property name="bottom_attach">4</property>
+                               </packing>
+                             </child>
+                             <child>
 -                              <object class="GtkLabel" id="label5">
++                              <object class="GtkComboBoxText" id="media_encryption_combo">
+                                 <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="label" translatable="yes">SIP (UDP):</property>
 -                                <property name="justify">right</property>
++                                <property name="active">0</property>
++                                <items>
++                                  <item translatable="yes">None</item>
++                                </items>
+                               </object>
++                              <packing>
++                                <property name="left_attach">1</property>
++                                <property name="right_attach">2</property>
++                                <property name="top_attach">3</property>
++                                <property name="bottom_attach">4</property>
 +                              </packing>
                              </child>
                            </object>
                          </child>
                                      <property name="visible">True</property>
                                      <property name="can_focus">True</property>
                                      <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
++                                    <child internal-child="selection">
++                                      <object class="GtkTreeSelection" id="treeview-selection1"/>
++                                    </child>
                                    </object>
                                  </child>
                                </object>
@@@ -1620,6 -1631,6 +1636,9 @@@ virtual network !</property
                                          <property name="can_focus">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="has_tooltip">True</property>
++                                        <child internal-child="selection">
++                                          <object class="GtkTreeSelection" id="treeview-selection2"/>
++                                        </child>
                                        </object>
                                      </child>
                                    </object>
index c7c3d7cd7abd771d136e229897791c66e5ae8292,625fd8293a035f94303364e350d7f6922cfe8f87..aece58048600ea0cc3e0cd5cc3ef525df797dae5
@@@ -803,6 -765,6 +803,56 @@@ void linphone_gtk_ui_level_toggled(GtkW
        linphone_gtk_ui_level_adapt(top);
  }
  
++static void linphone_gtk_media_encryption_changed(GtkWidget *combo){
++      const char *selected=gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
++      LinphoneCore *lc=linphone_gtk_get_core();
++      if (selected!=NULL){
++              if (strcasecmp(selected,"SRTP")==0)
++                      linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionSRTP);
++              else if (strcasecmp(selected,"ZRTP")==0)
++                      linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionZRTP);
++              else linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionNone);
++      }else g_warning("gtk_combo_box_get_active_text() returned NULL");
++}
++
++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");
++      bool_t no_enc=TRUE;
++      int srtp_id=-1,zrtp_id=-1;
++
++      if (linphone_core_media_encryption_supported(lc,LinphoneMediaEncryptionSRTP)){
++              gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo),_("SRTP"));
++              srtp_id=1;
++              no_enc=FALSE;
++      }
++      if (linphone_core_media_encryption_supported(lc,LinphoneMediaEncryptionZRTP)){
++              gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo),_("ZRTP"));
++              no_enc=FALSE;
++              if (srtp_id!=-1) zrtp_id=2;
++              else zrtp_id=1;
++      }
++      if (no_enc){
++              /*hide this setting*/
++              gtk_widget_hide(combo);
++              gtk_widget_hide(linphone_gtk_get_widget(pb,"media_encryption_label"));
++      }else{
++              LinphoneMediaEncryption menc=linphone_core_get_media_encryption(lc);
++              switch(menc){
++                      case LinphoneMediaEncryptionNone:
++                              gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
++                      break;
++                      case LinphoneMediaEncryptionSRTP:
++                              if (srtp_id!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),srtp_id);
++                      break;
++                      case LinphoneMediaEncryptionZRTP:
++                              if (zrtp_id!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),zrtp_id);
++                      break;
++              }
++              g_signal_connect(G_OBJECT(combo),"changed",(GCallback)linphone_gtk_media_encryption_changed,NULL);
++      }
++}
++
  void linphone_gtk_show_parameters(void){
        GtkWidget *pb=linphone_gtk_create_window("parameters");
        LinphoneCore *lc=linphone_gtk_get_core();
                                linphone_core_get_audio_port(lc));
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")),
                                linphone_core_get_video_port(lc));
 +
++      linphone_gtk_show_media_encryption(pb);
++      
        tmp=linphone_core_get_nat_address(lc);
        if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"nat_address")),tmp);
        tmp=linphone_core_get_stun_server(lc);
index fcd041dc8a6c5745fef27c0abd5d7ce0aee72f0b,3e30414dbd18dbe9c358fbbf04a7a8155596da84..0bea6f60c4d1ffefcf2d611b90b29a466c31600c
@@@ -621,17 -621,24 +621,35 @@@ public interface LinphoneCore 
        void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination);
  
        LinphoneCall findCallFromUri(String uri);
 -      
 +
 +      int getMaxCalls();
 +      boolean isMyself(String uri);
 +
 +      /**
 +       * Use this method to check the calls state and forbid proposing actions
 +       * which could result in an active call.
 +       * Eg: don't start a new call if one is in outgoing ringing.
 +       * Eg: don't merge to conference either as it could result
 +       *     in two active calls (conference and accepted call). 
 +       * @return
 +       */
 +      boolean soundResourcesLocked();
+       /**
+        * set media encryption (rtp) to use
+        * @params menc: 'none', 'srtp' or 'zrtp'
+        */
+       void setMediaEncryption(String menc);
+       /**
+        * return selected media encryption
+        * @return 'none', 'srtp' or 'zrtp'
+        */
+       String getMediaEncryption();
 -      
 -      /**
++/**
+        * Set media encryption required for outgoing calls
+        */
+       void setMediaEncryptionMandatory(boolean yesno);
+       /**
+        * @return if media encryption is required for ougtoing calls
+        */
+       boolean isMediaEncryptionMandatory();
  }
diff --cc oRTP
index 7606207905bd3dc661e68576097adce471916697,f78246fcce4faa1865d005a3532f878b1bf264cc..fd6d3f04884a51d20fdd02e0d73b41bb9bd28495
--- 1/oRTP
--- 2/oRTP
+++ b/oRTP
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 7606207905bd3dc661e68576097adce471916697
 -Subproject commit f78246fcce4faa1865d005a3532f878b1bf264cc
++Subproject commit fd6d3f04884a51d20fdd02e0d73b41bb9bd28495