Hello,

 

please have a look here http://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers_or

 

Cheers,

 

Henning

 

--

Henning Westerholt – https://skalatan.de/blog/

Kamailio services – https://gilawa.com

 

From: sr-users <sr-users-bounces@lists.kamailio.org> On Behalf Of Richard Robson
Sent: Tuesday, September 7, 2021 2:10 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: [SR-Users] via header not removed wit hremove_hf()

 

during testing I need to remove a Via header

 

This is the code snippet

 

route[REPLACE_VIA] {

    xlog ("L_INFO", "[REPLACE_VIA] Start of block\n");

    xlog ("L_INFO", "[REPLACE_VIA] $hdrc(Via) Via headers\n");

        if(remove_hf("Via")) {

                xlog ("L_INFO", "[REPLACE_VIA] removed Via\n");

        }

        else {

                xlog ("L_INFO", "[REPLACE_VIA] did not remove Via\n");

        }

    xlog ("L_INFO", "[REPLACE_VIA] $hdrc(Via) Via headers\n");

 

 

and this is the logs output

 

Sep  7 08:00:00 INFO: _LOG: 3a547f956d65fe985ba189916047fc320ae150ad: [REPLACE_RURI] Start of block

Sep  7 08:00:00 INFO: _LOG: 3a547f956d65fe985ba189916047fc320ae150ad: [REPLACE_VIA] Start of block

Sep  7 08:00:00 INFO: _LOG: 3a547f956d65fe985ba189916047fc320ae150ad: [REPLACE_VIA] 1 Via headers

Sep  7 08:00:00 INFO: _LOG: 3a547f956d65fe985ba189916047fc320ae150ad: [REPLACE_VIA] removed Via

Sep  7 08:00:00 INFO: _LOG: 3a547f956d65fe985ba189916047fc320ae150ad: [REPLACE_VIA] 1 Via headers

 

From the logs it looks like the remove_hf returns true and we have the header removed, but its still counting the Via header and the Via Header is still present when the INVIE is releyed on

 Regards,

 

Richard