}
#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;
}
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){
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){
#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);
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);
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;
+ }
++
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);
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
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");
<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>
<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>
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);
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();
}
- Subproject commit 7606207905bd3dc661e68576097adce471916697
-Subproject commit f78246fcce4faa1865d005a3532f878b1bf264cc
++Subproject commit fd6d3f04884a51d20fdd02e0d73b41bb9bd28495