mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
implement early declined
This commit is contained in:
parent
cea2676afe
commit
ee4a5d6ee4
7 changed files with 63 additions and 11 deletions
|
|
@ -496,7 +496,7 @@ int sal_unlisten_ports(Sal *ctx){
|
|||
return 0;
|
||||
}
|
||||
ortp_socket_t sal_get_socket(Sal *ctx){
|
||||
ms_fatal("sal_get_socket not implemented yet");
|
||||
ms_warning("sal_get_socket is deprecated");
|
||||
return -1;
|
||||
}
|
||||
void sal_set_user_agent(Sal *ctx, const char *user_agent){
|
||||
|
|
@ -612,7 +612,7 @@ const char *sal_get_root_ca(Sal* ctx) {
|
|||
}
|
||||
|
||||
int sal_reset_transports(Sal *ctx){
|
||||
ms_message("reseting transports");
|
||||
ms_message("Reseting transports");
|
||||
belle_sip_provider_clean_channels(ctx->prov);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ static void call_set_released(SalOp* op){
|
|||
op->state=SalOpStateTerminated;
|
||||
op->base.root->callbacks.call_released(op);
|
||||
}
|
||||
static void call_set_released_and_unref(SalOp* op) {
|
||||
call_set_released(op);
|
||||
sal_op_unref(op);
|
||||
}
|
||||
static void call_set_error(SalOp* op,belle_sip_response_t* response){
|
||||
SalError error=SalErrorUnknown;
|
||||
SalReason sr=SalReasonUnknown;
|
||||
|
|
@ -114,6 +118,8 @@ static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminat
|
|||
SalOp* op=(SalOp*)ctx;
|
||||
|
||||
if (op->dialog && op->dialog==belle_sip_dialog_terminated_get_dialog(event)) {
|
||||
belle_sip_transaction_t* trans=belle_sip_dialog_get_last_transaction(op->dialog);
|
||||
|
||||
switch(belle_sip_dialog_get_previous_state(op->dialog)) {
|
||||
case BELLE_SIP_DIALOG_CONFIRMED:
|
||||
if (op->state!=SalOpStateTerminated && op->state!=SalOpStateTerminating) {
|
||||
|
|
@ -122,8 +128,14 @@ static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminat
|
|||
op->state=SalOpStateTerminating;
|
||||
}
|
||||
break;
|
||||
case BELLE_SIP_DIALOG_NULL: {
|
||||
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(trans,belle_sip_server_transaction_t)) {
|
||||
/*call declined very early, no need to notify call release*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
default: {
|
||||
belle_sip_transaction_t* trans=belle_sip_dialog_get_last_transaction(op->dialog);
|
||||
|
||||
belle_sip_response_t* response=belle_sip_transaction_get_response(trans);
|
||||
int code = belle_sip_response_get_status_code(response);
|
||||
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(trans,belle_sip_client_transaction_t)) {
|
||||
|
|
@ -141,8 +153,9 @@ static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminat
|
|||
call_set_error(op,response);
|
||||
}
|
||||
} else {
|
||||
sal_op_ref(op); /*to make sure op is still there when call released is scheduled*/
|
||||
belle_sip_main_loop_do_later(belle_sip_stack_get_main_loop(op->base.root->stack)
|
||||
,(belle_sip_callback_t) call_set_released
|
||||
,(belle_sip_callback_t) call_set_released_and_unref
|
||||
, op);
|
||||
}
|
||||
|
||||
|
|
@ -206,12 +219,17 @@ static void call_response_event(void *op_base, const belle_sip_response_event_t
|
|||
/*nop ?*/
|
||||
}
|
||||
break;
|
||||
} else if (code >= 180) {
|
||||
} else if (code >= 180 && code<300) {
|
||||
handle_sdp_from_response(op,response);
|
||||
op->base.root->callbacks.call_ringing(op);
|
||||
break;
|
||||
} else {
|
||||
/*nop error*/
|
||||
} else if (code>=300){
|
||||
if (dialog_state==BELLE_SIP_DIALOG_NULL) {
|
||||
call_set_error(op,response);
|
||||
break;
|
||||
} else {
|
||||
/*nop let process_dialog_terminated manage error reporting*/
|
||||
}
|
||||
}
|
||||
|
||||
} else if (strcmp("CANCEL",belle_sip_request_get_method(req))==0
|
||||
|
|
|
|||
|
|
@ -2330,7 +2330,6 @@ static MSList *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneA
|
|||
*in order to force using the transport required for this proxy, if any.*/
|
||||
SalAddress *proxy_addr=sal_address_new(linphone_proxy_config_get_addr(proxy));
|
||||
const char *transport=sal_address_get_transport_name(proxy_addr);
|
||||
sal_address_destroy(proxy_addr);
|
||||
if (transport){
|
||||
SalAddress *route=sal_address_new(NULL);
|
||||
sal_address_set_domain(route,sal_address_get_domain((SalAddress*)addr));
|
||||
|
|
@ -2338,6 +2337,7 @@ static MSList *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneA
|
|||
sal_address_set_transport_name(route,transport);
|
||||
ret=ms_list_append(ret,route);
|
||||
}
|
||||
sal_address_destroy(proxy_addr);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -5185,6 +5185,8 @@ void sip_config_uninit(LinphoneCore *lc)
|
|||
ms_list_free(lc->auth_info);
|
||||
lc->auth_info=NULL;
|
||||
|
||||
sal_reset_transports(lc->sal);
|
||||
sal_iterate(lc->sal); /*make sure event are purged*/
|
||||
sal_uninit(lc->sal);
|
||||
lc->sal=NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -320,6 +320,28 @@ static void cancelled_ringing_call(void) {
|
|||
static void early_declined_call(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new(liblinphone_tester_file_prefix, "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(liblinphone_tester_file_prefix, "pauline_rc");
|
||||
linphone_core_set_max_calls(marie->lc,0);
|
||||
LinphoneCallLog* in_call;
|
||||
LinphoneCall* 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_LinphoneCallReleased,1));
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallError,1);
|
||||
CU_ASSERT_EQUAL(ms_list_size(linphone_core_get_call_logs(marie->lc)),1);
|
||||
CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonDeclined);
|
||||
|
||||
if (ms_list_size(linphone_core_get_call_logs(marie->lc))>0) {
|
||||
CU_ASSERT_PTR_NOT_NULL(in_call=(LinphoneCallLog*)(linphone_core_get_call_logs(marie->lc)->data));
|
||||
CU_ASSERT_EQUAL(linphone_call_log_get_status(in_call),LinphoneCallDeclined);
|
||||
}
|
||||
linphone_call_unref(out_call);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void call_declined(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new(liblinphone_tester_file_prefix, "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(liblinphone_tester_file_prefix, "pauline_rc");
|
||||
|
||||
LinphoneCall* in_call;
|
||||
LinphoneCall* out_call = linphone_core_invite(pauline->lc,"marie");
|
||||
|
|
@ -692,6 +714,7 @@ static void call_transfer_existing_call_outgoing_call(void) {
|
|||
|
||||
test_t call_tests[] = {
|
||||
{ "Early declined call", early_declined_call },
|
||||
{ "Call declined", call_declined },
|
||||
{ "Cancelled call", cancelled_call },
|
||||
{ "Call with DNS timeout", call_with_dns_time_out },
|
||||
{ "Cancelled ringing call", cancelled_ringing_call },
|
||||
|
|
|
|||
|
|
@ -35,4 +35,7 @@ enabled=0
|
|||
self_view=0
|
||||
automatically_initiate=0
|
||||
automatically_accept=0
|
||||
device=StaticImage: Static picture
|
||||
device=StaticImage: Static picture
|
||||
|
||||
[sound]
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
|
|
@ -41,4 +41,7 @@ enabled=0
|
|||
self_view=0
|
||||
automatically_initiate=0
|
||||
automatically_accept=0
|
||||
device=StaticImage: Static picture
|
||||
device=StaticImage: Static picture
|
||||
|
||||
[sound]
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
|
|
@ -40,4 +40,7 @@ enabled=0
|
|||
self_view=0
|
||||
automatically_initiate=0
|
||||
automatically_accept=0
|
||||
device=StaticImage: Static picture
|
||||
device=StaticImage: Static picture
|
||||
|
||||
[sound]
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
Loading…
Add table
Reference in a new issue