[SR-Users] Removing headers in a failure route on 3xx redirect
Daniel-Constantin Mierla
miconda at gmail.com
Mon Jul 13 08:55:32 CEST 2015
Hello,
if you want to have different headers for each destination you attempt
to route to, use a branch_route where you add the headers. What is added
in request_route before creating the transaction is going to be common
for all outgoing branches.
Cheers,
Daniel
On 09/07/15 17:11, Daniel Tryba wrote:
> I'm adding and removing headers in the standard route[RELAY], but if there is
> a redirection involved headers aren't removed.
>
> route[RELAY]
> {
> #stdstuff
> route(ADDCHECKSUM);
>
> # enable additional event routes for forwarded requests
> # - serial forking, RTP relaying handling, a.s.o.
> if (is_method("INVITE|SUBSCRIBE")) {
> t_on_branch("MANAGE_BRANCH");
> t_on_reply("MANAGE_REPLY");
> }
> if (is_method("INVITE")) {
> t_on_failure("MANAGE_FAILURE");
> }
>
> if (!t_relay()) {
> sl_reply_error();
> }
> exit;
> }
>
> route[ADDCHECKSUM]
> {
> if($avp(dst_accountcode) || $avp(src_accountcode))
> {
> #some magic
> remove_hf("X-rand");
> remove_hf("X-csum");
>
> append_hf("X-rand: $var(rand)\r\n");
> append_hf("X-csum: $var(checksum)\r\n");
> }
>
> return;
> }
>
> This works well unless the destination is a redirecting sip server.
>
> failure_route[MANAGE_FAILURE] {
> route(NATMANAGE);
>
> if (t_is_canceled()) {
> exit;
> }
>
> if (t_check_status("3[0-9][0-9]"))
> {
> #...
> route(RELAY);
> exit;
> }
>
>
> -user calls destination.
> -dispatcher sets destination is send to redirectserver and routes to RELAY,
> addchecksums add some headers called from relay.
> -redirectserver replies 302.
> -failure route triggers and ends with a route to RELAY. Any existing old
> values should be removed and the newer ones added.
>
> But end the result is that I have two sets op X-rand/csum headers for the
> INVITE to the redirection contact. How do I get rid of every X-csum/rand
> header except the last added ones?
>
> Version tested: 4.2.5.
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
More information about the sr-users
mailing list