mirror of
https://github.com/asterisk/asterisk.git
synced 2026-04-29 10:13:06 +00:00
Add rtp_port_start and rtp_port_end options to PJSIP endpoint configuration, allowing each endpoint to use a dedicated RTP port range instead of the global rtp.conf setting. This is useful for scenarios where different endpoints need isolated port ranges, such as firewall rules per trunk, multi-tenant systems, or network QoS policies tied to port ranges. The implementation adds ast_rtp_instance_new_with_port_range() to the RTP engine API, which sets the port range on the instance before the engine allocates the transport. The default RTP engine (res_rtp_asterisk) checks for per-instance overrides in rtp_allocate_transport() and falls back to the global range when none is set. Both options must be set together, with values >= 1024 and rtp_port_end > rtp_port_start. Setting both to 0 (the default) preserves existing behavior. Resolves: https://github.com/asterisk/asterisk-feature-requests/issues/71 UserNote: PJSIP endpoints now support rtp_port_start and rtp_port_end options to configure a dedicated RTP port range per endpoint, overriding the global rtp.conf setting. UpgradeNote: An alembic database migration has been added to add the rtp_port_start and rtp_port_end columns to the ps_endpoints table. Run "alembic upgrade head" to apply the schema change. DeveloperNote: New public API: ast_rtp_instance_new_with_port_range() creates an RTP instance with a per-instance port range. ast_rtp_instance_get_port_start() and ast_rtp_instance_get_port_end() allow RTP engines to query the override. Third-party RTP engines can use these getters to support per-instance port ranges.