diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c index f63da1e96..d067a49b8 100644 --- a/libsofia-sip-ua/nta/nta.c +++ b/libsofia-sip-ua/nta/nta.c @@ -565,6 +565,7 @@ struct nta_outgoing_s unsigned orq_must_100rel:1; unsigned orq_timestamp:1; /**< Insert @Timestamp header. */ unsigned orq_100rel:1; /**< Support 100rel */ + unsigned orq_try_other_tp:1; /**< Allow app to disable retry on other protocol (default: enable) */ unsigned:0; /* pad */ #if HAVE_SOFIA_SRESOLV @@ -7952,7 +7953,7 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent, ta_list ta; char const *scheme = NULL; char const *port = NULL; - int invalid, resolved = 0, stateless = 0, user_via = agent->sa_user_via; + int invalid, resolved = 0, stateless = 0, user_via = agent->sa_user_via, retry_other_tp = 1; int invite_100rel = agent->sa_invite_100rel; int explicit_transport = 1; int call_tls_orq_connect_timeout_is_set = 0; @@ -8037,6 +8038,9 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent, call_tls_orq_connect_timeout = t->t_value; if (call_tls_orq_connect_timeout > NTA_TIME_MAX) call_tls_orq_connect_timeout = NTA_TIME_MAX; } + else if (ntatag_retry_other_tp == tt) { + retry_other_tp = t->t_value != 0; + } } orq->orq_agent = agent; @@ -8062,6 +8066,7 @@ nta_outgoing_t *outgoing_create(nta_agent_t *agent, orq->orq_uas = !stateless && agent->sa_is_a_uas; orq->orq_call_tls_connect_timeout_is_set = call_tls_orq_connect_timeout_is_set; orq->orq_call_tls_connect_timeout = (call_tls_orq_connect_timeout > 0) ? call_tls_orq_connect_timeout : 0; + orq->orq_try_other_tp = retry_other_tp; if (cc) orq->orq_cc = nta_compartment_ref(cc); @@ -8404,7 +8409,7 @@ outgoing_send(nta_outgoing_t *orq, int retransmit) if (cc) nta_compartment_decref(&cc); - if (orq->orq_user_tport) + if (orq->orq_user_tport || !orq->orq_try_other_tp) /* No retries */; /* RFC3261, 18.1.1 */ else if (err == EMSGSIZE && !orq->orq_try_tcp_instead) { diff --git a/libsofia-sip-ua/nta/nta_tag.c b/libsofia-sip-ua/nta/nta_tag.c index c877ffb82..349290d59 100644 --- a/libsofia-sip-ua/nta/nta_tag.c +++ b/libsofia-sip-ua/nta/nta_tag.c @@ -1244,6 +1244,16 @@ tag_typedef_t ntatag_tag_3261 = BOOLTAG_TYPEDEF(tag_3261); */ tag_typedef_t ntatag_rel100 = BOOLTAG_TYPEDEF(rel100); +/**@def NTATAG_RETRY_OTHER_TP(x) + * + * Enable or disable retry on other transports + * + * @par x Boolean (0 to disable, 1 to allow retry) + * @default 1 (retry is enabled) + * + */ +tag_typedef_t ntatag_retry_other_tp = BOOLTAG_TYPEDEF(retry_other_tp); + /**@def NTATAG_NO_DIALOG(x) * * Create a leg without dialog. */ @@ -1417,23 +1427,23 @@ tag_typedef_t ntatag_tcp_rport = BOOLTAG_TYPEDEF(tcp_rport); */ tag_typedef_t ntatag_tls_rport = BOOLTAG_TYPEDEF(tls_rport); -/**@def NTATAG_TLS_ORQ_CONNECT_TIMEOUT(x) - * - * Connect Timeout for outgoing requests using TLS. - * - * @par Used with - * nua_create(), nua_set_params(), - * nta_agent_create(), nta_agent_set_params() - * - * @par Parameter type - * unsigned - * - * @par Values +/**@def NTATAG_TLS_ORQ_CONNECT_TIMEOUT(x) + * + * Connect Timeout for outgoing requests using TLS. + * + * @par Used with + * nua_create(), nua_set_params(), + * nta_agent_create(), nta_agent_set_params() + * + * @par Parameter type + * unsigned + * + * @par Values * - 0 - Disabled * - value - Milliseconds * - * @NEW_1_13_2 - */ + * @NEW_1_13_2 + */ tag_typedef_t ntatag_tls_orq_connect_timeout = UINTTAG_TYPEDEF(tls_orq_connect_timeout); /**@def NTATAG_PRELOAD(x) diff --git a/libsofia-sip-ua/nta/sofia-sip/nta_tag.h b/libsofia-sip-ua/nta/sofia-sip/nta_tag.h index 203cb4733..196f637d4 100644 --- a/libsofia-sip-ua/nta/sofia-sip/nta_tag.h +++ b/libsofia-sip-ua/nta/sofia-sip/nta_tag.h @@ -345,6 +345,9 @@ NTA_DLL extern tag_typedef_t ntatag_cancel_487_ref; NTA_DLL extern tag_typedef_t ntatag_rel100; #define NTATAG_REL100(x) ntatag_rel100, tag_bool_v((x)) +NTA_DLL extern tag_typedef_t ntatag_retry_other_tp; +#define NTATAG_RETRY_OTHER_TP(x) ntatag_retry_other_tp, tag_bool_v((x)) + NTA_DLL extern tag_typedef_t ntatag_rel100_ref; #define NTATAG_REL100_REF(x) ntatag_rel100_ref, tag_bool_vr(&(x))