Hello,

 

Just a note - maybe you are having some special requirements, but usually you do not need to manipulate the Via header in Kamailio.

 

If you are relaying the request, why do you do not want to have a Via added to the message? It’s a requirement by RFC 3261 for a stateful proxy.

 

Cheers,

 

Henning

 

--

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

Kamailio services – https://gilawa.com

 

From: Richard Robson <richard@rikrobson.co.uk>
Sent: Tuesday, September 7, 2021 3:13 PM
To: Henning Westerholt <hw@skalatan.de>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: Re: [SR-Users] via header not removed wit hremove_hf()

 

hi ,

Thanks Hennig,

 

I added the counts to check and i'll retest with the ms_+appl_changes() too.

The real problem is that the Via is getting into the relayed INVITE. I had assumed that it would not get relayed if it were removed.

 

Regards,

 

Richard

On 07/09/2021 14:05, Henning Westerholt wrote:

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