Good morning everyone,
Im trying to configure secfilter module to harden our kamailio. After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I've configured secfilter module, and I think it's also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB. But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I've also tried to use $? Variable and it shows "1", in the module documentation I saw that 1 means "the value is not found". But when I use kamcmd secfilter.print I can see the country in the output and it's spelled exactly the same that in $gip2(src=>cc)
I don't know if there's something I'm missing. Any help would be appreciated. Thanks in advance
This is the code I'm executing if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)"); xlog("L_ALERT", "$?"); if ($avp(secfilter) == 2) { return; } xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } And this is what appears in the logs 2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if 2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match 2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country 2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog 2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null> 2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog 2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1 2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if 2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog 2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted 2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country ======= [+] Blacklisted -----------
[+] Whitelisted ----------- 0001 -> ES
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttp://www.vivelibre.es/
[cid:image001.png@01DC0780.5D6264D0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre."
Hello,
some years ago, we had a similar issue with geoip with one of our customers. It was not working anymore after a reload. But your problem looks a bit more like it's in secfilter module.
Which version of Kamailio you are using? Does it work when you call $gip2 PV manually?
Cheers,
Henning
From: Samuel Moya Tinoco via sr-users sr-users@lists.kamailio.org Sent: Donnerstag, 7. August 2025 10:08 To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Samuel Moya Tinoco smoya@vivelibre.es Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio. After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I've configured secfilter module, and I think it's also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB. But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I've also tried to use $? Variable and it shows "1", in the module documentation I saw that 1 means "the value is not found". But when I use kamcmd secfilter.print I can see the country in the output and it's spelled exactly the same that in $gip2(src=>cc)
I don't know if there's something I'm missing. Any help would be appreciated. Thanks in advance
This is the code I'm executing if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)"); xlog("L_ALERT", "$?"); if ($avp(secfilter) == 2) { return; } xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } And this is what appears in the logs 2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if 2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match 2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country 2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog 2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null> 2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog 2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1 2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if 2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog 2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted 2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country ======= [+] Blacklisted -----------
[+] Whitelisted ----------- 0001 -> ES
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttp://www.vivelibre.es/
[cid:image001.png@01DC079E.3C977BA0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre."
Hello henning,
Thank you for your reply. I'm using kamailio 5.6.3, when I call $gip2(src=>cc) it shows the origin country from the IP. I've test it with several countries and it works well. The problem is when I call secf_check_country($gip2(src=>cc)) that it replies with null.
I've tried to insert into kamailio DDBB secfilter table exactly the output of $gip2(src=>cc), and I can see that it appear when using "kamcmd secfilter.print country" but it seems that the function cannot match it. Also I've tried to insert into the secfilter table all the spelling combinations of the country (both letter uppercase, both lowercase, one uppercase one lowercase, between quotes, etc), and the command "kamcmd secfilter.print country" shows all of them whitelisted but the function still replies with a null
I'm not sure if there's anything I'm doing wrong or what should I try next. Thank you again for your help
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttp://www.vivelibre.es/
[cid:image001.png@01DC0840.432CC950]
Soluciones inteligentes para la autonomía personal
De: Henning Westerholt hw@gilawa.com Enviado el: jueves, 7 de agosto de 2025 13:22 Para: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org CC: Samuel Moya Tinoco smoya@vivelibre.es Asunto: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
some years ago, we had a similar issue with geoip with one of our customers. It was not working anymore after a reload. But your problem looks a bit more like it's in secfilter module.
Which version of Kamailio you are using? Does it work when you call $gip2 PV manually?
Cheers,
Henning
From: Samuel Moya Tinoco via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Donnerstag, 7. August 2025 10:08 To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio. After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I've configured secfilter module, and I think it's also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB. But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I've also tried to use $? Variable and it shows "1", in the module documentation I saw that 1 means "the value is not found". But when I use kamcmd secfilter.print I can see the country in the output and it's spelled exactly the same that in $gip2(src=>cc)
I don't know if there's something I'm missing. Any help would be appreciated. Thanks in advance
This is the code I'm executing if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)"); xlog("L_ALERT", "$?"); if ($avp(secfilter) == 2) { return; } xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } And this is what appears in the logs 2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if 2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match 2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country 2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog 2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null> 2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog 2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1 2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if 2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog 2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted 2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country ======= [+] Blacklisted -----------
[+] Whitelisted ----------- 0001 -> ES
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttps://linkprotect.cudasvc.com/url?a=http%3a%2f%2fwww.vivelibre.es%2f&c=E,1,NWBcVcZ8cyc55WJDJDgUZOcQAzfRSiI26NQtFGhFNsk_yH4VxcQUlYyabYbUg0b1y8T12x3bj9NRwZXTRdieidhV2ztX-5wnFxZ_AwIj7GGOAfo-lXkmww,,&typo=1
[cid:image001.png@01DC0840.432CC950]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre." "Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre."
Hello,
the documentation seems to have indeed some issues, the $avp(secfilter) seems to be not available. It should be probably fixed in the docs.
Regarding your issue, I can only say that we had a similar issue with Kamailio 5.6.x on our customers, which apparently was solved with an update to a newer version. One minor thing, the docs that the command need a string value, so try secf_check_country("$gip2(src=>cc)").
Cheers,
Henning
From: Samuel Moya Tinoco smoya@vivelibre.es Sent: Freitag, 8. August 2025 08:57 To: Henning Westerholt hw@gilawa.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello henning,
Thank you for your reply. I'm using kamailio 5.6.3, when I call $gip2(src=>cc) it shows the origin country from the IP. I've test it with several countries and it works well. The problem is when I call secf_check_country($gip2(src=>cc)) that it replies with null.
I've tried to insert into kamailio DDBB secfilter table exactly the output of $gip2(src=>cc), and I can see that it appear when using "kamcmd secfilter.print country" but it seems that the function cannot match it. Also I've tried to insert into the secfilter table all the spelling combinations of the country (both letter uppercase, both lowercase, one uppercase one lowercase, between quotes, etc), and the command "kamcmd secfilter.print country" shows all of them whitelisted but the function still replies with a null
I'm not sure if there's anything I'm doing wrong or what should I try next. Thank you again for your help
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttp://www.vivelibre.es/
[cid:image001.png@01DC0846.4EBF6010]
Soluciones inteligentes para la autonomía personal
De: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com> Enviado el: jueves, 7 de agosto de 2025 13:22 Para: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> CC: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Asunto: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
some years ago, we had a similar issue with geoip with one of our customers. It was not working anymore after a reload. But your problem looks a bit more like it's in secfilter module.
Which version of Kamailio you are using? Does it work when you call $gip2 PV manually?
Cheers,
Henning
From: Samuel Moya Tinoco via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Donnerstag, 7. August 2025 10:08 To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio. After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I've configured secfilter module, and I think it's also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB. But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I've also tried to use $? Variable and it shows "1", in the module documentation I saw that 1 means "the value is not found". But when I use kamcmd secfilter.print I can see the country in the output and it's spelled exactly the same that in $gip2(src=>cc)
I don't know if there's something I'm missing. Any help would be appreciated. Thanks in advance
This is the code I'm executing if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)"); xlog("L_ALERT", "$?"); if ($avp(secfilter) == 2) { return; } xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } And this is what appears in the logs 2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if 2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match 2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country 2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog 2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null> 2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog 2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1 2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if 2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog 2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted 2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country ======= [+] Blacklisted -----------
[+] Whitelisted ----------- 0001 -> ES
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttps://linkprotect.cudasvc.com/url?a=http%3a%2f%2fwww.vivelibre.es%2f&c=E,1,NWBcVcZ8cyc55WJDJDgUZOcQAzfRSiI26NQtFGhFNsk_yH4VxcQUlYyabYbUg0b1y8T12x3bj9NRwZXTRdieidhV2ztX-5wnFxZ_AwIj7GGOAfo-lXkmww,,&typo=1
[cid:image001.png@01DC0846.4EBF6010]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre." "Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre."
Hello again Henning,
Thank you for your reply. I've try to use secf_check_country("$gip2(src=>cc)" but it's still the same. We'll update to a newer version and try again
Thank you again for your help
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttp://www.vivelibre.es/
[cid:image001.png@01DC0859.0D93E4E0]
Soluciones inteligentes para la autonomía personal
De: Henning Westerholt hw@gilawa.com Enviado el: viernes, 8 de agosto de 2025 9:30 Para: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org CC: Samuel Moya Tinoco smoya@vivelibre.es Asunto: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
the documentation seems to have indeed some issues, the $avp(secfilter) seems to be not available. It should be probably fixed in the docs.
Regarding your issue, I can only say that we had a similar issue with Kamailio 5.6.x on our customers, which apparently was solved with an update to a newer version. One minor thing, the docs that the command need a string value, so try secf_check_country("$gip2(src=>cc)").
Cheers,
Henning
From: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Sent: Freitag, 8. August 2025 08:57 To: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello henning,
Thank you for your reply. I'm using kamailio 5.6.3, when I call $gip2(src=>cc) it shows the origin country from the IP. I've test it with several countries and it works well. The problem is when I call secf_check_country($gip2(src=>cc)) that it replies with null.
I've tried to insert into kamailio DDBB secfilter table exactly the output of $gip2(src=>cc), and I can see that it appear when using "kamcmd secfilter.print country" but it seems that the function cannot match it. Also I've tried to insert into the secfilter table all the spelling combinations of the country (both letter uppercase, both lowercase, one uppercase one lowercase, between quotes, etc), and the command "kamcmd secfilter.print country" shows all of them whitelisted but the function still replies with a null
I'm not sure if there's anything I'm doing wrong or what should I try next. Thank you again for your help
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttps://linkprotect.cudasvc.com/url?a=http%3a%2f%2fwww.vivelibre.es%2f&c=E,1,L3SPxT1qEKzp3_Hd2xnZHrhJxIhW3z67WkP22RkW_19E33-XadjkqB2yQjNIAvIa_hgm4kBmiDCI2GeC8T4q0q9xgcu71M6fvSwWxK3PB3M,&typo=1
[cid:image001.png@01DC0859.0D93E4E0]
Soluciones inteligentes para la autonomía personal
De: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com> Enviado el: jueves, 7 de agosto de 2025 13:22 Para: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> CC: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Asunto: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
some years ago, we had a similar issue with geoip with one of our customers. It was not working anymore after a reload. But your problem looks a bit more like it's in secfilter module.
Which version of Kamailio you are using? Does it work when you call $gip2 PV manually?
Cheers,
Henning
From: Samuel Moya Tinoco via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Donnerstag, 7. August 2025 10:08 To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio. After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I've configured secfilter module, and I think it's also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB. But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I've also tried to use $? Variable and it shows "1", in the module documentation I saw that 1 means "the value is not found". But when I use kamcmd secfilter.print I can see the country in the output and it's spelled exactly the same that in $gip2(src=>cc)
I don't know if there's something I'm missing. Any help would be appreciated. Thanks in advance
This is the code I'm executing if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)"); xlog("L_ALERT", "$?"); if ($avp(secfilter) == 2) { return; } xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } And this is what appears in the logs 2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if 2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match 2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country 2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog 2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null> 2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog 2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1 2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if 2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog 2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted 2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country ======= [+] Blacklisted -----------
[+] Whitelisted ----------- 0001 -> ES
Samuel Moya Tinoco Departamento de Sistemas y Redes Móvil: (+34) 606985997 smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre C/ La Orotava 4 28660 Boadilla del Monte Madrid www.vivelibre.eshttps://linkprotect.cudasvc.com/url?a=http%3a%2f%2fwww.vivelibre.es%2f&c=E,1,NWBcVcZ8cyc55WJDJDgUZOcQAzfRSiI26NQtFGhFNsk_yH4VxcQUlYyabYbUg0b1y8T12x3bj9NRwZXTRdieidhV2ztX-5wnFxZ_AwIj7GGOAfo-lXkmww,,&typo=1
[cid:image001.png@01DC0859.0D93E4E0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre." "Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre." "Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre."
Your bigger problem is in this line:
if ($avp(secfilter) == -2) {
The value of $avp(secfilter) is $null because no value was ever assigned to it. Try this (change higlighted):
if (geoip2_match("$si", "src")) { $avp(secfilter) = secf_check_country($gip2(src=>cc)); if ($avp(secfilter) == -2) { xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } }
Kaufman Senior Voice Engineer
E: bkaufman@bcmone.com 24/7 support: 888.543.2000
[img]
SIP.UShttps://sip.us Client Support: 800.566.9810
SIPTRUNKhttps://siptrunk.com Client Support: 800.250.6510
Flowroutehttps://flowroute.com Client Support: 855.356.9768
________________________________ From: Samuel Moya Tinoco via sr-users sr-users@lists.kamailio.org Sent: Friday, August 8, 2025 4:39 AM To: Henning Westerholt hw@gilawa.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Samuel Moya Tinoco smoya@vivelibre.es Subject: [SR-Users] Re: secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Hello again Henning,
Thank you for your reply.
I’ve try to use secf_check_country(“$gip2(src=>cc)” but it’s still the same. We’ll update to a newer version and try again
Thank you again for your help
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
[cid:image001.png@01DC0859.0D93E4E0]
Soluciones inteligentes para la autonomía personal
De: Henning Westerholt hw@gilawa.com Enviado el: viernes, 8 de agosto de 2025 9:30 Para: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org CC: Samuel Moya Tinoco smoya@vivelibre.es Asunto: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
the documentation seems to have indeed some issues, the $avp(secfilter) seems to be not available. It should be probably fixed in the docs.
Regarding your issue, I can only say that we had a similar issue with Kamailio 5.6.x on our customers, which apparently was solved with an update to a newer version. One minor thing, the docs that the command need a string value, so try secf_check_country(“$gip2(src=>cc)”).
Cheers,
Henning
From: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Sent: Freitag, 8. August 2025 08:57 To: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Subject: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello henning,
Thank you for your reply.
I’m using kamailio 5.6.3, when I call $gip2(src=>cc) it shows the origin country from the IP. I’ve test it with several countries and it works well.
The problem is when I call secf_check_country($gip2(src=>cc)) that it replies with null.
I’ve tried to insert into kamailio DDBB secfilter table exactly the output of $gip2(src=>cc), and I can see that it appear when using “kamcmd secfilter.print country” but it seems that the function cannot match it.
Also I’ve tried to insert into the secfilter table all the spelling combinations of the country (both letter uppercase, both lowercase, one uppercase one lowercase, between quotes, etc), and the command “kamcmd secfilter.print country” shows all of them whitelisted but the function still replies with a null
I’m not sure if there’s anything I’m doing wrong or what should I try next.
Thank you again for your help
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
[cid:image001.png@01DC0859.0D93E4E0]
Soluciones inteligentes para la autonomía personal
De: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com> Enviado el: jueves, 7 de agosto de 2025 13:22 Para: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> CC: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Asunto: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
some years ago, we had a similar issue with geoip with one of our customers. It was not working anymore after a reload. But your problem looks a bit more like it’s in secfilter module.
Which version of Kamailio you are using? Does it work when you call $gip2 PV manually?
Cheers,
Henning
From: Samuel Moya Tinoco via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Donnerstag, 7. August 2025 10:08 To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio.
After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I’ve configured secfilter module, and I think it’s also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB.
But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I’ve also tried to use $? Variable and it shows “1”, in the module documentation I saw that 1 means “the value is not found”. But when I use kamcmd secfilter.print I can see the country in the output and it’s spelled exactly the same that in $gip2(src=>cc)
I don’t know if there’s something I’m missing. Any help would be appreciated.
Thanks in advance
This is the code I’m executing
if (geoip2_match("$si", "src")) {
secf_check_country($gip2(src=>cc));
xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)");
xlog("L_ALERT", "$?");
if ($avp(secfilter) == 2) {
return;
}
xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted");
exit;
}
And this is what appears in the logs
2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if
2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match
2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country
2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog
2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null>
2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog
2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1
2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if
2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog
2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted
2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country
root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country
=======
[+] Blacklisted
-----------
[+] Whitelisted
-----------
0001 -> ES
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
[cid:image001.png@01DC0859.0D93E4E0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”
Can you try something like:
if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); if ($? == -2) { xdbg("$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } }
On Fri, 8 Aug 2025 at 14:46, Ben Kaufman via sr-users < sr-users@lists.kamailio.org> wrote:
Your bigger problem is in this line:
if ($avp(secfilter) == -2) {
The value of $avp(secfilter) is $null because no value was ever assigned to it. Try this (change higlighted):
if (geoip2_match("$si", "src")) { $avp(secfilter) = secf_check_country($gip2(src=>cc)); if ($avp(secfilter) == -2) { xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } }
*Kaufman*
*Senior Voice Engineer *
E: bkaufman@bcmone.com 24/7 support: 888.543.2000
[image: img]
SIP.US https://sip.us Client Support: 800.566.9810
SIPTRUNK https://siptrunk.com Client Support: 800.250.6510
Flowroute https://flowroute.com Client Support: 855.356.9768
*From:* Samuel Moya Tinoco via sr-users sr-users@lists.kamailio.org *Sent:* Friday, August 8, 2025 4:39 AM *To:* Henning Westerholt hw@gilawa.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Cc:* Samuel Moya Tinoco smoya@vivelibre.es *Subject:* [SR-Users] Re: secfilter secf_check_country($gip2(src=>cc)) always replies null
*CAUTION:* This email originated from outside the organization. *Do not click links or open attachments* unless you recognize the sender and know the content is safe.
Hello again Henning,
Thank you for your reply.
I’ve try to use secf_check_country(“$gip2(src=>cc)” but it’s still the same. We’ll update to a newer version and try again
Thank you again for your help
*Samuel Moya Tinoco*
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
*smoya@vivelibre.es smoya@vivelibre.es*
*ViveLibre*
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
*www.vivelibre.es https://urldefense.com/v3/__http://www.vivelibre.es/__;!!KWzduNI!Z_HNcvt-J0_WI85yUmjeSXF7iHpA-B8UNcLzr0rB1lFXy2FXd4a42QmevjlXOY8uaK_wEwxmdpMS1v4omWlxPDo$*
Soluciones inteligentes para la autonomía personal
*De:* Henning Westerholt hw@gilawa.com *Enviado el:* viernes, 8 de agosto de 2025 9:30 *Para:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *CC:* Samuel Moya Tinoco smoya@vivelibre.es *Asunto:* RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
the documentation seems to have indeed some issues, the $avp(secfilter) seems to be not available. It should be probably fixed in the docs.
Regarding your issue, I can only say that we had a similar issue with Kamailio 5.6.x on our customers, which apparently was solved with an update to a newer version. One minor thing, the docs that the command need a string value, so try secf_check_country(“$gip2(src=>cc)”).
Cheers,
Henning
*From:* Samuel Moya Tinoco <*smoya@vivelibre.es smoya@vivelibre.es*> *Sent:* Freitag, 8. August 2025 08:57 *To:* Henning Westerholt <*hw@gilawa.com hw@gilawa.com*>; Kamailio (SER) - Users Mailing List <*sr-users@lists.kamailio.org sr-users@lists.kamailio.org*> *Subject:* RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello henning,
Thank you for your reply.
I’m using kamailio 5.6.3, when I call $gip2(src=>cc) it shows the origin country from the IP. I’ve test it with several countries and it works well.
The problem is when I call secf_check_country($gip2(src=>cc)) that it replies with null.
I’ve tried to insert into kamailio DDBB secfilter table exactly the output of $gip2(src=>cc), and I can see that it appear when using “*kamcmd secfilter.print country*” but it seems that the function cannot match it.
Also I’ve tried to insert into the secfilter table all the spelling combinations of the country (both letter uppercase, both lowercase, one uppercase one lowercase, between quotes, etc), and the command “*kamcmd secfilter.print country*” shows all of them whitelisted but the function still replies with a null
I’m not sure if there’s anything I’m doing wrong or what should I try next.
Thank you again for your help
*Samuel Moya Tinoco*
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
*smoya@vivelibre.es smoya@vivelibre.es*
*ViveLibre*
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
Soluciones inteligentes para la autonomía personal
*De:* Henning Westerholt <*hw@gilawa.com hw@gilawa.com*> *Enviado el:* jueves, 7 de agosto de 2025 13:22 *Para:* Kamailio (SER) - Users Mailing List <*sr-users@lists.kamailio.org sr-users@lists.kamailio.org*> *CC:* Samuel Moya Tinoco <*smoya@vivelibre.es smoya@vivelibre.es*> *Asunto:* RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
Hello,
some years ago, we had a similar issue with geoip with one of our customers. It was not working anymore after a reload. But your problem looks a bit more like it’s in secfilter module.
Which version of Kamailio you are using? Does it work when you call $gip2 PV manually?
Cheers,
Henning
*From:* Samuel Moya Tinoco via sr-users <*sr-users@lists.kamailio.org sr-users@lists.kamailio.org*> *Sent:* Donnerstag, 7. August 2025 10:08 *To:* Kamailio (SER) - Users Mailing List <*sr-users@lists.kamailio.org sr-users@lists.kamailio.org*> *Cc:* Samuel Moya Tinoco <*smoya@vivelibre.es smoya@vivelibre.es*> *Subject:* [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio.
After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I’ve configured secfilter module, and I think it’s also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB.
But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I’ve also tried to use $? Variable and it shows “1”, in the module documentation I saw that 1 means “the value is not found”. But when I use kamcmd secfilter.print I can see the country in the output and it’s spelled exactly the same that in $gip2(src=>cc)
I don’t know if there’s something I’m missing. Any help would be appreciated.
Thanks in advance
This is the code I’m executing
if (geoip2_match("$si", "src")) {
secf_check_country($gip2(src=>cc)); xlog("L_ALERT", "La respuesta de de secfilter es
$avp(secfilter)");
xlog("L_ALERT", "$?"); if ($avp(secfilter) == 2) { return; } xlog("L_ALERT", "$rm from $si blocked because Country
'$gip2(src=>cc)' is blacklisted");
exit; }
And this is what appears in the logs
2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if
2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match
2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country
2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog
2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} <script>: La respuesta de de secfilter es <null>
2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog
2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} <script>: 1
2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if
2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog
2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted
2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS *fabe0744-1fca28e3-83050f4@127.0.0.1 fabe0744-1fca28e3-83050f4@127.0.0.1*} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country
root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country
=======
[+] Blacklisted
-----------
[+] Whitelisted
----------- 0001 -> ES
*Samuel Moya Tinoco*
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
*smoya@vivelibre.es smoya@vivelibre.es*
*ViveLibre*
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
Soluciones inteligentes para la autonomía personal
*"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico **protecciondedatos@vivelibre.es protecciondedatos@vivelibre.es**. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”*
*"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico **protecciondedatos@vivelibre.es protecciondedatos@vivelibre.es**. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”* *"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.es protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Not really an answer here, but more of a question: How is this supposed to work? Why would $avp(secfilter) be set at all? I know that this is basically the example from the secfilter documentation:
if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); if ($avp(secfilter) == -2) { xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } }
Is $avp(secfilter) automatically reserved by the module? If so, it doesn't appear to be documented. I would try checking it against $rc, or better yet, assigning the return of secf_check_country() to a variable:
$avp(secf_cc_rc) = secf_check_country($gip2(src=>cc)); if ( $avp(secf_cc_rc) == -2 ) { ## code here }
Finally, it looks odd that the argument to secf_check_country() isn't quoted, but maybe that's just my early morning eyes.
Regards, Kaufman
________________________________ From: Samuel Moya Tinoco via sr-users sr-users@lists.kamailio.org Sent: Thursday, August 7, 2025 3:08 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Samuel Moya Tinoco smoya@vivelibre.es Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio.
After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I’ve configured secfilter module, and I think it’s also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB.
But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I’ve also tried to use $? Variable and it shows “1”, in the module documentation I saw that 1 means “the value is not found”. But when I use kamcmd secfilter.print I can see the country in the output and it’s spelled exactly the same that in $gip2(src=>cc)
I don’t know if there’s something I’m missing. Any help would be appreciated.
Thanks in advance
This is the code I’m executing
if (geoip2_match("$si", "src")) {
secf_check_country($gip2(src=>cc));
xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)");
xlog("L_ALERT", "$?");
if ($avp(secfilter) == 2) {
return;
}
xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted");
exit;
}
And this is what appears in the logs
2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if
2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match
2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country
2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog
2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null>
2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog
2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1
2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if
2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog
2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted
2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country
root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country
=======
[+] Blacklisted
-----------
[+] Whitelisted
-----------
0001 -> ES
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
[cid:image001.png@01DC0780.5D6264D0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”
After looking through the rest of the secfilter documentation, the examples for all other functions it exports evaluate against $? rather than $avp(secfilter), so it seems very likely the documentation is in error.
As a side observation is $? deprecated? It's not listed at all in the pseudovariable documentation, and has only one mention in the core documentation.
https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/pse... https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/cor...
Regards, Kaufman
________________________________ From: Ben Kaufman via sr-users sr-users@lists.kamailio.org Sent: Thursday, August 7, 2025 7:51 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Ben Kaufman bkaufman@bcmone.com Subject: [SR-Users] Re: secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Not really an answer here, but more of a question: How is this supposed to work? Why would $avp(secfilter) be set at all? I know that this is basically the example from the secfilter documentation:
if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); if ($avp(secfilter) == -2) { xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } }
Is $avp(secfilter) automatically reserved by the module? If so, it doesn't appear to be documented. I would try checking it against $rc, or better yet, assigning the return of secf_check_country() to a variable:
$avp(secf_cc_rc) = secf_check_country($gip2(src=>cc)); if ( $avp(secf_cc_rc) == -2 ) { ## code here }
Finally, it looks odd that the argument to secf_check_country() isn't quoted, but maybe that's just my early morning eyes.
Regards, Kaufman
________________________________ From: Samuel Moya Tinoco via sr-users sr-users@lists.kamailio.org Sent: Thursday, August 7, 2025 3:08 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Samuel Moya Tinoco smoya@vivelibre.es Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio.
After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I’ve configured secfilter module, and I think it’s also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB.
But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I’ve also tried to use $? Variable and it shows “1”, in the module documentation I saw that 1 means “the value is not found”. But when I use kamcmd secfilter.print I can see the country in the output and it’s spelled exactly the same that in $gip2(src=>cc)
I don’t know if there’s something I’m missing. Any help would be appreciated.
Thanks in advance
This is the code I’m executing
if (geoip2_match("$si", "src")) {
secf_check_country($gip2(src=>cc));
xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)");
xlog("L_ALERT", "$?");
if ($avp(secfilter) == 2) {
return;
}
xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted");
exit;
}
And this is what appears in the logs
2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if
2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match
2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country
2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog
2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null>
2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog
2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1
2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if
2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog
2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted
2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country
root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country
=======
[+] Blacklisted
-----------
[+] Whitelisted
-----------
0001 -> ES
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
[cid:image001.png@01DC0780.5D6264D0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”
Hi Ben,
the $? Is not deprecated. Its probably just not documented in the PV page, should be added there.
Cheers,
Henning
From: Ben Kaufman via sr-users sr-users@lists.kamailio.org Sent: Donnerstag, 7. August 2025 14:59 To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Ben Kaufman bkaufman@bcmone.com Subject: [SR-Users] Re: secfilter secf_check_country($gip2(src=>cc)) always replies null
After looking through the rest of the secfilter documentation, the examples for all other functions it exports evaluate against $? rather than $avp(secfilter), so it seems very likely the documentation is in error.
As a side observation is $? deprecated? It's not listed at all in the pseudovariable documentation, and has only one mention in the core documentation.
https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/pse... https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/cor...
Regards, Kaufman
________________________________ From: Ben Kaufman via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Thursday, August 7, 2025 7:51 AM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com> Subject: [SR-Users] Re: secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Not really an answer here, but more of a question: How is this supposed to work? Why would $avp(secfilter) be set at all? I know that this is basically the example from the secfilter documentation:
if (geoip2_match("$si", "src")) { secf_check_country($gip2(src=>cc)); if ($avp(secfilter) == -2) { xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted"); exit; } }
Is $avp(secfilter) automatically reserved by the module? If so, it doesn't appear to be documented. I would try checking it against $rc, or better yet, assigning the return of secf_check_country() to a variable:
$avp(secf_cc_rc) = secf_check_country($gip2(src=>cc)); if ( $avp(secf_cc_rc) == -2 ) { ## code here }
Finally, it looks odd that the argument to secf_check_country() isn't quoted, but maybe that's just my early morning eyes.
Regards, Kaufman
________________________________ From: Samuel Moya Tinoco via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Thursday, August 7, 2025 3:08 AM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio.
After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I've configured secfilter module, and I think it's also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB.
But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I've also tried to use $? Variable and it shows "1", in the module documentation I saw that 1 means "the value is not found". But when I use kamcmd secfilter.print I can see the country in the output and it's spelled exactly the same that in $gip2(src=>cc)
I don't know if there's something I'm missing. Any help would be appreciated.
Thanks in advance
This is the code I'm executing
if (geoip2_match("$si", "src")) {
secf_check_country($gip2(src=>cc));
xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)");
xlog("L_ALERT", "$?");
if ($avp(secfilter) == 2) {
return;
}
xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted");
exit;
}
And this is what appears in the logs
2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if
2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match
2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country
2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog
2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null>
2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog
2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1
2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if
2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog
2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted
2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country
root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country
=======
[+] Blacklisted
-----------
[+] Whitelisted
-----------
0001 -> ES
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
[cid:image001.png@01DC07D7.A7D305E0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre."
PR submitted.
Regards, Kaufman
________________________________ From: Henning Westerholt hw@gilawa.com Sent: Thursday, August 7, 2025 1:12 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Ben Kaufman bkaufman@bcmone.com Subject: RE: secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Hi Ben,
the $? Is not deprecated. Its probably just not documented in the PV page, should be added there.
Cheers,
Henning
From: Ben Kaufman via sr-users sr-users@lists.kamailio.org Sent: Donnerstag, 7. August 2025 14:59 To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Ben Kaufman bkaufman@bcmone.com Subject: [SR-Users] Re: secfilter secf_check_country($gip2(src=>cc)) always replies null
After looking through the rest of the secfilter documentation, the examples for all other functions it exports evaluate against $? rather than $avp(secfilter), so it seems very likely the documentation is in error.
As a side observation is $? deprecated? It's not listed at all in the pseudovariable documentation, and has only one mention in the core documentation.
https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/pse...https://urldefense.com/v3/__https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/pseudovariables.md__;!!KWzduNI!aAdeqDxKwaSlT-Nwxj56VnoLGATXmzIWR2xhRQGBmn65TUgKp3qkmpVIA_o_v8lpYYqJ4EPC1Q$
https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/cor...https://urldefense.com/v3/__https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/6.0.x/core.md__;!!KWzduNI!aAdeqDxKwaSlT-Nwxj56VnoLGATXmzIWR2xhRQGBmn65TUgKp3qkmpVIA_o_v8lpYYrxETgoVg$
Regards,
Kaufman
________________________________
From: Ben Kaufman via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Thursday, August 7, 2025 7:51 AM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Ben Kaufman <bkaufman@bcmone.commailto:bkaufman@bcmone.com> Subject: [SR-Users] Re: secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Not really an answer here, but more of a question: How is this supposed to work? Why would $avp(secfilter) be set at all? I know that this is basically the example from the secfilter documentation:
if (geoip2_match("$si", "src")) {
secf_check_country($gip2(src=>cc));
if ($avp(secfilter) == -2) {
xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted");
exit;
}
}
Is $avp(secfilter) automatically reserved by the module? If so, it doesn't appear to be documented. I would try checking it against $rc, or better yet, assigning the return of secf_check_country() to a variable:
$avp(secf_cc_rc) = secf_check_country($gip2(src=>cc));
if ( $avp(secf_cc_rc) == -2 ) {
## code here
}
Finally, it looks odd that the argument to secf_check_country() isn't quoted, but maybe that's just my early morning eyes.
Regards,
Kaufman
________________________________
From: Samuel Moya Tinoco via sr-users <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Sent: Thursday, August 7, 2025 3:08 AM To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Cc: Samuel Moya Tinoco <smoya@vivelibre.esmailto:smoya@vivelibre.es> Subject: [SR-Users] secfilter secf_check_country($gip2(src=>cc)) always replies null
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Good morning everyone,
Im trying to configure secfilter module to harden our kamailio.
After configuring geoip2 module and checking that using function geoip2_match("$si", "src") it shows the country properly. I’ve configured secfilter module, and I think it’s also working because kamailio service starts and with kamcmd secfilter.print I can see the entries from the DDBB.
But when I call the function secf_check_country($gip2(src=>cc)) it always replies with <null> (I saw it in this variable $avp(secfilter)). I’ve also tried to use $? Variable and it shows “1”, in the module documentation I saw that 1 means “the value is not found”. But when I use kamcmd secfilter.print I can see the country in the output and it’s spelled exactly the same that in $gip2(src=>cc)
I don’t know if there’s something I’m missing. Any help would be appreciated.
Thanks in advance
This is the code I’m executing
if (geoip2_match("$si", "src")) {
secf_check_country($gip2(src=>cc));
xlog("L_ALERT", "La respuesta de de secfilter es $avp(secfilter)");
xlog("L_ALERT", "$?");
if ($avp(secfilter) == 2) {
return;
}
xlog("L_ALERT", "$rm from $si blocked because Country '$gip2(src=>cc)' is blacklisted");
exit;
}
And this is what appears in the logs
2025-08-07T09:42:54.876178+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1061 a=16 n=if
2025-08-07T09:42:54.876219+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1049 a=26 n=geoip2_match
2025-08-07T09:42:54.876252+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1051 a=32 n=secf_check_country
2025-08-07T09:42:54.876291+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1052 a=26 n=xlog
2025-08-07T09:42:54.876473+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: La respuesta de de secfilter es <null>
2025-08-07T09:42:54.876513+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1053 a=26 n=xlog
2025-08-07T09:42:54.876556+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: 1
2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=16 n=if
2025-08-07T09:42:54.876619+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1058 a=26 n=xlog
2025-08-07T09:42:54.876651+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: ALERT: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} <script>: OPTIONS from 91.228.91.69 blocked because Country 'ES' is blacklisted
2025-08-07T09:42:54.876682+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS fabe0744-1fca28e3-83050f4@127.0.0.1mailto:fabe0744-1fca28e3-83050f4@127.0.0.1} *** cfgtrace:dbg_cfg_trace(): request_route=[GEOIP] c=[/etc/kamailio/kamailio.cfg] l=1059 a=2 n=exit
The output of kamcmd secfilter.print country
root@PRE-KAMAILIO:/etc/kamailio# kamcmd secfilter.print country
Country
=======
[+] Blacklisted
-----------
[+] Whitelisted
-----------
0001 -> ES
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya@vivelibre.esmailto:smoya@vivelibre.es
ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
[cid:image001.png@01DC07D7.A7D305E0]
Soluciones inteligentes para la autonomía personal
"Tanto este mensaje como todos los posibles documentos adjuntos al mismo son confidenciales y están dirigidos exclusivamente a los destinatarios de los mismos. Por favor, si Usted no es uno de dichos destinatarios, notifíquenos este hecho y elimine el mensaje de su sistema. Queda prohibida la copia, difusión o revelación de su contenido a terceros sin el previo consentimiento por escrito de VIVELIBRE AUTONOMÍA PERSONAL S.L.U. (VIVELIBRE). En caso contrario, vulnerará la legislación vigente. De conformidad con lo establecido en el Reglamento (UE) 2016/679, General de Protección de Datos, le informamos de que sus datos son objeto de tratamiento por VIVELIBRE, en calidad de Responsable del Tratamiento. VIVELIBRE tratará sus datos con la finalidad de mantener la relación contractual, gestionar su solicitud, así como remitirle comunicaciones de carácter comercial relacionadas con su ámbito de actividad y los servicios prestados. Si desea ejercitar sus derechos de acceso, rectificación, supresión, limitación, oposición o portabilidad, puede dirigirse a la dirección postal Calle de la Orotava 4, 28660, Boadilla del Monte, (Madrid) o a la dirección de correo electrónico protecciondedatos@vivelibre.esmailto:protecciondedatos@vivelibre.es. Para obtener más información sobre cómo tratamos sus datos, consulta nuestra Política de Privacidad en Política de Privacidad - Vivelibre.”