[Kamailio-Users] dst_ip

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 5 14:50:11 CET 2010



On 1/5/10 2:42 PM, Olivier Taylor wrote:
> for sure it's something like that, but then how to get the IP range...
>
> In fact, I have 2 interfaces, users are registered under the local 
> one, 10.0.X.X with subnet 255.255.0.0
> I need to know if their IPs are local or not.
> It's not even possible to 'print' via xlog the dst_ip.
The dst_ip is the local interface where the message has been received 
and available via pseudo variable as $Ri:
http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:1.5.x#received_ip_address

if($Ri =~ "...")

You can use this to match against regexp or string, print it via xlog, 
etc...

You can use dst_ip to compare against ip or network:

if(dst_ip==10.10.10.10)

if(dst_ip==10.10.0.0/16)

If you use dst_ip (as well as src_ip) to compare against strings (equal 
or regexp), it is a bit more tricky and time consuming as it does 
reverse dns and more steps of comparisons. But should work, even not 
recommended.

Cheers,
Daniel


>
> I am lost :(
>
> Thanks Klaus,
>
> Olivier
>
> Klaus Darilion a écrit :
>>
>>
>> Olivier Taylor schrieb:
>>> hi all,
>>>
>>> when checking dst_ip with an expression like 'if(dst_ip=~ 
>>> "10\.1\.*")' I 
>>
>> Maybe dst_ip is not a string representation of the IP address, but 
>> some internal structure, and thus the regexp fails?
>>
>> regards
>> klaus
>>
>>> always have a 'false' as answer...
>>> What do I wrong there?
>>>
>>> Olivier
>>>
>>>
>>> _______________________________________________
>>> Kamailio (OpenSER) - Users mailing list
>>> Users at lists.kamailio.org
>>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>
>> _______________________________________________
>> Kamailio (OpenSER) - Users mailing list
>> Users at lists.kamailio.org
>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>
>
>
>
>
> _______________________________________________
> Kamailio (OpenSER) - Users mailing list
> Users at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users

-- 
Daniel-Constantin Mierla
* http://www.asipto.com/




More information about the Users mailing list