Change Media IP In SDP [SOLVED]

Home » Asterisk Users » Change Media IP In SDP [SOLVED]
Asterisk Users No Comments

Hello Max,

Thank you for your detailed reply.

Indeed all my nat-related settings are configured properly and I make use of two NIC cards to access the various networks I’m connected to. When you mentioned ‘externip’ I assume you meant ‘externaddr’ because there is no ‘externip’ in sip.conf… I’ve made some tests and found out that this setting has no effect on the [peer] level and can only be used on the [general] section of sip.conf. Your suggestion of using the ‘localnet’ together with the ‘externaddr’ did the trick for me. Even though the remote non-public networks are by no way ‘local’ I have defined them as such thus disabling any IP replacements with the ‘externaddr’ which is the wrong IP for these networks. For the benefit of others who may come across this thread I would mention that this solution would work on the following two conditions:
1. Only one external network may be NATed to the Asterisk. This limitation is due to the fact that only one ‘externaddr’ may be configured per-box.
2. All other end-points in other networks are within a well-known IP range which can be defined in ‘localnet’ settings.

It will be nice to have the ‘externaddr’ work on the [peer] level thus providing more valuable tools to solve NAT issues.


******** Original Message *********

normally, Asterisk handles RTP IP addresses in SDP correctly, if you have specified
– that NAT traversal is enabled for all peers (e.g. nat=force_rport,comedia)
– your local network with “localnet=yournetwork/networkmask” – e.g. “localnet2.168.1.0/”
– directmedia, canreinvite, directrtpsetup is deacitivated

In this case, your Asterisk will always stay in the RTP stream and signalling only it’s own IP address to other peers which is configured for the interface which Asterisk uses to reach the peer.

But: If you have only one interface configured on your Asterisk server and an external firewall/router is managing your separated networks, this might not help. In this case you can use “externip” on a per peer basis in your SIP configuration to specify the IP address Asterisk uses in the SDP. Maybe, a global configuration of “externip” and “localnet” is all you need to help Asterisk setting the SDP address correctly. Also, enabling ICE support can help you getting the correct IP address if the remote peer supports it.

Greetings Max

Am 07.12.2016 um 00:02 schrieb Harel: