From 6189d0b315df220885eac5de3d5bbf2d1f2a3b0a Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 28 Oct 2024 09:08:47 -0400 Subject: [PATCH] MT#61372 add explicit support for 18x responses Allow to-tag updates in answers only until a non-provisional response is received. Add a flag to optionally suppress this feature. Change-Id: I67110ede662f618ba5a355500d3d84050e6318cc --- daemon/call.c | 10 +++++++++- daemon/call_interfaces.c | 3 +++ docs/ng_control_protocol.md | 7 +++++++ include/call.h | 2 +- include/call_interfaces.h | 1 + 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index f9f2bafe5..a18059136 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -3005,6 +3005,13 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q * __C_DBG("this="STR_FORMAT" other="STR_FORMAT, STR_FMT(&receiver_ml->tag), STR_FMT(&sender_ml->tag)); + if (flags->opmode == OP_OFFER) + ML_CLEAR(receiver_ml, FINAL_RESPONSE); + else if (flags->opmode == OP_ANSWER && flags->message_type == SIP_REPLY && flags->code >= 200) + ML_SET(sender_ml, FINAL_RESPONSE); + else + ML_CLEAR(sender_ml, FINAL_RESPONSE); + for (__auto_type sp_iter = streams->head; sp_iter; sp_iter = sp_iter->next) { struct stream_params *sp = sp_iter->data; __C_DBG("processing media stream #%u", sp->index); @@ -4812,7 +4819,8 @@ static int call_get_dialogue(struct call_monologue *monologues[2], call_t *call, // Allow an updated/changed to-tag in answers unless the flag to // suppress this feature is set. A changed to-tag will be stored // as a tag alias. - if (!flags || flags->opmode != OP_ANSWER || flags->new_branch) + if (!flags || flags->opmode != OP_ANSWER || flags->new_branch + || (ML_ISSET(ft, FINAL_RESPONSE) && !flags->provisional)) ft = __monologue_create(call); } diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index cad093241..757c7d22b 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1147,6 +1147,9 @@ void call_ng_flags_flags(str *s, unsigned int idx, helper_arg arg) { case CSH_LOOKUP("port-latching"): out->port_latching = 1; break; + case CSH_LOOKUP("provisional"): + out->provisional = 1; + break; case CSH_LOOKUP("record-call"): out->record_call = 1; break; diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index 639c73b7a..758be1599 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -1081,6 +1081,13 @@ Spaces in each string may be replaced by hyphens. Forces *rtpengine* to retain its local ports during a signalling exchange even when the remote endpoint changes its port. +* `provisional` + + Disables special behaviour when operating on a message that was triggered + by a SIP response with a non-provisional (>= 200) status code. + Specifically, setting this flag allows for changed or updated to-tag even + after a final SIP response has been received. + * `record call` Identical to setting `record call` to `on` (see below). diff --git a/include/call.h b/include/call.h index d4b6ecd07..878cd0997 100644 --- a/include/call.h +++ b/include/call.h @@ -219,7 +219,7 @@ enum { #define ML_FLAG_DTMF_INJECTION_ACTIVE 0x00040000 #define ML_FLAG_DETECT_DTMF 0x00080000 #define ML_FLAG_NO_RECORDING 0x00100000 -/* unused 0x00200000 */ +#define ML_FLAG_FINAL_RESPONSE 0x00200000 #define ML_FLAG_BLOCK_SHORT 0x00400000 #define ML_FLAG_BLOCK_MEDIA 0x00800000 #define ML_FLAG_SILENCE_MEDIA 0x01000000 diff --git a/include/call_interfaces.h b/include/call_interfaces.h index a2cbc3822..76227f541 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -237,6 +237,7 @@ struct sdp_ng_flags { directional:1, fatal:1, new_branch:1, + provisional:1, /* to_tag is used especially by delete handling */ to_tag_flag:1; };