Difference between rtp_port_range in janus.jcfg and janus.plugin.sip.jcfg

Hiya,

I am standing up a Janus server for SIP/WebRTC and one thing that I noticed was that there are at least two configuration values for rtp_port_range, one in janus.jcfg, and one in janus.plugin.sip.jcfg. I apologize if this is documented somewhere that I’m not seeing, but my googles have all come up empty.

One thing that I noticed was that, when configuring rtp_port_range in janus.plugin.sip.jcfg, my STUN candidates would often be outside this port range. After some digging, I figured out that (or am at least fairly sure that) the ICE plugin uses the value in janus.jcfg.

https://github.com/Cytracom/janus-gateway/blob/641d048e9d024f3d3926ba199e266e9eb139a96e/src/janus.c#L5163

However (again, pretty sure), the SIP plugin uses the value in janus.plugin.sip.jcfg

https://github.com/Cytracom/janus-gateway/blob/641d048e9d024f3d3926ba199e266e9eb139a96e/src/plugins/janus_sip.c#L6663

Why do both configuration values exist? Should these ranges not overlap (and if they shouldn’t, what’s the reasoning?) I found this notice in the audiobrige sample configuration, but I’m not sure if it applies to my usecase. Is the idea that the janus.cfg specifies all the ports Janus may use, while the plugins must each pick a distinct subset of said range?

        # .. To
	# support plain RTP, the plugin needs to have a range of ports it can bind
	# to: notice this should be configured so that it doesn't conflict with other
	# plugins (e.g., Streaming, SIP, NoSIP) and applications (e.g., Janus itself).
	# The default if you don't specify anything is 10000-60000.
	#rtp_port_range = "50000-60000"

Thanks for your help, it’s appreciated.

It’s different rangs because they’re related to dfferent things. The range in janus.jcfg is for WebRTC PeerConnections, the one for the SIP plugin applies to RTP used on the SIP side. They’re separate because the two sides may operate on different interfaces, depending on the network configuration. Whether to overlap is up to you, but I’d say not, just to have more control and manage them separately.

1 Like

Ah, ok! So the one in janus.plugin.sip.jcfg is used when talking to say, Asterisk, and the one in janus.jcfg is used with my WebRTC clients. That makes total sense. Thank you so much :slight_smile: always nice to get a reply from a maintainer