Browse Source

MT#61371 support changing of to-tag

If we receive an answer from a to-tag that hasn't previously seen and no
corresponding monologue exists (created from a previous offer),
previously we would treat this is a separate and new call branch, create
a brand new monologue and dissociate the previous one. This may lead to
unexpected results as this new monologue has been created without the
same initialisation as was done for the original one, and so may be left
with incorrect or incomplete data (e.g.  SRTP keys, codec information,
interface bindings, etc).

Improve this by treating an unexpected and unseen to-tag as an alias to
the already existing to-tag. Going forward both tags can be used
interchangeably to refer to the same monologue.

Add a flag to suppress this new behaviour, in case some situation is
made worse by it.

Change-Id: Ie8f838eebd50d29d3549031998a2eb1f610b04bb
pull/1884/head
Richard Fuchs 1 year ago
parent
commit
aa4945f6fe
4 changed files with 31 additions and 1 deletions
  1. +9
    -1
      daemon/call.c
  2. +3
    -0
      daemon/call_interfaces.c
  3. +18
    -0
      docs/ng_control_protocol.md
  4. +1
    -0
      include/call_interfaces.h

+ 9
- 1
daemon/call.c View File

@ -4690,6 +4690,7 @@ new_branch:
__C_DBG("create new \"other side\" monologue for viabranch "STR_FORMAT, STR_FMT0(viabranch)); __C_DBG("create new \"other side\" monologue for viabranch "STR_FORMAT, STR_FMT0(viabranch));
os = __monologue_create(call); os = __monologue_create(call);
__monologue_viabranch(os, viabranch); __monologue_viabranch(os, viabranch);
goto finish;
have_dialogue: have_dialogue:
for (unsigned int i = 0; i < ret->medias->len; i++) for (unsigned int i = 0; i < ret->medias->len; i++)
@ -4805,8 +4806,15 @@ static int call_get_dialogue(struct call_monologue *monologues[2], call_t *call,
* if the offer monologue belongs to an unanswered call (empty tag), * if the offer monologue belongs to an unanswered call (empty tag),
* hence `ft->tag` has to be empty at this stage. * hence `ft->tag` has to be empty at this stage.
*/ */
if (!ft || ft->tag.s)
if (!ft)
ft = __monologue_create(call); ft = __monologue_create(call);
else if (ft->tag.s) {
// 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)
ft = __monologue_create(call);
}
tag_setup: tag_setup:
if (ft == tt) if (ft == tt)


+ 3
- 0
daemon/call_interfaces.c View File

@ -1104,6 +1104,9 @@ void call_ng_flags_flags(str *s, unsigned int idx, helper_arg arg) {
case CSH_LOOKUP("nat-wait"): case CSH_LOOKUP("nat-wait"):
out->nat_wait = 1; out->nat_wait = 1;
break; break;
case CSH_LOOKUP("new-branch"):
out->new_branch = 1;
break;
case CSH_LOOKUP("no-codec-renegotiation"): case CSH_LOOKUP("no-codec-renegotiation"):
case CSH_LOOKUP("reuse-codecs"): case CSH_LOOKUP("reuse-codecs"):
out->reuse_codec = 1; out->reuse_codec = 1;


+ 18
- 0
docs/ng_control_protocol.md View File

@ -1028,6 +1028,24 @@ Spaces in each string may be replaced by hyphens.
direction before sending packets out, which could result in an direction before sending packets out, which could result in an
automated firewall block. automated firewall block.
* `new branch`
If *rtpengine* receives an answer from a to-tag that hasn't previously seen
and no corresponding call party is known (created from a previous offer),
previously it would treat this is a separate new call branch, create a
brand new internal call party, and dissociate the previous one. This may
lead to unexpected results as this new call party has been created without
the same initialisation as was done for the original one, and so may be
left with incorrect or incomplete data (e.g. SRTP keys, codec information,
interface bindings, etc).
Improve this by treating an unexpected and unseen to-tag as an alias to the
already existing to-tag. Going forward both tags can then be used
interchangeably to refer to the same monologue.
This flag suppresses this new behaviour, in case some situation is made
worse by it.
* `no port latching` * `no port latching`
Port latching is enabled by default for endpoints which speak Port latching is enabled by default for endpoints which speak


+ 1
- 0
include/call_interfaces.h View File

@ -236,6 +236,7 @@ struct sdp_ng_flags {
pierce_nat:1, pierce_nat:1,
directional:1, directional:1,
fatal:1, fatal:1,
new_branch:1,
/* to_tag is used especially by delete handling */ /* to_tag is used especially by delete handling */
to_tag_flag:1; to_tag_flag:1;
}; };


Loading…
Cancel
Save