[OpenSIPS-Users] remove_hf() doesn't always work

Richard Revels rrevels at bandwidth.com
Sat Mar 7 17:25:27 CET 2009


Add the headers in branch routes.  Headers added in primary routing  
can't be removed in later processing.


On Mar 6, 2009, at 10:40 PM, Jeff Pyle wrote:

> Hello,
>
> I’m using serial forking to send requests to multiple PSTN  
> carriers.  Some
> of these carriers want P-Asserted-Identity/Privacy, and others want
> Remote-Party-ID.  After selecting a carrier I remove any of these  
> headers so
> I can build new ones and insert them.
>
> The insert works fine, but the remove_hf() isn’t removing the headers.
> Here’s the config:
>
> # Clear identity / privacy headers
> if (is_present_hf("Remote-Party-ID")) {
>    remove_hf("Remote-Party-ID");
>    xlog("L_INFO", "Removed Remote-Party-ID header\n");
> }
> if (is_present_hf("P-Asserted-Identity")) {
>    remove_hf("P-Asserted-Identity");
>    xlog("L_INFO", "Removed P-Asserted-Identity header\n");
> }
> if (is_present_hf("Privacy")) {
>    remove_hf("Privacy");
>    xlog("L_INFO", "Removed Privacy header\n");
> }
>
> Requests come into the proxy with either PAI/Privacy or RPID.  After  
> parsing
> them I remove them with the above code.  It seems some odd things  
> are going
> on.
>
> Take the following example:  A request comes into the proxy with  
> RPID.  RPID
> is detected and removed.  The first carrier requires PAI, so it is  
> built and
> inserted.  The request is related to the first carrier where it  
> arrives with
> only PAI.  So far, so good.
>
> The carrier sends a 503 into a failure_route.  The above config is  
> also in
> the failure_route, where it oddly detects an RPID.  The 503 didn't  
> have an
> RPID, nor did the INVITE before it.  Anyway, the route block is  
> called to
> prepare the next carrier.  The above config is called again in that  
> route
> block.  It also shows that it detected and removed and RPID header,  
> even
> though as far as I can tell none was present.  This second carrier  
> prefers
> RPID, so a new RPID header is constructed and inserted.  The request  
> is
> forwarded to the carrier.  When the carrier gets it, it has both an  
> RPID and
> a PAI header.
>
> It doesn't matter what the UAC sends initially to this proxy, RPID  
> or PAI,
> or which order the carriers receive the INVITEs.  The second carrier  
> always
> has both headers, and the xlogs from the above code don't seem to make
> sense.
>
> I'm at a loss on this one.  Especially since I use remove_hf() to  
> take out
> P-Charge-Info and some other custom headers after they're parsed at  
> the
> beginning of the route[0].  And that works fine.
>
>
> Thanks in advance for any insight anyone may have.
>
>  - Jeff
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list