The documentation says "remove + generate", so I'd say this is then buggy behavior.

I looked briefly at the code and ... it's a bit questionable if it would work but in some certain combinations of calls.

  1. To either replace or remove the header is conditioned additionally by _siputils_pcv_status == PCV_PARSED. From what I could deduce, that's not set, unless you tried to get that header and it was parsed... I have no idea why replace/remove would be conditioned by that. (But when it works, then removes both the value and the header name, I think.)

  2. Adding the header is done with a lump at a position which seems a bit... arbitrary to me: msg->parsed - msg->buf, so where the parsing stopped before. Lumps were always scary to me, so I'd guess maybe some deleted headers pushes it in the message body. Also: the added part is just the header value, skipping the header name part, albeit that's written in a buffer. So matches what you see in the message. I'm wondering how it would work for a simple generate...

  3. The last issue is why it's the same value, which I don't know if it still matters given 1&2. There are some parsing-back extra complications after generating, so that might be the issue. Or lumps issues again?

Maybe @neutrino38 can pitch in?

P.S. I'd suggest an alternative path, to only generate a PCV value in C-code and return it to the script (or if there is a UUID/unique/etc generator function in the script that'd be enough), then use other script functions to add the header with that value wherever you want, remove older values, etc.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3929/2329769156@github.com>