From a9e04b22f22d0a85c3128fa27efedc008dc8f0ad Mon Sep 17 00:00:00 2001 From: Ghislain MARY <ghislain.mary@belledonne-communications.com> Date: Mon, 12 Dec 2016 10:50:06 +0100 Subject: [PATCH] Fix "Call with DNS timeout" test. --- coreapi/bellesip_sal/sal_op_call.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index 5d48aa3661..245716eddf 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -144,8 +144,20 @@ static int set_sdp_from_desc(belle_sip_message_t *msg, const SalMediaDescription } static void call_process_io_error(void *user_ctx, const belle_sip_io_error_event_t *event) { - /* Nothing to be done. If the error comes from a connectivity loss, - * the call will be marked as broken, and an attempt to repair it will be done. */ + SalOp *op = (SalOp *)user_ctx; + + if (op->state == SalOpStateTerminated) return; + + if (op->pending_client_trans && (belle_sip_transaction_get_state(BELLE_SIP_TRANSACTION(op->pending_client_trans)) == BELLE_SIP_TRANSACTION_INIT)) { + /* Call terminated very very early, before INVITE is even sent, probably DNS resolution timeout. */ + sal_error_info_set(&op->error_info, SalReasonIOError, 503, "IO error", NULL); + op->base.root->callbacks.call_failure(op); + op->state = SalOpStateTerminating; + call_set_released(op); + } else { + /* Nothing to be done. If the error comes from a connectivity loss, + * the call will be marked as broken, and an attempt to repair it will be done. */ + } } static void process_dialog_terminated(void *ctx, const belle_sip_dialog_terminated_event_t *event) { -- GitLab