[Serusers] Quick question on pattern matching in the uri variable
Frank Durda IV
frank.durda at hypercube-llc.com
Wed Sep 30 18:08:55 CEST 2009
The following piece of code is supposed to change
a uri of 18885551212 to 8885551212 and change a uri of
+18885551212 to 8885551212.
The 18885551212 situation works fine, but in the +1
situation, the "if" test fails for some reason the
code below falls to the "nothing to strip" log message.
What am I missing?
route[STRIP_LEADING_ONE]
{
if (method == "INVITE") {
if (uri =~ "^sip:1.*" ) { #Leading 1?
xlog("L_ERR", "Strip leading '1' - From
URI:<%fu> From Tag:<%ft> Request's R-URI:<%ru> Before treatment To
URI:<%tu>\n");
strip(1);
} else if (uri =~ "^sip:+1.*" ) { #Leading +1?
xlog("L_ERR", "Strip leading '+1' - From
URI:<%fu> From Tag:<%ft> Request's R-URI:<%ru> Before treatment To
URI:<%tu>\n");
strip(2);
} else {
xlog("L_ERR", "Nothing to Strip - From URI:<%fu>
>From Tag:<%ft> Request's R-URI:<%ru> Before treatment To URI:<%tu>\n");
}
}
}
Thanks in advance!
More information about the sr-users
mailing list