I have two problems:
1.
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@128.59.59.96:5060> from
<sip:9174147124@128.59.59.242> rpid <sip:9174147124@128.59.59.242>
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@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/');
# XXX dip the calling name database XXX
# ??? 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]