Replacing the exit statement with return, does the trick. The reply reaches the onreply_route and that’s where I add the header, but after a while it generates a 483 Too Many Hops.
My capture server also receives a lot of INVITE, ACK, 603 messages. A lot of Via and Record-Route headers are added to the INVITE and 603 (Via only).
Why does this happen?
From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Grant Bagdasarian
Sent: Thursday, October 3, 2013 11:39 AM
To: sr-users@lists.sip-router.org
Subject: [SR-Users] append_hf to reply generated by kamailio
Hello,
Is it possible to append a new header to a reply generated by Kamailio and also have it present when duplicating the message to a capture server?
At the moment the 603 Reply is duplicated to my capture server, but I don’t know how to append a new header, because the kamailio script stops executing after exit is called.
From what I understood: onreply_route is only executed when receiving replies.
Is there a reply_route which is executed for all replies, including the ones generated by kamailio itself?
For instance inside this code block:
request_route {
.....
if($var(routing_query_result) =~ "DESTINATION_NOT_ALLOWED") {
xlog("L_INFO", "[R-CORE-INCOMING-INVITE:$ci] !>" "Rejecting the call, because the destination is not allowed\r\n");
sl_send_reply("603", "Decline");
exit;
}
.....
}