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

Alberto Cruz acruz at tekbrain.com
Tue Jul 11 23:20:18 CEST 2006

Comments in line

Greger V. Teigre wrote:

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

Yes we are sending calls to different uris this means we are calling to 
different PSTN numbers. It is because we are using the 
"uri=~001[1-9][0-9]{9}@.*" value.
Route(1) is applying the lookup("location")

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

I don't understand very well this part. Could you give me an example?

> 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 public.
> Make any sense?
> g-)

Unfortunally the GW is behind a NAT with a Dynamic Public IP address. 
The only static IP is the private IP assigned to the GW's ethernet 
interface. It is because we can't use the rewritehostport( ) function.


Alberto Cruz

> 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