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@128.59.59.96:5060 from sip:9174147124@128.59.59.242
With the original RPID header as:
Remote-Party-ID: sip:9174147124@128.59.59.242
And after route[10] the headers that end up on the UA are:
Remote-Party-ID: sip:9174147124@siptest.columbia.edu Remote-Party-ID: sip:+19174147124@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@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
Hi Alan,
Alan Crosswell wrote:
Please ignore previous post which I sent before completing!
I have two problems:
- A 2nd Remote-Party-ID header gets appended when I try to do
two subst() on it.
you mean you get 2 consecutive RPID hdrs?? Are both properly formatted. Usually this kind of problems result from small error in the subst regexp.
- Xlog seems to only have a ref to the orignal unedited rpid
header.
yes, that is true - all pseudo-variables (excepting RURI and DST_URI) take values from the original messages. This is a side-effect of how the changes are kept in openser - changes are kept as diffs / lump from the original messages and the new resulting message is computed just before sending (this is from performance reasons).
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
With the original RPID header as:
Remote-Party-ID: sip:9174147124@128.59.59.242
And after route[10] the headers that end up on the UA are:
Remote-Party-ID: sip:9174147124@siptest.columbia.edu Remote-Party-ID: sip:+19174147124@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@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!
try to eliminate the subst one by one and see when the second RPID hdr disappears.
My personal recommendation will be to copy the RPID body into an AVP and to perform the regexp on it - it will be much, much faster applying regexp only on it, rather than on the entire message (as subst does). At the end, remove the entire RPID hdr and add the new one. It will be also much cleaner as only one lump will be created.
regards, bogdan