[Serusers] truncating long phone numbers?

Jeremy M. Dolan jmd at pobox.com
Wed Sep 22 21:03:01 CEST 2004


Hello, serusers!

I am trying to add support to our SER routing to do the right thing
when users add extra digits to phone numbers. We have silly users
trying to dial 1-800-JABBER-WOCK type numbers, and they don't know to
stop dialing after the "W", since you don't need to on a standard
analog line.

It seems like this would either require a reg-exp back reference
(ie, \1), or a while loop and a function like strip() that works on
the other side of the user portion of the SIP address:

while (uri =~ ^sip:[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) {
	endstrip(1);
}

Are any of these functions available, but not documented? I've found
the language reference/Admin's guide to be a bit obscure at times for
discovering these sorts of things. Or can anyone suggest another way
to truncate the number down?

Also, as long as I'm writing in: are there any minimum and maximum
quantifiers (ie, [0-9]{3,5}) available in SER? It's hard to read code
that's 90% repeated character classes!

^Jeremy$

-- 
Jeremy M. Dolan <mailto:jmd at pobox.com> <http://jmd.us/>
PGP: 1024D/3C68A1BA 9470 210C A476 FFBB 6D11  0223 0D1C ABFC 3C68 A1BA




More information about the sr-users mailing list