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

Jeff Pyle jpyle at fidelityvoice.com
Sat Mar 7 04:40:14 CET 2009


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




More information about the Users mailing list