Skip to content

Rtpengine dmq sync#2

Open
vlad-korniiaka-idt wants to merge 5 commits into
masterfrom
rtpengine-dmq-sync
Open

Rtpengine dmq sync#2
vlad-korniiaka-idt wants to merge 5 commits into
masterfrom
rtpengine-dmq-sync

Conversation

@vlad-korniiaka-idt

Copy link
Copy Markdown

Pre-Submission Checklist

  • Commit message has the format required by CONTRIBUTING guide
  • Commits are split per component (core, individual modules, libs, utils, ...)
  • Each component has a single commit (if not, squash them into one commit)
  • Code is formatted with clang-format using the config file .clang-format
    from source code folder
  • No commits to README files for modules (changes must be done to docbook files
    in doc/ subfolder, the README file is autogenerated)

Type Of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)

Checklist:

  • PR should be backported to stable branches
  • Tested changes locally
  • Related to issue #XXXX (replace XXXX with an open issue number)

Description

- implement rtpengine_dmq_request_sync() to broadcast a SYNC request
  to all DMQ peers on startup via JSON DMQ message
- handle RTPENGINE_DMQ_SYNC action in rtpengine_dmq_handle_msg() to
  trigger full local hash table replication when sync is requested
- implement rtpengine_dmq_replicate_sync() to iterate all hash table
  entries and replicate non-expired ones via DMQ INSERT messages
- expose rtpengine_hash_table as non-static in rtpengine_hash.c and
  add extern declaration in rtpengine_hash.h to allow DMQ sync access

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds DMQ-based RTP engine hash-table synchronization so a node can request peers to resend current callid/viabranch mappings during startup or rejoin.

Changes:

  • Exposes the RTP engine hash table through the header and a getter.
  • Adds a DMQ sync request message (RTPENGINE_DMQ_SYNC) and handler path.
  • Adds logic to iterate the local hash table and replicate active entries over DMQ.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/modules/rtpengine/rtpengine_hash.h Exposes hash-table state/API needed by DMQ sync code.
src/modules/rtpengine/rtpengine_hash.c Makes the hash-table symbol externally visible and adds a getter.
src/modules/rtpengine/rtpengine_dmq.c Implements sync request handling and full-table replication over DMQ.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/rtpengine/rtpengine_dmq.c

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/modules/rtpengine/rtpengine_dmq.c
Comment thread src/modules/rtpengine/rtpengine_dmq.c
Comment thread src/modules/rtpengine/rtpengine_hash.h

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment on lines +89 to +93
jdoc.buf.len = strlen(jdoc.buf.s);
LM_DBG("sending serialized data %.*s\n", jdoc.buf.len, jdoc.buf.s);
if(rtpengine_dmq_send(&jdoc.buf, 0) != 0) {
goto error;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked:

  • usrloc has the same behavior:
int usrloc_dmq_request_sync()
{
	if(usrloc_dmq_send(&jdoc.buf, 0) != 0) {
		goto error;
	}
  • dlg_dmq also:
int dlg_dmq_request_sync()
{
...
	if(dlg_dmq_send(&jdoc.buf, 0) != 0) {
		goto error;
	}

Comment on lines +31 to +32
extern struct rtpengine_hash_table *rtpengine_hash_table;



static struct rtpengine_hash_table *rtpengine_hash_table;
struct rtpengine_hash_table *rtpengine_hash_table;
@vlad-korniiaka-idt

vlad-korniiaka-idt commented May 7, 2026

Copy link
Copy Markdown
Author

@stefan-mititelu-idt @n2p-litvinov Thanks for the review.
Made changes: Reply "sync" KDMQ message only to the node that sent it.

Tested:

See .pcap: RTPENG_DMQ_SYNC_ONLY_TO_1.pcap
Can not attach .pcap file to the comment. Use "Download raw file" option please.
image

3 Kamailio nodes:

  • 10.199.240.117 - Kamailio node that handles calls - node A.
  • 10.199.240.119 - Kamailio DMQ node B
  • 10.199.240.147 -  Kamailio DMQ node C
  • 10.199.240.171 - Kamailio DMQ node D - will be restarted.
  1. Node A received the call. See that node A informs Kamailio DMQ node B, C and D about that call.
image
  1. Kamailio DMQ node D 10.199.240.171 restarted.
  2. See that Kamailio DMQ node D 10.199.240.171 sent KDMQ {"action":3}
image
  1. Then Node A sent KDMQ messages about calls only to Kamailio DMQ node D 10.199.240.171, not to all nodes.
image
  1. Then the call ended on Node A, and it send KDMQ to all Kamailio nodes B, C and D
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants