[Pkg-voip-commits] [janus] 135/282: Added configurable port range for RTP/RTCP ports in the NoSIP plugin

Jonas Smedegaard dr at jones.dk
Wed Dec 20 21:53:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.2.6-1
in repository janus.

commit 21737e70b879d2e738798655fe6bfd7861b062a3
Author: Lorenzo Miniero <lminiero at gmail.com>
Date:   Fri Oct 20 15:23:24 2017 +0200

    Added configurable port range for RTP/RTCP ports in the NoSIP plugin
---
 conf/janus.plugin.nosip.cfg.sample |  3 +++
 plugins/janus_nosip.c              | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/conf/janus.plugin.nosip.cfg.sample b/conf/janus.plugin.nosip.cfg.sample
index c4a85c7..ff0efe5 100644
--- a/conf/janus.plugin.nosip.cfg.sample
+++ b/conf/janus.plugin.nosip.cfg.sample
@@ -3,5 +3,8 @@
 ; guessed from the system
 ;local_ip = 1.2.3.4
 
+; Range of ports to use for RTP/RTCP (default=10000-60000)
+rtp_port_range = 20000-40000
+
 ; Whether events should be sent to event handlers (default is yes)
 ;events = no
diff --git a/plugins/janus_nosip.c b/plugins/janus_nosip.c
index a5c3827..2a94a5a 100644
--- a/plugins/janus_nosip.c
+++ b/plugins/janus_nosip.c
@@ -159,6 +159,8 @@ static gboolean notify_events = TRUE;
 static janus_callbacks *gateway = NULL;
 
 static char *local_ip = NULL;
+static uint16_t rtp_range_min = 10000;
+static uint16_t rtp_range_max = 60000;
 
 static GThread *handler_thread;
 static GThread *watchdog;
@@ -454,6 +456,28 @@ int janus_nosip_init(janus_callbacks *callback, const char *config_path) {
 			}
 		}
 
+		item = janus_config_get_item_drilldown(config, "general", "rtp_port_range");
+		if(item && item->value) {
+			/* Split in min and max port */
+			char *maxport = strrchr(item->value, '-');
+			if(maxport != NULL) {
+				*maxport = '\0';
+				maxport++;
+				rtp_range_min = atoi(item->value);
+				rtp_range_max = atoi(maxport);
+				maxport--;
+				*maxport = '-';
+			}
+			if(rtp_range_min > rtp_range_max) {
+				uint16_t temp_port = rtp_range_min;
+				rtp_range_min = rtp_range_max;
+				rtp_range_max = temp_port;
+			}
+			if(rtp_range_max == 0)
+				rtp_range_max = 65535;
+			JANUS_LOG(LOG_VERB, "NoSIP RTP/RTCP port range: %u -- %u\n", rtp_range_min, rtp_range_max);
+		}
+
 		item = janus_config_get_item_drilldown(config, "general", "events");
 		if(item != NULL && item->value != NULL)
 			notify_events = janus_is_true(item->value);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/janus.git



More information about the Pkg-voip-commits mailing list