[Users] Why is a second RPID header created when I do two subst()?

Alan Crosswell alan at columbia.edu
Sat Oct 28 20:35:00 CEST 2006


Please ignore previous post which I sent before completing!

I have two problems:

1. A 2nd Remote-Party-ID header gets appended when I try to do
   two subst() on it.

2. Xlog seems to only have a ref to the orignal unedited rpid
   header.

I am attempting to clean up my Remote-Party-ID header so that my Polycom
UAs will display the incoming number as a number rather than as a URI.
This requires the domain to match that of the UA's server (e.g.
siptest.columbia.edu).  And, I want to rewrite incoming calling numbers
from my PBX to be in 5-digit format and other US 10-digit numbers into
proper E.164 format since my PBX and at least one of my ITSPs doesn't
provide them as E.164.

So, I do a couple of subst() operations on INVITEs.  What's wierd is
that one Remote-Party-ID header becomes two when it gets to the UA.

The call flow is:

INVITE r-uri <sip:10508 at 128.59.59.96:5060> from
<sip:9174147124 at 128.59.59.242>

With the original RPID header as:

Remote-Party-ID:  <sip:9174147124 at 128.59.59.242>

And after route[10] the headers that end up on the UA are:

Remote-Party-ID: <sip:9174147124 at siptest.columbia.edu>
Remote-Party-ID: <sip:+19174147124 at 128.59.59.242>

It looks like the 2nd subst() happened against the original
RPID, not the edited one and somehow two RPID headers got
created.

Here's the code for the route block:

route[10] {
    xlog("L_INFO","route[10] $ci: method $rm r-uri <$ru> from <$fu> rpid
<$re>\n");
    # first just clean out the domain name

subst('/^(Remote-Party-ID:.*<sip:.*)@.*>(.*)$/\1 at siptest.columbia.edu>\2/');
    # now strip our numbers down to 5 digits

subst('/^(Remote-Party-ID:.*<sip:)(\+)?(1)?21285([134][0-9]{4})@/\1\2/');
    # expand 10-digit NANP numbers to E.164
    subst('/^(Remote-Party-ID:.*<sip:)([0-9]{10}.*$)/\1+1\2/');
    # ??? xlog doesn't show the result of rewriting it.
    # xlog("L_INFO","route[10] RPID is now <$re>\n");
    xlog("L_INFO","route[10] $ci: RPID was rewritten.\n");
    return;
} #end of route[10]

Any help with this would be greatly appreciated!

/a




More information about the Users mailing list