[Users] clienst behind same NAT

Daniel-Constantin Mierla daniel at voice-system.ro
Fri Aug 26 20:38:03 CEST 2005


Hello,

I just added a pseudovariable to get the ip/host address from dst_uri. 
Now it should be less complex to do the check.

avp_printf("i:20","$dd");
if(avp_check("i:20","eq/$src_ip")) {
   # src_ip is the same with destination ip
}

Fore more see: http://openser.org/pipermail/users/2005-August/000681.html

Daniel


On 08/18/05 20:53, Daniel-Constantin Mierla wrote:

> A small errata, to match an IP address:
>
> avp_subst("i:20/d","/.*([1-9][0-9]{0,2}\.[1-9][0-9]{0,2}\.[1-9][0-9]{0,2}\.[1-9][0-9]{0,2}).*"/\1/); 
>
>
>
> Daniel
>
>
> On 08/18/05 14:17, Daniel-Constantin Mierla wrote:
>
>>
>>
>> On 08/18/05 13:24, Klaus Darilion wrote:
>>
>>> If oyu use fix_nated_contact for REGISTER messages, than it should 
>>> work.
>>>
>>> If ouy use fix_nated_register, it will not work. We would need a 
>>> pseudo variable which points to the received-socket. Maybe the core 
>>> developers can help you on this.
>>
>>
>>
>> There is a pseudo variable $du that points to destination uri 
>> (dst_uri filed of sip_msg structure - the address where the sip 
>> message will be sent after a loose_route() or lookup() request for 
>> callee behind the nat).
>>
>> So, if the callee is behind the nat, the dst_uri is set to the 
>> address and port of the NAT. To check it, copy $du in an avp, use 
>> avp_subst() to extract the ip address and and compare it with src_ip.
>>
>> avp_printf("i:20","$du");
>> avp_subst("i:20/d","/.*([1-9][0-9]{1,2}\.[1-9][0-9]{1,2}\.[1-9][0-9]{1,2}\.[1-9][0-9]{1,2}).*"/\1/); 
>>
>> if(avp_check("i:20","eq/$src_ip")) {
>>    # src_ip is the same with destination ip
>> }
>>
>> Looking at this issue, I am wondering if worth to add the 
>> pseudovariables $dh and $dp for destination host and port ... Also I 
>> am considering to change a bit the $du reference so when the dst_uri 
>> is not set to point to request URI. Would be these changes usefully?
>>
>> Daniel
>>
>>>
>>> regards
>>> klaus
>>>
>>> jayesh nambiar wrote:
>>>
>>>> hi all,
>>>> Thanx Klaus.
>>>> Sorry to ask a question again related to the same problem. I had 
>>>> already tried writing the avp_write after lookup but even that 
>>>> causes a problem.
>>>> When avp_write is done it writes the private IP address of the 
>>>> callee while the source_ip is the IP address of the NAT. I beleive 
>>>> this IP address is written because of the fix_nated_contact.
>>>> Again, when avp_check is done, it returns false and again the RTP 
>>>> session gets started. IS there any way out to this problem.
>>>> Thanx again..
>>>> Jayesh
>>>>
>>>> ------------------------------------------------------------------------ 
>>>>
>>>> Start your day with Yahoo! - make it your home page 
>>>> <http://us.rd.yahoo.com/evt=34442/*http://www.yahoo.com/r/hs>
>>>>
>>>>
>>>> ------------------------------------------------------------------------ 
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at openser.org
>>>> http://openser.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at openser.org
>>> http://openser.org/cgi-bin/mailman/listinfo/users
>>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openser.org
>> http://openser.org/cgi-bin/mailman/listinfo/users
>>
>




More information about the sr-users mailing list