Hello,

 

there have several fixes and changes to the redis support inside Kamailio since the 5.2.x times. So, my first recommendation would be do an update to the latest 5.6 version, for example.

If you can deactivate the method filtering, this is of course an valid work-around.

 

Cheers,

 

Henning

 

From: Koldo Aingeru <koldo.aingeru@sarenet.es>
Sent: Mittwoch, 17. Mai 2023 11:54
To: sr-users@lists.kamailio.org
Subject: [SR-Users] db_redis and ursloc - problem after restarting kamailio

 

Hi,

 

I've encountered a problem using db_redis for location, we recently migrated to redis from mysql and just found out this yesterday. 

 

We are using the usrloc module with db_mode = 2, so the location info is written to redis every 60 seconds. When restarting, Kamailio reads all the contacts and loads them into memory, but for some contacts it loads the “methods” key with an incorrect value. 

 

If in the REGISTER there are no methods kamailio saves it with methods= -1:

 

{

  "jsonrpc":  "2.0",

  "result": {

    "AoR":  “zzzzzzz",

    "Contacts": [{

        "Contact":  {

          "Address":  "sip:1540305477794@W.X.Y.Z:5060",

          "Expires":  2752,

          "Q":  -1,

          "Call-ID":  "7d3965a85bfd0e88-32357@W.X.Y.Z",

          "CSeq": 11,

          "User-Agent": “xxxxxxx",

          "Received": "sip:W.X.Y.Z:5060",

          "Path": "<sip:A.B.C.D;lr;received=sip:W.X.Y.Z:5060>",

          "State":  "CS_SYNC",

          "Flags":  0,

          "CFlags": 64,

          "Socket": “udp:A.B.C.D:5060",

          "Methods":  -1,

          "Ruid": "uloc-644a176b-6472-4641",

          "Instance": "[not set]",

          "Reg-Id": 0,

          "Server-Id":  0,

          "Tcpconn-Id": -1,

          "Keepalive":  1,

          "Last-Keepalive": 1684246829,

          "Last-Modified":  1684246829

        }

      }]

  },

  "id": 19286

}

 

But when restarting kamailio, the same contacts has a methods= 0

 

{

  "jsonrpc":  "2.0",

  "result": {

    "AoR":  “zzzzzzz",

    "Contacts": [{

        "Contact":  {

          "Address":  "sip:1540305477794@W.X.Y.Z:5060",

          "Expires":  2697,

          "Q":  -1,

          "Call-ID":  "7d3965a85bfd0e88-32357@W.X.Y.Z",

          "CSeq": 11,

          "User-Agent": “xxxxxxx",

          "Received": "sip:W.X.Y.Z:5060",

          "Path": "<sip:A.B.C.D;lr;received=sip:W.X.Y.Z:5060>",

          "State":  "CS_SYNC",

          "Flags":  0,

          "CFlags": 64,

          "Socket": “udp:A.B.C.D:5060",

          "Methods”:  0,

          "Ruid": "uloc-644a176b-6472-4641",

          "Instance": "[not set]",

          "Reg-Id": 0,

          "Server-Id":  0,

          "Tcpconn-Id": -1,

          "Keepalive":  1,

          "Last-Keepalive": 1684246829,

          "Last-Modified":  1684246829

        }

      }]

  },

  "id": 19286

}

 

 

In the schema file for redis the key is correctly set as int and in redis I can see it saved as -1.

 

So when a call comes in, the lookup() function returns a -2 as it doesn’t support the INVITE method and the call fails.

 

This is happening in kamailio 5.2.8 and kamailio 5.2.1 (old versions, I know, we are working on updating it); with mysql as a backend it works perfectly after a restart.

 

We do have the param method_filtering=1 , changing to 0 makes it works.  We seem to have this since forever and for what I can see, is not unusual as is in the default kamailio.cfg provided (even the default value for it is 0).

 

Has anyone else encountered this?

 

 

Thanks!

========================================

Koldo Aingeru Marcos Fdez.  

Ingeniería de Sistemas

Sarenet S.A.U.

944209470

Parque Tecnológico, Edificio 103

48170 Zamudio, Bizkaia

========================================