[Serusers] Quick question on pattern matching in the uri variable

Norman Brandinger norm at goes.com
Wed Sep 30 18:19:35 CEST 2009


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 at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
>




More information about the sr-users mailing list