fixes for sRTP support

This commit is contained in:
Simon Morlat 2011-11-21 22:25:23 +01:00
parent 0d04b9451b
commit 7c514d326b
4 changed files with 23 additions and 11 deletions

View file

@ -1126,10 +1126,6 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
setup_ring_player(lc,call);
}
audio_stream_set_rtcp_information(call->audiostream, cname, LINPHONE_RTCP_SDES_TOOL);
if (call->params.in_conference){
/*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,
@ -1139,8 +1135,14 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
call->audiostream,
stream->crypto[0].algo,
local_st_desc->crypto[0].master_key,
stream->crypto[0].master_key);
stream->crypto[0].master_key);
call->audiostream_encrypted=TRUE;
}else call->audiostream_encrypted=FALSE;
if (call->params.in_conference){
/*transform the graph to connect it to the conference filter */
linphone_call_add_to_conf(call);
}
call->current_params.in_conference=call->params.in_conference;
}else ms_warning("No audio stream accepted ?");
}
}
@ -1223,7 +1225,10 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
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{
@ -1247,7 +1252,6 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
ms_fatal("start_media_stream() called without prior init !");
return;
}
call->current_params = call->params;
cname=linphone_address_as_string_uri_only(me);
#if defined(VIDEO_ENABLED)
@ -1272,6 +1276,12 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
params.zid_file=lc->zrtp_secrets_cache;
audio_stream_enable_zrtp(call->audiostream,&params);
}else if (call->params.media_encryption==LinphoneMediaEncryptionSRTP){
call->current_params.media_encryption=linphone_call_are_all_streams_encrypted(call) ?
LinphoneMediaEncryptionSRTP : LinphoneMediaEncryptionNone;
/*also reflect the change if the "wished" params, in order to avoid to propose SAVP again
* further in the call, for example during pause,resume, conferencing reINVITEs*/
call->params.media_encryption=call->current_params.media_encryption;
}
goto end;

View file

@ -2498,15 +2498,15 @@ LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc)
*
* @ingroup call_control
**/
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call)
{
LinphoneCall *call = the_call;
const char *subject=NULL;
if (call->state!=LinphoneCallStreamsRunning && call->state!=LinphoneCallPausedByRemote){
ms_warning("Cannot pause this call, it is not active.");
return -1;
}
update_local_media_description(lc,call,&call->localdesc);
if (sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv)){
sal_media_description_set_dir(call->localdesc,SalStreamSendOnly);
subject="Call on hold";
@ -2517,6 +2517,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
ms_error("No reason to pause this call, it is already paused or inactive.");
return -1;
}
sal_call_set_local_media_description(call->op,call->localdesc);
if (sal_call_update(call->op,subject) != 0){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Could not pause the call"));

View file

@ -301,6 +301,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities
result->streams[i].dir=SalStreamInactive;
result->streams[i].port=0;
result->streams[i].type=rs->type;
result->streams[i].proto=rs->proto;
if (rs->type==SalOther){
strncpy(result->streams[i].typeother,rs->typeother,sizeof(rs->typeother)-1);
}

View file

@ -443,10 +443,10 @@ void linphone_gtk_in_call_view_show_encryption(LinphoneCall *call){
bool_t verified=linphone_call_get_authentication_token_verified(call);
switch(me){
case LinphoneMediaEncryptionSRTP:
gtk_widget_show_all(encryption_box);
gtk_label_set_markup(GTK_LABEL(label),_("Secured by SRTP"));
gtk_widget_hide(status_icon);
gtk_widget_hide(verify_button);
gtk_widget_show_all(encryption_box);
break;
case LinphoneMediaEncryptionZRTP:
{
@ -461,7 +461,7 @@ void linphone_gtk_in_call_view_show_encryption(LinphoneCall *call){
}
break;
default:
gtk_widget_hide(encryption_box);
gtk_widget_hide_all(encryption_box);
}
}