My bad, I forgot to make something clear.

 

The IF statement is in a different route which is called by de main request_route. So when the return statement is executed the control is passed back to the main request_route, which in turn relays the INVITE back to itself. That’s probably causing the 483 Too Many Hops response?

 

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 12:31 PM
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] append_hf to reply generated by kamailio

 

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;

                }

 

.....

               

}