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);
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();
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);