Commit ba478b89 authored by Guillaume Beraudo's avatar Guillaume Beraudo

Fix crash on INVITE without SDP.

parent d7cf616e
......@@ -462,6 +462,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){
LinphoneCall *call=ms_new0(LinphoneCall,1);
char *from_str;
const SalMediaDescription *md;
call->dir=LinphoneCallIncoming;
sal_op_set_user_pointer(op,call);
......@@ -484,8 +485,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
linphone_call_init_common(call, from, to);
call->log->call_id=ms_strdup(sal_op_get_call_id(op)); /*must be known at that time*/
linphone_core_init_default_params(lc, &call->params);
md=sal_call_get_remote_media_description(op);
call->params.has_video &= !!lc->video_policy.automatically_accept;
call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(op));
if (md) {
// It is licit to receive an INVITE without SDP
// In this case WE chose the media parameters according to policy.
call->params.has_video &= linphone_core_media_description_contains_video_stream(md);
}
switch (linphone_core_get_firewall_policy(call->core)) {
case LinphonePolicyUseIce:
call->ice_session = ice_session_new();
......
......@@ -2882,8 +2882,11 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
sal_op_set_contact(call->op,contact);
if (params){
const SalMediaDescription *md = sal_call_get_remote_media_description(call->op);
call->params=*params;
call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op));
// There might not be a md if the INVITE was lacking an SDP
// In this case we use the parameters as is.
if (md) call->params.has_video &= linphone_core_media_description_contains_video_stream(md);
call->camera_active=call->params.has_video;
linphone_call_make_local_media_description(lc,call);
sal_call_set_local_media_description(call->op,call->localdesc);
......
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