SIP Router Project


FS#194 - Record-Route and msg_apply_changes()

Attached to Project: sip-router
Opened by Jasmin Schnatterbeck (jasmin) - Wednesday, 28 December 2011, 19:40 GMT
Last edited by Daniel-Constantin Mierla (miconda) - Thursday, 29 December 2011, 09:24 GMT
Task Type Improvement
Category Core
Status Assigned
Assigned To Daniel-Constantin Mierla (miconda)
Operating System All
Severity Medium
Priority Normal
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No



in kamailio 3.2.1 Record-Route Header is inserted twice, if

- msg_apply_changes() is called after record_route()


- rr params are added after msg_apply_changes()

I’ve just investigated record.c and I think the reason is, that add_rr_param() tries to recognize if rr has already been called/inserted depending on whether there is a corresponding lump for that - what is not the case, if msg_apply_changes() has been called before (I think it does not keep (but applies) lumps).

If that’s correct, it’s may possible to solve that (proposal):
- by adding a new message flag indicating whether rr has already been inserted or not and
- by creating a new lump anchor in add_rr_param() if rr has already been inserted and no lump is available for adding the rr param


This task depends upon

Comment by Daniel-Constantin Mierla (miconda) - Thursday, 29 December 2011, 09:24 GMT

msg_apply_changes() updates the msg buffer applying all the changes, like being received from the net, no history of changes is kept. This is why the function has to be used carefully and understand what it does. You can add the param before applying changes or do record route after it. It is recommended to do record route after it in case you have bridging of transport layer (e.g., udp to tcp), as a second route header is inserted at relay time.

If you can provide a patch, I can look at.

I change this task to improvement.