diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 0af4f2e72cdf40e02c3e860255da34ab966eecab..a256122c743afa80e6a3c251ab034a8e86293947 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -666,7 +666,7 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de case LinphoneCallResuming: ms_message("Call error on state [%s], restoring previous state",linphone_call_state_to_string(call->prevstate)); call->reason=linphone_reason_from_sal(sr); - linphone_call_set_state(call, call->prevstate,msg); + linphone_call_set_state(call, call->prevstate,details); return; default: break; /*nothing to do*/ @@ -678,19 +678,14 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de #ifdef BUILD_UPNP linphone_call_delete_upnp_session(call); #endif //BUILD_UPNP - - if (sr == SalReasonDeclined) { - call->reason=LinphoneReasonDeclined; + + call->reason=linphone_reason_from_sal(sr); + if (sr==SalReasonDeclined){ linphone_call_set_state(call,LinphoneCallEnd,"Call declined."); - } else if (sr == SalReasonNotFound) { - call->reason=LinphoneReasonNotFound; - linphone_call_set_state(call,LinphoneCallError,"User not found."); - } else if (sr == SalReasonBusy) { - call->reason=LinphoneReasonBusy; - linphone_call_set_state(call,LinphoneCallError,"User is busy."); - linphone_core_play_named_tone(lc,LinphoneToneBusy); - } else { - linphone_call_set_state(call,LinphoneCallError,msg); + }else{ + linphone_call_set_state(call,LinphoneCallError,details); + if (sr==SalReasonBusy) + linphone_core_play_named_tone(lc,LinphoneToneBusy); } if (referer){ diff --git a/oRTP b/oRTP index e96c55df4436db74656d5feedf3e8fd12adb74e4..b5d1414e63b21c83eb8e26988a3fe423ff8fc3b3 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit e96c55df4436db74656d5feedf3e8fd12adb74e4 +Subproject commit b5d1414e63b21c83eb8e26988a3fe423ff8fc3b3 diff --git a/tester/call_tester.c b/tester/call_tester.c index 38133ee1167c6d1bf9def6aee9b9998189bbd63f..267d2050e6a50a8f3c22ce5a367a3ee6ca1e2502 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -345,6 +345,40 @@ static void cancelled_call(void) { linphone_core_manager_destroy(pauline); } +static void disable_all_codecs_except_one(LinphoneCore *lc, const char *mime){ + const MSList *elem=linphone_core_get_audio_codecs(lc); + PayloadType *pt; + + for(;elem!=NULL;elem=elem->next){ + pt=(PayloadType*)elem->data; + linphone_core_enable_payload_type(lc,pt,FALSE); + } + pt=linphone_core_find_payload_type(lc,mime,-1,-1); + CU_ASSERT_PTR_NOT_NULL_FATAL(pt); + linphone_core_enable_payload_type(lc,pt,TRUE); +} + +static void call_failed_because_of_codecs(void) { + LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); + LinphoneCall* out_call; + + disable_all_codecs_except_one(marie->lc,"pcmu"); + disable_all_codecs_except_one(pauline->lc,"pcma"); + out_call = linphone_core_invite(pauline->lc,"marie"); + linphone_call_ref(out_call); + CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1)); + + /*flexisip will retain the 415 until the "urgent reply" timeout arrives.*/ + CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,6000)); + CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonMedia); + CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0); + + linphone_call_unref(out_call); + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); +} + static void call_with_dns_time_out(void) { LinphoneCoreManager* marie = linphone_core_manager_new2( "empty_rc", FALSE); LCSipTransports transport = {9773,0,0,0}; @@ -416,7 +450,8 @@ static void early_declined_call(void) { out_call = linphone_core_invite(pauline->lc,"marie"); linphone_call_ref(out_call); - CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1)); + /*wait until flexisip transfers the busy...*/ + CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,33000)); CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallError,1); /* FIXME http://git.linphone.org/mantis/view.php?id=757 @@ -1419,6 +1454,7 @@ test_t call_tests[] = { { "Early cancelled call", early_cancelled_call}, { "Call with DNS timeout", call_with_dns_time_out }, { "Cancelled ringing call", cancelled_ringing_call }, + { "Call failed because of codecs", call_failed_because_of_codecs }, { "Simple call", simple_call }, { "Call with media relay", call_with_media_relay}, { "Simple call compatibility mode", simple_call_compatibility_mode }, diff --git a/tester/presence_tester.c b/tester/presence_tester.c index 3df002b8f4f535cdd4fe250e259b8514db13ac63..d3d0f5fcec180b40d367fb7791b0f66c2ab586bd 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -336,7 +336,7 @@ static void presence_information(void) { test_t presence_tests[] = { { "Simple Subscribe", simple_subscribe }, { "Simple Publish", simple_publish }, - { "Call with Presence", call_with_presence }, + { "Call with presence", call_with_presence }, { "Unsubscribe while subscribing", unsubscribe_while_subscribing }, { "Presence information", presence_information }, { "App managed presence failure", subscribe_failure_handle_by_app },