OpenSIPS-Asterisk communication

Jorge Luis
2011-03-17
2013-05-09
  • Jorge Luis
    Jorge Luis
    2011-03-17

    Hi all,

    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.

     
  • Jorge Luis
    Jorge Luis
    2011-03-21

    Hi all,

    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…

    Regards,
    Jorge Luis

     
  • Ali Pey
    Ali Pey
    2011-03-25

    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.
    Ali

     
  • Jorge Luis
    Jorge Luis
    2011-03-28

    Hi Ali,

    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

    type=friend
    secret=password
    context=opensips
    callerid= "OpenSIPS-Asterisk" <54321>
    username=54321
    fromuser=54321
    canreinvite=no
    nat=yes
    insecure=very
    fromdomain=X.X.X.X
    host=X.X.X.X
    call-limit=10
    outboundproxy=X.X.X.X
    port=5060


    (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
    Jorge Luis