[OpenSIPS-Users] NAT for in-dialog requests
Callum Guy
callum.guy at x-on.co.uk
Fri Dec 13 07:12:51 EST 2019
Hi All,
I am operating a registrar which proxies calls to an internal network
of media servers.
Most of my subscribers are operating using RFC1918 addresses behind
NAT. We detect this configuration through nat_uac_test() and patch the
SIP using fix_nated_contact(). By rewriting the requests the media
servers will send in-dialog requests with request URI set to the NAT
address.
This works fine for the majority of my use cases however I am now
dealing with a UAC which has chosen to use public addresses on the
handsets but continues to run behind NAT. The effect here is that my
choice of flags for nat_uac_test() do not match the scenario and the
rewrites are not happening.
I can resolve this issue with some additional flags and logic however
I wonder if there is a "more correct" way to do this. In an ideal
world I would lookup the registration during INVITE processing, notice
that there is a different received address and use this for all future
communications for the rest of the dialog.
For example the initial requests out to these handsets are performing
a lookup() operation which will retrieve the original contact for use
as request URI and received address for use as destination URI
allowing the request to be properly formed and forwarded. The issue
arises when the dialog is started, the UAC responds to the well formed
INVITE with 200 OK and unless I patch the contact with the received IP
the subsequent ACK will end up routing back to the UAC contact rather
than the NAT device. What I am hoping is that there may be a correct
way for me to track the received IP against the dialog such that it
can be used in subsequent in-dialog requests, allowing the request URI
to correctly represent the UAC contact whilst still delivering
requests to the NAT address. I can probably achieve this by recording
the information using dialog variables however I imagine this is a
common scenario so I wouldn't want to add this logic in manually if
there was a proper way to do this natively in OpenSIPs.
Hopefully this isn't one of those questions that gets asked too
regularly however if it is please point me in the direction of an
article that might help, I've re-read the nathelper, nat_trasveral,
registrar and usrloc documentation today and haven't found what I'm
looking for. Any pointers would be appreciated before I embark on a
homegrown solution.
Thanks,
Callum
--
*0333 332 0000 | www.x-on.co.uk <http://www.x-on.co.uk> | **
<https://www.linkedin.com/company/x-on> <https://www.facebook.com/XonTel>
<https://twitter.com/xonuk> *
X-on
is a trading name of Storacall
Technology Ltd a limited company registered in
England and Wales.
Registered Office : Avaland House, 110 London Road, Apsley, Hemel
Hempstead,
Herts, HP3 9SD. Company Registration No. 2578478.
The
information in this e-mail is confidential and for use by the addressee(s)
only. If you are not the intended recipient, please notify X-on immediately
on +44(0)333 332 0000 and delete the
message from your computer. If you are
not a named addressee you must not use,
disclose, disseminate, distribute,
copy, print or reply to this email. Views
or opinions expressed by an
individual
within this email may not necessarily
reflect the views of X-on
or its associated companies. Although X-on routinely
screens for viruses,
addressees should scan this email and any attachments
for
viruses. X-on
makes no representation or warranty as to the absence of viruses
in this
email or any attachments.
More information about the Users
mailing list