From 6e07f40f478121f969e130920b128ce8fadf45a4 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 16 Apr 2025 14:31:53 -0400 Subject: [PATCH] MT#55283 scale mqtt_publish_interval Change-Id: I7ed5d5ea275139a81a91126100af6edadafe66fd --- daemon/codec.c | 2 +- daemon/main.c | 5 +++-- include/main.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index 29ff54acb..a946af1f5 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -1978,7 +1978,7 @@ static void __mqtt_timer_run_summary(struct codec_timer *ct) { mqtt_timer_run_summary(); } static void __codec_mqtt_timer_schedule(struct mqtt_timer *mqt) { - mqt->ct.next += rtpe_config.mqtt_publish_interval * 1000; // XXX scale to micro + mqt->ct.next += rtpe_config.mqtt_publish_interval_us; timerthread_obj_schedule_abs(&mqt->ct.tt_obj, mqt->ct.next); } // master lock held in W diff --git a/daemon/main.c b/daemon/main.c index 3b08637a4..7f6cabff5 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -109,7 +109,6 @@ struct rtpengine_config rtpe_config = { .audio_buffer_length = 500, .mqtt_port = 1883, .mqtt_keepalive = 30, - .mqtt_publish_interval = 5000, .dtmf_digit_delay = 2500, .moh_max_duration = -1, // disabled by default .moh_max_repeats = 999, @@ -678,6 +677,7 @@ static void options(int *argc, char ***argv, charp_ht templates) { int db_expire = 0; int rtcp_interval = 0; int redis_disable_time = 10; + int mqtt_publish_interval = 5000; GOptionEntry e[] = { { "table", 't', 0, G_OPTION_ARG_INT, &rtpe_config.kernel_table, "Kernel table to use", "INT" }, @@ -844,7 +844,7 @@ static void options(int *argc, char ***argv, charp_ht templates) { { "mqtt-keyfile",0,0, G_OPTION_ARG_FILENAME, &rtpe_config.mqtt_keyfile,"Key file for mosquitto auth", "FILE"}, { "mqtt-publish-qos",0,0,G_OPTION_ARG_INT, &rtpe_config.mqtt_publish_qos,"Mosquitto publish QoS", "0|1|2"}, { "mqtt-publish-topic",0,0,G_OPTION_ARG_STRING, &rtpe_config.mqtt_publish_topic,"Mosquitto publish topic", "STRING"}, - { "mqtt-publish-interval",0,0,G_OPTION_ARG_INT, &rtpe_config.mqtt_publish_interval,"Publish timer interval", "MILLISECONDS"}, + { "mqtt-publish-interval",0,0,G_OPTION_ARG_INT, &mqtt_publish_interval, "Publish timer interval", "MILLISECONDS"}, { "mqtt-publish-scope",0,0,G_OPTION_ARG_STRING, &mqtt_publish_scope, "Scope for published mosquitto messages","global|summary|call|media"}, #endif { "mos",0,0, G_OPTION_ARG_STRING_ARRAY,&mos_options, "MOS calculation options", "CQ|LQ"}, @@ -1110,6 +1110,7 @@ static void options(int *argc, char ***argv, charp_ht templates) { rtpe_config.rtcp_interval_us = 5000 * 1000LL; rtpe_config.redis_disable_time_us = redis_disable_time * 1000000LL; + rtpe_config.mqtt_publish_interval_us = mqtt_publish_interval * 1000LL; if (redisps) { if (redis_ep_parse(&rtpe_config.redis_ep, &rtpe_config.redis_db, &rtpe_config.redis_hostname, diff --git a/include/main.h b/include/main.h index 1b228a277..bdd79facb 100644 --- a/include/main.h +++ b/include/main.h @@ -83,7 +83,6 @@ enum endpoint_learning { X(mqtt_port) \ X(mqtt_keepalive) \ X(mqtt_publish_qos) \ - X(mqtt_publish_interval) \ X(cpu_affinity) \ X(max_recv_iters) \ X(media_refresh) \ @@ -106,6 +105,7 @@ enum endpoint_learning { X(db_expire_us) \ X(rtcp_interval_us) \ X(redis_disable_time_us) \ + X(mqtt_publish_interval_us) \ #define RTPE_CONFIG_BOOL_PARAMS \ X(homer_rtcp_off) \