I wonder whether changing the expire value constantly will impact all expires, as opposed to just the one you’re trying to set it to. If, say you lower it for a register, will that expire all existing registers?
Actually, my idea was to do something like this before handing the REGISTER to registrar save() function:
remove_hf("Expires");
append_hf("Expires: 200\r\n");
However, this didn't work (or at least, it doesn't work with kamailio 4.3.7 which is the one I use).
But I found a solution for my problem:
Starting from kamailio 5.0, registrar function save() supports this new flag:
0x08 - Do not apply expires_range or default_expires_range to this registration. https://kamailio.org/docs/modules/5.0.x/modules/registrar.html#registrar.f.saveI actually don't need to specify an Expires value in the REGISTER reply. I just need to allow a higher Expires value for some UACs (actually SIP servers registering with Kamailio).
I have not tested it yet but based on the description, it should work.