[OpenSER-Users] remove_hf from textops does not remove whole header field

Bogdan-Andrei Iancu bogdan at voice-system.ro
Mon Jun 30 10:34:40 CEST 2008


Hi Sebastian,

What you are trying to do (playing with VIA headers) is a bit dangerous 
:) - how this works is  automatically done by openser and it is not 
intended to interfere with from the script.

The bogus result is because of how openser internally process the 
changes on the message. The changes are not immediately applied, but 
separately store (as lumps) and applied at the end. What happens in your 
case, is like this:

  1) probably you use force_rport() function that adds the rport param 
to the top most VIA hdr (as add lump)
  2) you call remove_hf() that creates another lump to delete the top 
most VIA
  3) when lumps are applied, the original VIA text is removed, but the 
rport text is printed because of the add lump (step 1).

Probably avoiding the force_rport() function will solve this issue, but 
note that this function is also internally called.

Regarding the addition of the local VIA (when forwarding the request) - 
this is mandatory by RFC3261 - a SIP proxy must add its VIA.
But if you really know what you want to do, try to use the send() 
function - this will simply send the request to another destination 
without adding the local VIA.

Regards,
Bogdan

Schumann Sebastian wrote:
> Dear all
>  
> I try to remove a Via from a header. Unfortunately, the via from
>     INVITE sip:user at domain SIP/2.0
>     Via: SIP/2.0/UDP 
> 10.0.0.1:20592;branch=z9hG4bK-d8754z-1955bd20f1745139-1---d8754z-;rport
>     Max-Forwards: 70
>  
> is changed after remove_hf("Via") to
>     INVITE sip:user at domain SIP/2.0
>     Via: SIP/2.0/UDP 
> 10.0.0.2;branch=z9hG4bK-d8754z-1955bd20f1745139-1---d8754z-
>     ;rport=20592Max-Forwards: 69
>  
> 10.0.0.2 is a proxy i sent the message through and 10.0.0.1 is the 
> originating endpoint. So rport is not removed and no CRLF is added 
> after the rport parameter is added. Is this behaviour as it should be? 
> I wanted to remove the whole line. Or can I restrict adding the rport 
> parameter?
>  
> Furthermore, the option _not_ to set an via for a message sent through 
> my proxy 10.0.0.2 would be also very helpful for me. It is not 
> possible though, right? At least I didn't find any further information....
>  
> Any ideas?
>  
> Best regards
> Sebastian
>  





More information about the sr-users mailing list