Re: secfilter secf_check_country($gip2(src=>cc)) always replies null

Henning Westerholt via sr-users <[email protected]>
Newsgroups gmane.comp.voip.ser
Message-ID <AS8PR07MB810370017845D9ADE8D1C6E6BF2CA@AS8PR07MB8103.eurprd07.prod.outlook.com>
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 <[email protected]>
Sent: Donnerstag, 7. August 2025 10:08
To: Kamailio (SER) - Users Mailing List <[email protected]>
Cc: Samuel Moya Tinoco <[email protected]>
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 [email protected]<mailto:[email protected]>} *** 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 [email protected]<mailto:[email protected]>} *** 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 [email protected]<mailto:[email protected]>} *** 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 [email protected]<mailto:[email protected]>} *** 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 [email protected]<mailto:[email protected]>} <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 [email protected]<mailto:[email protected]>} *** 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 [email protected]<mailto:[email protected]>} <script>: 1
2025-08-07T09:42:54.876587+02:00 PRE-KAMAILIO /usr/sbin/kamailio[1393]: exec: {1 1 OPTIONS [email protected]<mailto:[email protected]>} *** 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 [email protected]<mailto:[email protected]>} *** 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 [email protected]<mailto:[email protected]>} <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 [email protected]<mailto:[email protected]>} *** 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
[email protected]<mailto:[email protected]>

ViveLibre
C/ La Orotava 4
28660 Boadilla del Monte
Madrid
www.vivelibre.es<http://www.vivelibre.es/>

[cid:[email protected]]

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 [email protected]<mailto:[email protected]>. 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 -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
image001.png (image/png, 3.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.