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!
Try escaping the +.
uri =~ "^sip:+1.*"
Regards, Norm
Frank Durda IV wrote:
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 ( ) { #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!
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Norman Brandinger wrote:
Try escaping the +.
uri =~ "^sip:+1.*"
That worked, Thanks!
Where is it documented in the various SER documentation that "+" is a special character that needs escaping, and what does '+' do when not escaped?
The expression in case is a REGEX, so '+' is not an special character for SER, but for the REGEX-matching engine used by SER. The same applies to '*' and others...
Edson.
Frank Durda IV escreveu:
Norman Brandinger wrote:
Try escaping the +.
uri =~ "^sip:+1.*"
That worked, Thanks!
Where is it documented in the various SER documentation that "+" is a special character that needs escaping, and what does '+' do when not escaped?
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers