Many thanks. Such an example is exactly what I need.
For now even the simplest will help. I am currently trying to filter
anything less than say 5 digits and reject the call on OpenSER itself, as
these will never complete. Our customers are all over the world so it will
be difficult to implement a maximum.
This will at least help eliminate some of the erroneous traffic which is
caused by our customers not dialling properly and is sent downstream to our
carriers who complain because it makes their ASRs look bad.
Will try with:
if (uri=~"sip:[0-9]{6,24}") {
sl_send_reply("404", "Not Found");
}
On 9/19/06, Mark Kent <mark(a)noc.mainstreet.net> wrote:
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