I have a scenario with OpenSIPS and Asterisk, both in remote with public addresses and both into the same network.
The UAC are behind the NAT. The UAC registered against OpenSIPS and OpenSIPS manages the SDP from/to Asterisk and from/to UAC.
If a UAC wish to comunicate with Asterisk no problem, SDP through OpenSIPS and RTP directly between them without problems.
But when Asterisk wish to comunicate with a UAC, through a SIP trunk registered from Asterisk, OpenSIPS to signal to UAC and response to Asterisk. The problem is that Asterisk try to send RTP to UAC local ip adress, i think that SDP is correct, in the '200 OK, with session description' message, the Contact field no have the local Ip, only is present in media session but Asterisk try send RTP to local ip adress.
I have tried solve with 'fix_nated_sdp("3");' and this command change the SDP but Asterisk only can see the NAT ip adress but no the port of NAT.
help please, very thanks.
i have solved this problem using Mediaproxy, on this way both SDP as RTP are send through OpenSIPS between UAS and UAC.
But perhaps could solved any other way…
In sip.conf in asterisk do nat=yes. Asterisk is smart enough to do port latching. Adding another hop for rtp creates more delay and it's more cpu intensive.
I agree with your comments but i don't find the way to do it. This is the sip.conf content:
register => 54321:password@X.X.X.X
callerid= "OpenSIPS-Asterisk" <54321>
(X.X.X.X -> opensips ip)
Even with this configuration, Asterisk send the RTP to UAC local ip adress.
Further in the SDP, the local ip is present in session description protocol (Message Body) but in Contact field (Message Header) is the public ip adress.
It seems as if Asterisk had canreinvite=yes or nat=no……..
Thanks and Regards