[SR-Users] subnet match
volga629 at networklab.ca
volga629 at networklab.ca
Wed Mar 14 13:33:48 CET 2018
Hello Daniel,
I adjusted var to $dd and still not match
if(is_method("INVITE")) {
#$avp(destIP)=$(du{s.select,1,:});
#$avp(subnet) = $avp(destIP) + "/16";
#xlog("L_INFO", "Initial Request: [$rm] destination ip
[$avp(destIP)] and sourceip [$si]\n");
xlog("L_INFO", "Initial Request: [$rm] destination ip
[$dd] and sourceip [$si]\n");
if(!is_in_subnet("$si", "$dd/16")) {
xlog("L_INFO", "Subnets not match processing
rtp...destination ip [$dd] and source ip [$si]\n");
route(RTP_MANAGE);
}
}
Mar 14 13:21:06 sbc00 /usr/sbin/kamailio[1104]: {1 2 INVITE
Edz14KmQgLQpO5L323Wodw..} INFO: <script>: Initial Request: [INVITE]
destination ip [10.0.1.241] and sourceip [10.0.1.242]
Mar 14 13:21:06 sbc00 /usr/sbin/kamailio[1104]: {1 2 INVITE
Edz14KmQgLQpO5L323Wodw..} INFO: <script>: Subnets not match processing
rtp...destination ip [10.0.1.241/16] and source ip [10.0.1.242]
Slava
On Wed, Mar 14, 2018 at 6:19 AM, Daniel-Constantin Mierla
<miconda at gmail.com> wrote:
> Hello,
>
>
> On 14.03.18 00:19, volga629 at networklab.ca wrote:
>> Hello Everyone,
>> Not sure what I am missing, but can't match ip address to subnet
>>
>> Log says
>>
>> INFO: <script>: Subnets not match processing rtp...destination ip
>> [10.0.1.242] and sourceip [10.0.1.241]
>>
>>
>> if(is_method("INVITE")) {
>> $avp(destip)=$(du{s.select,1,:});
>> $avp(subnet) = $avp(destip) + "/16";
> if you want to get the host part (ip) of the $du, then just use $dd.
>
>> xlog("L_INFO", "Initial Request: [$rm] destination ip
>> [$avp(destip)] and sourceip [$si]\n");
>> if(!is_in_subnet("$si", "$avp(subnet)")) {
>
> So instead of the above if, get rid of the avps and you can just use:
>
> if(!is_in_subnet("$si", "$dd/16")) {
>
> Cheers,
> Daniel
>> xlog("L_INFO", "Subnets not match processing
>> rtp...destination ip [$avp(subnet)] and source ip [$si]\n");
>> route(RTP_MANAGE);
>> }
>> }
>>
>>
>>
>> [root at prx00 ~]# rpm -qa | grep kamailio
>> kamailio-mysql-5.1.2-2.git4c840b7e9.fc27.x86_64
>> kamailio-5.1.2-2.git4c840b7e9.fc27.x86_64
>>
>>
>> Slava.
>>
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - April 16-18, 2018, Berlin -
> www.asipto.com
> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
>
>
More information about the sr-users
mailing list