@schoberw: maybe you can sort it out with the body line cursors:
- https://www.kamailio.org/docs/modules/stable/modules/textopsx.html#textopsx....
You can also take in consideration to process the body in Lua, JS or Python, via Kemi exports (you can do inline execution of a script, not full replacement of routing blocks with kemi).
I am going to close this one, based on the links to rfc. Further discussions can be done on sr-users mailing list.