Hello Kamailio Community,
I'm currently working on a project that involves complex SIP routing and handling.
I've encountered some difficulties while using change_reply_status, and append_hf
functions in failure_route route in Kamailio. Although the documentation does provide
guidance, the behaviors I am experiencing aren't aligning with the expected outcomes.
Issue 1: failure_route
I've set up a failure_route to handle specific SIP response codes (>4xx). However,
I've observed that it get trigered and lunched, but I can't use
change_reply_status or append_hf, I was using this first in onreply_route.
Issue 2: change_reply_status
I tried to use the change_reply_status function to modify the status of SIP replies, but
it raises an error that this command cannot be executed here.
Issue 3: append_hf
I've also attempted to use append_hf in my failure_route block to add headers to
replies, but the headers are not being added as expected.
As a workaround, I've been using send_reply and append_to_reply for adding custom
headers, and they seem to be working as expected. However, I found some old messages in
kamailio mailing list, I can summerize what I learned like this ```
#Functions and Context
- append_hf(): Adds a header to the currently processed SIP message. If you are in a route
{...} block, then this adds the header to the request. If you are in an onreply_route, it
adds the header to the reply. This function always acts on the message currently under
scrutiny.
- append_to_reply(): This function is used to add a header to a reply that will be
generated by Kamailio at a later time. This function only affects replies generated by
Kamailio itself and is not applicable for messages that are simply being forwarded.
#Contexts
- route {...}: This is typically where the incoming SIP request gets processed. Here,
append_hf() will add headers to that request, and append_to_reply() will add headers to
any replies that Kamailio might generate for this request.
- onreply_route: This is where incoming SIP replies are processed. Here, append_hf() will
act on the reply, not the request.
``` I'd like to know if there is a way to handle sip replies in failure_route, because
send_reply make a new reply from kamailio, instead I want to keep some important headers
from the original reply.
I'd appreciate any insights or guidance the community can offer.
Best regards,