Commit 9fc721e7 authored by Simon Morlat's avatar Simon Morlat
Browse files

fixes and cleanup

parent a23048a6
...@@ -1751,6 +1751,23 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna ...@@ -1751,6 +1751,23 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
audio_stream_mixed_record_open(call->audiostream,call->params.record_file); audio_stream_mixed_record_open(call->audiostream,call->params.record_file);
call->current_params.record_file=ms_strdup(call->params.record_file); call->current_params.record_file=ms_strdup(call->params.record_file);
} }
/* valid local tags are > 0 */
if (stream->proto == SalProtoRtpSavp) {
local_st_desc=sal_media_description_find_stream(call->localdesc,SalProtoRtpSavp,SalAudio);
crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, stream->crypto_local_tag);
if (crypto_idx >= 0) {
audio_stream_enable_srtp(
call->audiostream,
stream->crypto[0].algo,
local_st_desc->crypto[crypto_idx].master_key,
stream->crypto[0].master_key);
call->audiostream_encrypted=TRUE;
} else {
ms_warning("Failed to find local crypto algo with tag: %d", stream->crypto_local_tag);
call->audiostream_encrypted=FALSE;
}
}else call->audiostream_encrypted=FALSE;
audio_stream_start_full( audio_stream_start_full(
call->audiostream, call->audiostream,
call->audio_profile, call->audio_profile,
...@@ -1779,23 +1796,6 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna ...@@ -1779,23 +1796,6 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
} }
audio_stream_set_rtcp_information(call->audiostream, cname, rtcp_tool); audio_stream_set_rtcp_information(call->audiostream, cname, rtcp_tool);
/* valid local tags are > 0 */
if (stream->proto == SalProtoRtpSavp) {
local_st_desc=sal_media_description_find_stream(call->localdesc,SalProtoRtpSavp,SalAudio);
crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, stream->crypto_local_tag);
if (crypto_idx >= 0) {
audio_stream_enable_srtp(
call->audiostream,
stream->crypto[0].algo,
local_st_desc->crypto[crypto_idx].master_key,
stream->crypto[0].master_key);
call->audiostream_encrypted=TRUE;
} else {
ms_warning("Failed to find local crypto algo with tag: %d", stream->crypto_local_tag);
call->audiostream_encrypted=FALSE;
}
}else call->audiostream_encrypted=FALSE;
if (call->params.in_conference){ if (call->params.in_conference){
/*transform the graph to connect it to the conference filter */ /*transform the graph to connect it to the conference filter */
mute=stream->dir==SalStreamRecvOnly; mute=stream->dir==SalStreamRecvOnly;
...@@ -1811,6 +1811,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ...@@ -1811,6 +1811,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
#ifdef VIDEO_ENABLED #ifdef VIDEO_ENABLED
LinphoneCore *lc=call->core; LinphoneCore *lc=call->core;
int used_pt=-1; int used_pt=-1;
/* look for savp stream first */ /* look for savp stream first */
const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc, const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpSavp,SalVideo); SalProtoRtpSavp,SalVideo);
...@@ -1831,6 +1832,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ...@@ -1831,6 +1832,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
if (vstream!=NULL && vstream->dir!=SalStreamInactive && vstream->rtp_port!=0) { if (vstream!=NULL && vstream->dir!=SalStreamInactive && vstream->rtp_port!=0) {
const char *rtp_addr=vstream->rtp_addr[0]!='\0' ? vstream->rtp_addr : call->resultdesc->addr; const char *rtp_addr=vstream->rtp_addr[0]!='\0' ? vstream->rtp_addr : call->resultdesc->addr;
const char *rtcp_addr=vstream->rtcp_addr[0]!='\0' ? vstream->rtcp_addr : call->resultdesc->addr; const char *rtcp_addr=vstream->rtcp_addr[0]!='\0' ? vstream->rtcp_addr : call->resultdesc->addr;
const SalStreamDescription *local_st_desc=sal_media_description_find_stream(call->localdesc,vstream->proto,SalVideo);
call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt); call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt);
if (used_pt!=-1){ if (used_pt!=-1){
VideoStreamDir dir=VideoStreamSendRecv; VideoStreamDir dir=VideoStreamSendRecv;
...@@ -1852,7 +1855,10 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ...@@ -1852,7 +1855,10 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
video_stream_use_preview_video_window (call->videostream,lc->use_preview_window); video_stream_use_preview_video_window (call->videostream,lc->use_preview_window);
if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){ if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){
cam=get_nowebcam_device(); if (local_st_desc->dir==SalStreamSendOnly){
/* localdesc stream dir to SendOnly is when we want to put on hold, so use nowebcam in this case*/
cam=get_nowebcam_device();
}
dir=VideoStreamSendOnly; dir=VideoStreamSendOnly;
}else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){ }else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){
dir=VideoStreamRecvOnly; dir=VideoStreamRecvOnly;
...@@ -1872,6 +1878,18 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ...@@ -1872,6 +1878,18 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
cam=get_nowebcam_device(); cam=get_nowebcam_device();
} }
if (!is_inactive){ if (!is_inactive){
if (vstream->proto == SalProtoRtpSavp) {
video_stream_enable_strp(
call->videostream,
vstream->crypto[0].algo,
local_st_desc->crypto[0].master_key,
vstream->crypto[0].master_key
);
call->videostream_encrypted=TRUE;
}else{
call->videostream_encrypted=FALSE;
}
call->log->video_enabled = TRUE; call->log->video_enabled = TRUE;
video_stream_set_direction (call->videostream, dir); video_stream_set_direction (call->videostream, dir);
ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
...@@ -1883,21 +1901,6 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ...@@ -1883,21 +1901,6 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
used_pt, linphone_core_get_video_jittcomp(lc), cam); used_pt, linphone_core_get_video_jittcomp(lc), cam);
video_stream_set_rtcp_information(call->videostream, cname,rtcp_tool); video_stream_set_rtcp_information(call->videostream, cname,rtcp_tool);
} }
if (vstream->proto == SalProtoRtpSavp) {
const SalStreamDescription *local_st_desc=sal_media_description_find_stream(call->localdesc,
SalProtoRtpSavp,SalVideo);
video_stream_enable_strp(
call->videostream,
vstream->crypto[0].algo,
local_st_desc->crypto[0].master_key,
vstream->crypto[0].master_key
);
call->videostream_encrypted=TRUE;
}else{
call->videostream_encrypted=FALSE;
}
}else ms_warning("No video stream accepted."); }else ms_warning("No video stream accepted.");
}else{ }else{
ms_warning("No valid video stream defined."); ms_warning("No valid video stream defined.");
......
...@@ -1263,14 +1263,6 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta ...@@ -1263,14 +1263,6 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
linphone_core_assign_payload_type(lc,&payload_type_telephone_event,101,"0-15"); linphone_core_assign_payload_type(lc,&payload_type_telephone_event,101,"0-15");
linphone_core_assign_payload_type(lc,&payload_type_g722,9,NULL); linphone_core_assign_payload_type(lc,&payload_type_g722,9,NULL);
#if defined(ANDROID) || defined (__IPHONE_OS_VERSION_MIN_REQUIRED)
/*shorten the DNS lookup time and send more retransmissions on mobiles:
- to workaround potential packet losses
- to avoid hanging for 30 seconds when the network doesn't work despite the phone thinks it does.
*/
_linphone_core_configure_resolver();
#endif
#ifdef ENABLE_NONSTANDARD_GSM #ifdef ENABLE_NONSTANDARD_GSM
{ {
PayloadType *pt; PayloadType *pt;
...@@ -1340,7 +1332,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta ...@@ -1340,7 +1332,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
net_config_read(lc); net_config_read(lc);
rtp_config_read(lc); rtp_config_read(lc);
codecs_config_read(lc); codecs_config_read(lc);
sip_config_read(lc); /* this will start eXosip*/ sip_config_read(lc);
video_config_read(lc); video_config_read(lc);
//autoreplier_config_init(&lc->autoreplier_conf); //autoreplier_config_init(&lc->autoreplier_conf);
lc->presence_model=linphone_presence_model_new_with_activity(LinphonePresenceActivityOnline, NULL); lc->presence_model=linphone_presence_model_new_with_activity(LinphonePresenceActivityOnline, NULL);
...@@ -6149,6 +6141,18 @@ void linphone_core_set_srtp_enabled(LinphoneCore *lc, bool_t enabled) { ...@@ -6149,6 +6141,18 @@ void linphone_core_set_srtp_enabled(LinphoneCore *lc, bool_t enabled) {
lp_config_set_int(lc->config,"sip","srtp",(int)enabled); lp_config_set_int(lc->config,"sip","srtp",(int)enabled);
} }
const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc){
switch(menc){
case LinphoneMediaEncryptionSRTP:
return "LinphoneMediaEncryptionSRTP";
case LinphoneMediaEncryptionZRTP:
return "LinphoneMediaEncryptionZRTP";
case LinphoneMediaEncryptionNone:
return "LinphoneMediaEncryptionNone";
}
return "INVALID";
}
/** /**
* Returns whether a media encryption scheme is supported by the LinphoneCore engine * Returns whether a media encryption scheme is supported by the LinphoneCore engine
**/ **/
......
...@@ -316,6 +316,12 @@ enum _LinphoneMediaEncryption { ...@@ -316,6 +316,12 @@ enum _LinphoneMediaEncryption {
**/ **/
typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption; typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption;
/**
* Convert enum member to string.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc);
/*public: */ /*public: */
LINPHONE_PUBLIC LinphoneAddress *linphone_call_log_get_from(LinphoneCallLog *cl); LINPHONE_PUBLIC LinphoneAddress *linphone_call_log_get_from(LinphoneCallLog *cl);
LINPHONE_PUBLIC LinphoneAddress *linphone_call_log_get_to(LinphoneCallLog *cl); LINPHONE_PUBLIC LinphoneAddress *linphone_call_log_get_to(LinphoneCallLog *cl);
......
...@@ -1093,10 +1093,6 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){ ...@@ -1093,10 +1093,6 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
return 0; return 0;
} }
void _linphone_core_configure_resolver(){
}
SalReason linphone_reason_to_sal(LinphoneReason reason){ SalReason linphone_reason_to_sal(LinphoneReason reason){
switch(reason){ switch(reason){
case LinphoneReasonNone: case LinphoneReasonNone:
......
...@@ -945,7 +945,7 @@ static void encrypted_call(LinphoneMediaEncryption mode) { ...@@ -945,7 +945,7 @@ static void encrypted_call(LinphoneMediaEncryption mode) {
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
} else { } else {
ms_warning ("not tested because srtp not available"); ms_warning ("Not tested because %s not available", linphone_media_encryption_to_string(mode));
} }
linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(pauline);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment