[asterisk-users] Change Media IP in SDP [SOLVED]

Harel harel at mayorcom.com
Thu Dec 8 18:03:34 CST 2016


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.

Harel

******** Original Message *********
Hi,

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. "localnet=192.168.1.0/255.255.255.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:
> Hello List,
> I need your help with information going out on my SDP.
> Is it possible to update the Media Address on a per-call basis or a per-channel basis?
> Reason:
> My Asterisk is in a private network and needs to connect to UA on its internal network and also few external networks. One network is public and the others are not public. Between each other the external networks are not routable. Signaling is flowing with no issues because SIP Registers and NAT boxes maintain sessions correctly. The problem is with RTP. After making traces on all possible nodes of this network I clearly found out that the RTP fails because the Asterisk doesn't manage to communicate the correct address to the UAs in the SDP. It will report its internal IP address and the remote UA will try to send its RTP to this address which, of course, will fail miserably. 
> Obviously I can't use externaddr or media_address in sip.conf because it will only be good for one network while the other external networks will fail just the same. Same applies for STUN, it will only be good for the network the STUN requests are being sent from. 
> On all networks I have fix IP addresses on my side and I fully control a professional security box. 
> Asterisk is 13.6.0
> I can't, and don't want to, touch user-side equipment which is normally some kind of voip phone behind a standard home VDSL router.
> 
> Any ideas how can I transmit the correct IP address in SDP to UAs on different networks?
> 
> Many thanks,
> Harel
> 
> 




More information about the asterisk-users mailing list