diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index 42e636390..482413d6d 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -308,7 +308,7 @@ static void call_process_response(void *op_base, const belle_sip_response_event_ if (code >=200 && code<300) { handle_sdp_from_response(op,response); ack=belle_sip_dialog_create_ack(op->dialog,belle_sip_dialog_get_local_seq_number(op->dialog)); - if (ack==NULL) { + if (ack == NULL) { ms_error("This call has been already terminated."); return ; } @@ -317,6 +317,7 @@ static void call_process_response(void *op_base, const belle_sip_response_event_ belle_sip_object_unref(op->sdp_answer); op->sdp_answer=NULL; } + belle_sip_message_add_header(BELLE_SIP_MESSAGE(ack),BELLE_SIP_HEADER(op->base.root->user_agent)); belle_sip_dialog_send_ack(op->dialog,ack); op->base.root->callbacks.call_accepted(op); /*INVITE*/ op->state=SalOpStateActive; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 1eff5f2da..550c0fb29 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -714,11 +714,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call) { codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL; l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs); - // in case where no audio codec was found for this stream, the audio is disabled - if (l == NULL) { - params->has_audio = FALSE; - } - if (params->has_audio) { + if (params->has_audio && l != NULL) { strncpy(md->streams[call->main_audio_stream_index].rtp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtp_addr)); strncpy(md->streams[call->main_audio_stream_index].rtcp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtcp_addr)); strncpy(md->streams[call->main_audio_stream_index].name,"Audio",sizeof(md->streams[call->main_audio_stream_index].name)-1); @@ -757,15 +753,16 @@ void linphone_call_make_local_media_description(LinphoneCall *call) { md->streams[call->main_video_stream_index].rtcp_mux = rtcp_mux; strncpy(md->streams[call->main_video_stream_index].name,"Video",sizeof(md->streams[call->main_video_stream_index].name)-1); - if (params->has_video){ + codec_hints.bandwidth_limit=0; + codec_hints.max_codecs=-1; + codec_hints.previously_used=old_md ? old_md->streams[call->main_video_stream_index].already_assigned_payloads : NULL; + l=make_codec_list(lc, &codec_hints, SalVideo, lc->codecs_conf.video_codecs); + + if (params->has_video && l != NULL){ strncpy(md->streams[call->main_video_stream_index].rtp_addr,linphone_call_get_public_ip_for_stream(call,call->main_video_stream_index),sizeof(md->streams[call->main_video_stream_index].rtp_addr)); strncpy(md->streams[call->main_video_stream_index].rtcp_addr,linphone_call_get_public_ip_for_stream(call,call->main_video_stream_index),sizeof(md->streams[call->main_video_stream_index].rtcp_addr)); md->streams[call->main_video_stream_index].rtp_port=call->media_ports[call->main_video_stream_index].rtp_port; md->streams[call->main_video_stream_index].rtcp_port=call->media_ports[call->main_video_stream_index].rtcp_port; - codec_hints.bandwidth_limit=0; - codec_hints.max_codecs=-1; - codec_hints.previously_used=old_md ? old_md->streams[call->main_video_stream_index].already_assigned_payloads : NULL; - l=make_codec_list(lc, &codec_hints, SalVideo, lc->codecs_conf.video_codecs); md->streams[call->main_video_stream_index].payloads=l; if (call->videostream && call->videostream->ms.sessions.rtp_session) { char* me = linphone_address_as_string_uri_only(call->me); diff --git a/oRTP b/oRTP index 5208b686f..3c0e10e3a 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 5208b686f0d1abf55d8dcfe84f749ec4878e451c +Subproject commit 3c0e10e3a4ec3e6b69820f890012db8fe3cba6f7 diff --git a/tester/call_tester.c b/tester/call_tester.c index cae7ccaa6..c0e5858c7 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -701,6 +701,99 @@ end: linphone_core_manager_destroy(pauline); } + +static void disable_all_codecs(const MSList* elem, LinphoneCoreManager* call){ + + PayloadType *pt; + + for(;elem!=NULL;elem=elem->next){ + pt=(PayloadType*)elem->data; + linphone_core_enable_payload_type(call->lc,pt,FALSE); + } +} +/*** + Disable all audio codecs , sends an INVITE with RTP port 0 and payload 0. + Wait for SIP 488 unacceptable. + ***/ +static void call_with_no_audio_codec(void){ + + LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc"); + LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc"); + LinphoneCall* out_call ; + + const MSList* elem =linphone_core_get_audio_codecs(caller->lc); + + disable_all_codecs(elem, caller); + + + out_call = linphone_core_invite_address(caller->lc,callee->identity); + linphone_call_ref(out_call); + BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallOutgoingInit, 1)); + + + BC_ASSERT_TRUE(wait_for_until(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallError, 1, 6000)); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d"); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d"); + + linphone_call_unref(out_call); + linphone_core_manager_destroy(callee); + linphone_core_manager_destroy(caller); + +} + +static void video_call_with_no_audio_and_no_video_codec(void){ + + LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc"); + LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTcp) ? "pauline_rc" : "pauline_tcp_rc"); + LinphoneCall* out_call ; + LinphoneVideoPolicy callee_policy, caller_policy; + LinphoneCallTestParams caller_test_params = {0}, callee_test_params = {0}; + + const MSList* elem_video =linphone_core_get_video_codecs(caller->lc); + + const MSList* elem_audio =linphone_core_get_audio_codecs(caller->lc); + + disable_all_codecs(elem_audio, caller); + disable_all_codecs(elem_video, caller); + + callee_policy.automatically_initiate=FALSE; + callee_policy.automatically_accept=TRUE; + caller_policy.automatically_initiate=TRUE; + caller_policy.automatically_accept=FALSE; + + linphone_core_set_video_policy(callee->lc,&callee_policy); + linphone_core_set_video_policy(caller->lc,&caller_policy); + + + linphone_core_enable_video_display(callee->lc, TRUE); + linphone_core_enable_video_capture(callee->lc, TRUE); + + linphone_core_enable_video_display(caller->lc, TRUE); + linphone_core_enable_video_capture(caller->lc, TRUE); + + /* Create call params */ + caller_test_params.base = linphone_core_create_call_params(caller->lc, NULL); + + + out_call = linphone_core_invite_address_with_params(caller->lc, callee->identity,caller_test_params.base); + linphone_call_ref(out_call); + + linphone_call_params_destroy(caller_test_params.base); + if (callee_test_params.base) linphone_call_params_destroy(callee_test_params.base); + + + BC_ASSERT_TRUE(wait_for(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallOutgoingInit, 1)); + + BC_ASSERT_TRUE(wait_for_until(caller->lc, callee->lc, &caller->stat.number_of_LinphoneCallError, 1, 6000)); + BC_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable, int, "%d"); + BC_ASSERT_EQUAL(callee->stat.number_of_LinphoneCallIncomingReceived, 0, int, "%d"); + + linphone_call_unref(out_call); + linphone_core_manager_destroy(callee); + linphone_core_manager_destroy(caller); + +} + static void simple_call_compatibility_mode(void) { char route[256]; LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); @@ -2082,16 +2175,16 @@ void video_call_base_3(LinphoneCoreManager* caller,LinphoneCoreManager* callee, LinphoneCall* callee_call; LinphoneCall* caller_call; - LinphoneVideoPolicy callee_policy, pauline_policy; + LinphoneVideoPolicy callee_policy, caller_policy; if (using_policy) { callee_policy.automatically_initiate=FALSE; callee_policy.automatically_accept=TRUE; - pauline_policy.automatically_initiate=TRUE; - pauline_policy.automatically_accept=FALSE; + caller_policy.automatically_initiate=TRUE; + caller_policy.automatically_accept=FALSE; linphone_core_set_video_policy(callee->lc,&callee_policy); - linphone_core_set_video_policy(caller->lc,&pauline_policy); + linphone_core_set_video_policy(caller->lc,&caller_policy); } linphone_core_enable_video_display(callee->lc, callee_video_enabled); @@ -5031,6 +5124,7 @@ static int rtptm_on_send(RtpTransportModifier *rtptm, mblk_t *msg) { // This is probably a STUN packet, so don't count it (oRTP won't) and don't encrypt it either return (int)msgdsize(msg); } + /*ms_message("rtptm_on_send: rtpm=%p seq=%u", rtptm, (int)ntohs(rtp_get_seqnumber(msg)));*/ data->packetSentCount += 1; ms_queue_put(&data->to_send, dupmsg(msg)); @@ -5170,6 +5264,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) { v_table = linphone_core_v_table_new(); v_table->call_state_changed = call_state_changed_4; linphone_core_add_listener(marie->lc,v_table); + if (recordTest) { // When we do the record test, we need a file player to play the content of a sound file /*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/ @@ -5873,6 +5968,8 @@ test_t call_tests[] = { { "Call established with rejected info during re-invite",call_established_with_rejected_info_during_reinvite}, { "Call redirected by callee", call_redirect}, { "Call with specified codec bitrate", call_with_specified_codec_bitrate}, + { "Call with no audio codec", call_with_no_audio_codec}, + { "Video call with no audio and no video codec", video_call_with_no_audio_and_no_video_codec}, { "Call with in-dialog UPDATE request", call_with_in_dialog_update }, { "Call with in-dialog codec change", call_with_in_dialog_codec_change }, { "Call with in-dialog codec change no sdp", call_with_in_dialog_codec_change_no_sdp },