From ccdd5398c7e913ff188f578d58e321f611daefaf Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 25 Jun 2026 11:46:31 -0400 Subject: [PATCH] MT#65392 add ssrc-reporting config option Change-Id: I5ea25c5a6dfb845a0d45d9e41162ef5bc151fe36 --- daemon/call_interfaces.c | 10 ++++++++-- daemon/main.c | 15 +++++++++++++++ docs/rtpengine.md | 19 +++++++++++++++++++ etc/rtpengine.conf | 1 + include/main.h | 9 ++++++++- 5 files changed, 51 insertions(+), 3 deletions(-) diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index b4d55f26a..8d15360a9 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1094,6 +1094,9 @@ static void ng_stats_ssrc_1(const ng_parser_t *parser, parser_arg ent, struct ss static void ng_stats_ssrc(const ng_parser_t *parser, parser_arg dict, parser_arg list, const struct ssrc_hash *ht) { + if (rtpe_config.ssrc_reporting == SRP_NONE) + return; + for (GList *l = ht->nq.head; l; l = l->next) { struct ssrc_entry_call *se = l->data; char tmp[12]; @@ -1103,7 +1106,8 @@ static void ng_stats_ssrc(const ng_parser_t *parser, parser_arg dict, parser_arg parser->dict_add_int(ent, "SSRC", se->h.ssrc); - ng_stats_ssrc_1(parser, ent, se); + if ((rtpe_config.ssrc_reporting & 0x2) == 0) + ng_stats_ssrc_1(parser, ent, se); if (dict.gen && !parser->dict_contains(dict, tmp)) { ent = parser->dict_add_dict_dup(dict, tmp); @@ -1142,7 +1146,9 @@ void ng_call_stats(ng_command_ctx_t *ctx, call_t *call, const str *fromtag, cons if (call->metadata.s) parser->dict_add_str(ctx->resp, "metadata", &call->metadata); - ssrc = parser->dict_add_dict(ctx->resp, "SSRC"); + if ((rtpe_config.ssrc_reporting & 0x1) == 0) + ssrc = parser->dict_add_dict(ctx->resp, "SSRC"); + tags = parser->dict_add_dict(ctx->resp, "tags"); stats: diff --git a/daemon/main.c b/daemon/main.c index 28c4a8309..49a3ae982 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -754,6 +754,7 @@ static void options(int *argc, char ***argv, charp_ht templates) { g_autoptr(char) templates_section = NULL; g_autoptr(char) interfaces_config = NULL; g_autoptr(char) transcode_config = NULL; + g_autoptr(char) ssrc_reporting = NULL; int silent_timeout = 0; int timeout = 0; int final_timeout = 0; @@ -954,6 +955,7 @@ static void options(int *argc, char ***argv, charp_ht templates) { #endif { "mos",0,0, G_OPTION_ARG_STRING_ARRAY,&mos_options, "MOS calculation options", "CQ|LQ"}, { "measure-rtp",0,0, G_OPTION_ARG_NONE, &rtpe_config.measure_rtp,"Enable measuring RTP statistics and VoIP metrics",NULL}, + { "ssrc-reporting",0,0, G_OPTION_ARG_STRING, &ssrc_reporting, "Format of SSRC stats returned by delete/query","full|inline|global|none"}, #ifdef SO_INCOMING_CPU { "socket-cpu-affinity",0,0,G_OPTION_ARG_INT, &rtpe_config.cpu_affinity,"CPU affinity for media sockets","INT"}, #endif @@ -1538,6 +1540,19 @@ static void options(int *argc, char ***argv, charp_ht templates) { die("Invalid --control-pmtu option ('%s')", control_pmtu); } + if (ssrc_reporting) { + if (!strcasecmp(ssrc_reporting, "full")) + rtpe_config.ssrc_reporting = SRP_FULL; + else if (!strcasecmp(ssrc_reporting, "inline")) + rtpe_config.ssrc_reporting = SRP_INLINE; + else if (!strcasecmp(ssrc_reporting, "global")) + rtpe_config.ssrc_reporting = SRP_GLOBAL; + else if (!strcasecmp(ssrc_reporting, "none")) + rtpe_config.ssrc_reporting = SRP_NONE; + else + die("Invalid --ssrc-reporting option ('%s')", ssrc_reporting); + } + #define STR_LEN_INIT(x) if (rtpe_config.x.s) rtpe_config.x.len = strlen(rtpe_config.x.s) STR_LEN_INIT(vsc_start_rec); STR_LEN_INIT(vsc_stop_rec); diff --git a/docs/rtpengine.md b/docs/rtpengine.md index 919f06dfc..896082651 100644 --- a/docs/rtpengine.md +++ b/docs/rtpengine.md @@ -1593,6 +1593,25 @@ call to inject-DTMF won't be sent to __\-\-dtmf-log-dest=__ or __\-\-listen-tcp- Enable measuring RTP metrics even for plain RTP passthrough scenarios. Without that option, RTP metrics are measured only in transcoding scenarios. +- __\-\ssrc-reporting=full__\|__inline__\|__global__\|__none__ + + Controls the format the SSRC statistics (primarily relevant for MOS and + other RTP metrics) in the responses to __delete__ and __query__ messages. + + The __inline__ format puts the statistics of media sources relevant to a + media stream within the reporting section that belongs to that media + stream. + + The __global__ format only lists the numeric SSRC identifiers relevant to a + media stream within its own section, and puts the actual statistics in a + global section, indexed by the SSRC identifiers. + + The __full__ format combines both of the above, resulting in a duplication + of all statistics and therefore a significant increase in message size. + + The current default is __full__ as this is the legacy format, and is + required by some controlling agents. + - __\-\-rtcp-interval=__*INT* Delay in milliseconds between RTCP packets when generate-rtcp flag is on. The diff --git a/etc/rtpengine.conf b/etc/rtpengine.conf index 966598698..ef17a0582 100644 --- a/etc/rtpengine.conf +++ b/etc/rtpengine.conf @@ -157,6 +157,7 @@ recording-method = proc # mqtt-publish-scope = media # mos = CQ +# ssrc-reporting = inline # poller-per-thread = false # io-uring = false # socket-cpu-affinity = -1 diff --git a/include/main.h b/include/main.h index 8a2d74207..79b1f2168 100644 --- a/include/main.h +++ b/include/main.h @@ -222,7 +222,8 @@ enum endpoint_learning { X(dtls_signature) \ X(use_audio_player) \ X(mqtt_publish_scope) \ - X(mos) + X(mos) \ + X(ssrc_reporting) \ struct rtpengine_config { rwlock_t keyspaces_lock; @@ -305,6 +306,12 @@ RTPE_CONFIG_CHARPP_PARAMS MOS_CQ = 0, MOS_LQ, } mos; + enum { + SRP_FULL = 0x0, // none disabled + SRP_INLINE = 0x1, // global (0x1) disabled - shall become the default in a future version + SRP_GLOBAL = 0x2, // inline (0x2) disabled + SRP_NONE = 0x3, // both disabled + } ssrc_reporting; };