l=ms_list_append(l,pt);
md->streams[0].payloads=l;
- // if ZRTP is enabled, put the hello hash into the audiostream's desc
- if (call->audiostream && call->audiostream->ms.zrtp_context!=NULL){
- ortp_zrtp_get_hello_hash(call->audiostream->ms.zrtp_context,
- md->streams[0].zrtp_hello_hash,
- sizeof(md->streams[0].zrtp_hello_hash));
- ms_message("Audio stream zrtp hash: %s", md->streams[0].zrtp_hello_hash);
- }
-
if (call->params.has_video){
md->n_active_streams++;
md->streams[1].rtp_port=call->video_port;
md->streams[1].type=SalVideo;
l=make_codec_list(lc,lc->codecs_conf.video_codecs,0,NULL,-1);
md->streams[1].payloads=l;
- // if ZRTP is enabled, put the hello hash into the audiostream's desc
- if (call->videostream && call->videostream->ms.zrtp_context!=NULL){
- ortp_zrtp_get_hello_hash(call->videostream->ms.zrtp_context,
- md->streams[1].zrtp_hello_hash,
- sizeof(md->streams[1].zrtp_hello_hash));
- ms_message("Video stream zrtp hash: %s", md->streams[1].zrtp_hello_hash);
- }
}
if (md->n_total_streams < md->n_active_streams)
md->n_total_streams = md->n_active_streams;
void linphone_call_init_media_streams(LinphoneCall *call){
linphone_call_init_audio_stream(call);
linphone_call_init_video_stream(call);
-
- // moved from linphone_call_start_media_streams, because ZRTP needs to be
- // at least partially initialized so that the SDP can contain 'zrtp-hash'
- if (call->params.media_encryption==LinphoneMediaEncryptionZRTP) {
- OrtpZrtpParams params;
- /*will be set later when zrtp is activated*/
- call->current_params.media_encryption=LinphoneMediaEncryptionNone;
-
- params.zid_file=call->core->zrtp_secrets_cache;
- audio_stream_enable_zrtp(call->audiostream,¶ms);
- } else if (call->params.media_encryption==LinphoneMediaEncryptionSRTP){
- call->current_params.media_encryption=linphone_call_are_all_streams_encrypted(call) ?
- LinphoneMediaEncryptionSRTP : LinphoneMediaEncryptionNone;
- }
}
call->playing_ringbacktone=send_ringbacktone;
call->up_bw=linphone_core_get_upload_bandwidth(lc);
- // ZRTP was initialized in linphone_call_init_media_streams with a
- // partially iniitalized RtpSession, and now needs to get an update
if (call->params.media_encryption==LinphoneMediaEncryptionZRTP) {
- ortp_zrtp_start_engine(call->audiostream->ms.zrtp_context,call->audiostream->ms.session);
+ OrtpZrtpParams params;
+ /*will be set later when zrtp is activated*/
+ call->current_params.media_encryption=LinphoneMediaEncryptionNone;
+
+ params.zid_file=lc->zrtp_secrets_cache;
+ audio_stream_enable_zrtp(call->audiostream,¶ms);
+ }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 or video again
sal_call_set_local_media_description(call->op,call->localdesc);
}
- if (call->audiostream==NULL){
+ if (call->audiostream==NULL)
linphone_call_init_media_streams(call);
- // the local media description must be regenerated after the audiostream
- // is initialized, otherwise the ZRTP hello hash will not be available
- linphone_call_make_local_media_description(lc,call);
- sal_call_set_local_media_description(call->op,call->localdesc);
- }
-
if (!was_ringing && call->audiostream->ms.ticker==NULL){
audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard);
}
result->ice_completed = local_cap->ice_completed;
memcpy(result->ice_candidates, local_cap->ice_candidates, sizeof(result->ice_candidates));
memcpy(result->ice_remote_candidates, local_cap->ice_remote_candidates, sizeof(result->ice_remote_candidates));
- memcpy(result->zrtp_hello_hash,local_cap->zrtp_hello_hash, sizeof(result->zrtp_hello_hash));
}
/**
} SalIceRemoteCandidate;
#define SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES 2
-#define SAL_MEDIA_DESCRIPTION_MAX_ZRTP_HELLO_HASH 128
+
#define SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN 256
#define SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN 256
SalIceRemoteCandidate ice_remote_candidates[SAL_MEDIA_DESCRIPTION_MAX_ICE_REMOTE_CANDIDATES];
char ice_ufrag[SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN];
char ice_pwd[SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN];
- char zrtp_hello_hash[SAL_MEDIA_DESCRIPTION_MAX_ZRTP_HELLO_HASH];
bool_t ice_mismatch;
bool_t ice_completed;
} SalStreamDescription;
return 0;
}
-static char * _sdp_message_get_a_zrtp_hash(sdp_message_t *sdp, int mline){
- int i;
- sdp_attribute_t *attr;
- for (i=0;(attr=sdp_message_attribute_get(sdp,mline,i))!=NULL;i++){
- if (keywordcmp("zrtp-hash",attr->a_att_field)==0){
- return attr->a_att_value;
- }
- }
- return NULL;
-}
-
static int _sdp_message_get_mline_dir(sdp_message_t *sdp, int mline){
int i;
sdp_attribute_t *attr;
int_2char(desc->bandwidth));
if (desc->ptime>0) sdp_message_a_attribute_add(msg,lineno,osip_strdup("ptime"),
int_2char(desc->ptime));
-
- // if the ZRTP hello hash is available, create an a attribute for it
- if (desc->zrtp_hello_hash[0])
- sdp_message_a_attribute_add(msg,lineno,osip_strdup("zrtp-hash"), osip_strdup(desc->zrtp_hello_hash));
-
strip_well_known_rtpmaps=ms_list_size(desc->payloads)>5;
if (desc->payloads){
for(elem=desc->payloads;elem!=NULL;elem=elem->next){
int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
int i,j;
- const char *mtype,*proto,*rtp_port,*rtp_addr,*number,*zrtp_info;
+ const char *mtype,*proto,*rtp_port,*rtp_addr,*number;
const char *sess;
sdp_bandwidth_t *sbw=NULL;
sdp_attribute_t *attr;
stream->rtp_port=atoi(rtp_port);
if (stream->rtp_port > 0)
desc->n_active_streams++;
-
- // if the SDP contains a zrtp-hash, add it to the StreamDesc
- zrtp_info = _sdp_message_get_a_zrtp_hash(msg, i);
- if (zrtp_info != NULL)
- strncpy(stream->zrtp_hello_hash, zrtp_info, sizeof(stream->zrtp_hello_hash));
-
+
stream->ptime=_sdp_message_get_a_ptime(msg,i);
if (strcasecmp("audio", mtype) == 0){
stream->type=SalAudio;
for (j = 0; ((attr = sdp_message_attribute_get(msg, i, j)) != NULL); j++) {
if ((keywordcmp("rtcp", attr->a_att_field) == 0) && (attr->a_att_value != NULL)) {
char tmp[256];
- // added bounds check
- int nb = sscanf(attr->a_att_value, "%d IN IP4 %256s", &stream->rtcp_port, tmp);
+ int nb = sscanf(attr->a_att_value, "%d IN IP4 %s", &stream->rtcp_port, tmp);
if (nb == 1) {
/* SDP rtcp attribute only contains the port */
} else if (nb == 2) {
-Subproject commit c702c0ea0e66bbe1f27c79690003d9748b01560f
+Subproject commit dbb75fb00c65ce0102385f235c1da2873e9f6c2e