Skip to content

[BUG] rtpengine_delete() with via-branch deletes entire call (missing from-tag in NG delete) #4170

Description

@baevga

Hello OpenSIPS team!

OpenSIPS version you are running

version: opensips 3.6.6 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, F_PARALLEL_MALLOC, DBG_MALLOC, FAST_LOCK-FUTEX-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: 26c0c4e33
main.c compiled on  with gcc 11

Describe the bug
When using rtpengine_delete() with a per-branch via-branch-param (parallel forking), rtpengine tears down the entire call instead of only that branch.

NG delete from OpenSIPS includes call-id and via-branch, but no from-tag. On the rtpengine side that results in full call deletion.
Passing from-tag=... in the delete flags string does not appear in the NG dump either.

To Reproduce

  1. Parallel fork INVITE to 2+ destinations.
  2. On each branch offer, use a unique via-branch, e.g. rtpengine_offer("... via-branch-param=...")
  3. One branch answers; another fails.
  4. On the failed branch: rtpengine_delete("via-branch-param=...")
  5. Check rtpengine NG dump for delete and the following log line.

Expected behavior
Only the media session for that via-branch is removed; the answered branch keeps audio.

NG delete should allow rtpengine to select the branch (in practice that means the delete must identify the branch correctly — in our traces, selective delete worked only when from-tag was present together with the matching via-branch).

Relevant System Logs
Broken (OpenSIPS rtpengine_delete() with only via-branch-param, no from-tag in NG message):

Dump for 'delete': { "call-id": "...", "via-branch": "z9hG4bK-....2", "received-from": [...], "command": "delete" }
Deleting entire call

Working workaround (same call, from-tag passed via blind rtpp_flags + matching via-branch):

rtpengine_delete("rtpp_flags=from-tag=" + $ft + " via-branch-param=" + $var(via_base) + "." + $T_branch_idx);

rtpengine log:

Dump for 'delete' from 10.1.1.5:44443: {
  "rtpp_flags": "from-tag=f7779212",
  "call-id": "lp1pYPWvMylt9qO7hYDpAA..",
  "via-branch": "z9hG4bK-524287-1---6280f370d54b3440.2",
  "received-from": [ "IP4", "10.1.1.55" ],
  "command": "delete"
}
Deleting call branch '' (via-branch 'z9hG4bK-524287-1---6280f370d54b3440.2')
Destroying monologue '' (z9hG4bK-524287-1---6280f370d54b3440.2)

Note: rtpp_flags is not documented in the OpenSIPS rtpengine module README; it works because OpenSIPS forwards unknown keys to rtpengine, and rtpengine parses from-tag from rtpp_flags. Passing from-tag=... directly in the flags string did not put from-tag in the NG dump on delete.

OS/environment information

  • Operating System: Ubuntu 22.04.5 LTS (jammy)
  • OpenSIPS installation: manual

Additional context
Possibly related to commit adfb884 on 3.6 (rtp_relay: do not enforce from_tag for delete command, cherry-pick of 12ed692) — that change looks like it may stop adding from-tag for OP_DELETE, but we are not sure this is the root cause.

OpenSIPS docs describe via-branch for creating one media session per branch and stopping only that session on delete.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions