[asterisk-users] x-ast-orig-host - How is this IP taken ?

George Joseph gjoseph at digium.com
Thu Jun 11 10:46:16 CDT 2020

On Wed, Jun 10, 2020 at 3:25 PM Administrator <admin at tootai.net> wrote:

> Hi list,
> We have a strange behavior: a customer Snom300 behind a public FW has
> contact like
> contact              :
> sip:user at x.y.39.147:2048;x-ast-orig-host=

x-ast-orig-host is a header we add to incoming requests when
rewrite_contact is on AND the host we get the request from is different
from the host in the contact URI.  We do this so we can restore the
original contact URI when we send responses.  Here's the scenario...

A client behind a firewall sends Asterisk a REGISTER request.  The contact
URI is probably going to be a non-routable ip address like but
the host the packet comes from will be the public ip address of the
firewall.   In order to properly route responses and subsequent requests,
the "rewrite_contact" option can be used to force Asterisk to substitute
the private ip address in the contact header with the public ip address we
actually got the packet from.  This way we send responses and new requests
to the public ip address. This all works well except for 1 scenario...
 When a client sends a REGISTER request, they can use the IP address in the
contact header of the response to match it to the request.  If we've
rewritten the contact header, they won't be able to match it.   So we save
off the contact host into that x-ast-orig-host header and when we send
responses back to the client, we still send it to the public ip address git
we reset the contact host back to what was in the original request.  We
then strip all x-ast* headers before we actually send the packets.

> The phone can place calls but not receive any. Also, qualify give
> unreachable which seems correct when looking the x-ast-orig-host IP.
> Problem is that the local IP of this phone is

Well, 169.254.x.x addresses are Automatic Assigned Ip Addresses assigned by
the device itself when it can't get a dhcp ip address.  It's highly
unlikely that things are going to function normally if the device doesn't
have a real ip address.

> Question: how asterisk sets this IP ? It looks for us like a FW issue as
> we have other customers with approaching local network organisation and
> which are not facing this problem.

See above.  You should also check that the router the phone is connected to
does NOT have SIP ALG turned on because that will mess with the SIP headers.

> Thanks for any hint.
> --
> Daniel
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users

George Joseph
Asterisk Software Developer
direct/fax +1 256 428 6012
Check us out at www.sangoma.com and www.asterisk.org
[image: image.png]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20200611/5f3c160b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 5142 bytes
Desc: not available
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20200611/5f3c160b/attachment.png>

More information about the asterisk-users mailing list