[Users] Checking for Digit Length

Mark Kent mark at noc.mainstreet.net
Tue Sep 19 01:16:45 CEST 2006


> Basically I am trying to find out a way of checking for minimum and
> maximum digit length dialled by our users, in order to filter some
> of the traffic through our OpenSER server. Dialling rules aside, is
> there a way?

Unless I missed it, no one told the guy what he needs to know.
Instead, he is pointed at a lengthy specification for posix regular
expressions.  I know there is value in teaching a guy to fish, but at
some point someone has to just answer the question...

This 

 if (uri=~"sip:[0-9]{10,24}") {
    ...
 }

will match a sequence of digits between 10 and 24 in length (inclusive).

Now, the above  is not a great test in practice.  I don't know how long
the longest number can be outside the North American Numbering plan
(where it is relatively easy: 1-NXX-NXX-XXXX, see nanpa.com).
And there are restrictions on the first few digits that you might
want to check, depending on where you are in the world.

I'm sure that someone reading this list has already got the ultimate,
global, number checker coded for openser... it's just a question of
whether they'll cough it up in public.

-mark




More information about the sr-users mailing list