RTP packets are going out with the wrong IP address

I accidentally ran into an unusual problem because I have a VIP address for Asterisk on the server. SIP packets are correctly sent via the VIP IP, but RTP packets are sent from the network card’s source address. I have configured the transports, but for some reason, it doesn’t work.

[10.10.3.10-udp]
type=transport
protocol=udp
bind=10.10.3.10:5060 ← VIP address
external_media_address=10.10.3.10
external_signaling_address=10.10.3.10
allow_reload=yes
tos=cs3
cos=3
local_net=10.10.3.0/24 ← Network Asterisk Server
local_net=10.20.1.0/24 ← Network VoIP Phone

sudo asterisk -rx “rtp show settings”

General Settings:

Port start:      10000
Port end:        20000
Checksums:       Yes
DTMF Timeout:    1200
Strict RTP:      Yes
Probation:       4 frames
Replay Protect:  Yes
ICE support:     Yes
STUN address:    0.0.0.0:0

The routing is fine because I’m using a separate table, and all incoming traffic to the VIP should go out via the VIP address. This works for SIP. However, RTP packets are sent from the network card’s address, not the VIP. The RTP packets are going out with the address 10.10.3.12.

The network card has two IP addresses:

10.10.3.10 ← VIP

10.10.3.12 ← network card’s address

RTP uses the wildcard address by default for simultaneous IPv4 and IPv6 use alongside ICE candidate gathering. Setting media_address[1] and then enabling the option to bind to it[2] may work.

[1] res_pjsip - Asterisk Documentation

[2] res_pjsip - Asterisk Documentation

1 Like

Can you give me a hint on how to configure this? I’ve been trying, but without success.

I can’t speak for FreePBX. In Asterisk they are configured on the endpoint.

This has been multiposted to RTP packets are going out with the wrong IP address - Asterisk SIP - Asterisk Community

@autominus have you tried using external_media_address=10.10.3.12 <-- NIC?

As I pointed out in the other forum, having the external address on the local network is not a way in which external address was intended to be used.