[Serusers] How to send PSTN CALLs to a NATED PSTN GW?

Greger V. Teigre greger at teigre.com
Tue Jul 11 20:56:29 CEST 2006

Well, yes no... it's a hack. You are sending calls to many different 
uris or one?  And route(1) does a lookup("location")?
Then it will work if you are only sending to one uri. You see, if your 
gw is NATed, a received parameter will be added to the contact in 
location table.  This received parameter will be used for sending, even 
though the ruri is another. fix_nated_register() does this "magic" for 
    For random numbers, you can then change the uri to the actual 
destination uri (B-number) and the message will be forwarded to the 
received ip and port.  This will NOT work if the GW is not marked as 
NATed in your location.

This is a very bad hack for something that should be a simple thing. If 
the GW is behind a NAT with a static IP (I hope!) and the NAT allocation 
is static, you can rewritehostport("") as if the GW is 
Make any sense?

Alberto Cruz wrote:
> Yes the GW registers itself with my SER server.
> According to your tip I have the following:
> My GW is registered at location as
> ~~~Contact(0x404c54c0)~~~
> domain    : 'location'
> aor       : '5527350900'
> Contact   : 'sip:5527350900 at'
> Expires   : 761
> q         :
> Call-ID   : 'E1A37F8C-2BE711D6-8020EB34-A0107B2E'
> Do you mean I could have the following block at my ser.cfg:
>        if ((uri=~"sip:001[1-9][0-9]{9}@.*")) {
>                rewriteuri("sip:5527360900 at mysipdomain");
>                avp_write("i:45", "inv_timeout");
>                route(1);
>                break;
>        };
> And it's all?
> Regards
> Alberto Cruz
> Greger V. Teigre wrote:
>> You mean the GW registers itself with your SER server?!
>> If that is the case, just rewrite the uri to the aor of the gw (the 
>> sip uri it registers with) and then do lookup("location")
>> g-)
>> Alberto Cruz wrote:
>>> Hi guys maybe this have been asked before.
>>> I have the following:
>>> * I have an ADSL Internet access with a public dynamic IP.
>>> * I have a broadband router in order to share the Internet access 
>>> using NAT.
>>> * I have a VoIP GW that supports register connected behind the NAT.
>>> When the GW registers itself SER knows its source IP and UDP port.
>>> Does anybody knows how to forward the PSTN calls to the GW when it 
>>> is behind a NAT?
>>> Regards
>>> Alberto Cruz
>>> _______________________________________________
>>> Serusers mailing list
>>> Serusers at lists.iptel.org
>>> http://lists.iptel.org/mailman/listinfo/serusers

More information about the sr-users mailing list