Convert dialed words to numbers

Any thoughts on how to convert dialed words (through sip client) to numbers.

For example, dialing 1-800-gofedex or 1-800pickups would convert to the letters to their respective digits.

Thanks!

The problem you’re going to find:

A guy a few years bought the number “1-800-FLACode” (he was starting a Florida based software company) without realizing that his number was the same as “1-800-FLA-COED” (a phone sex service).

While most digit strings translate to word, but you have to take into account the times when it doesn’t.

1 Like

I understand snafu’s can happen. Mainly I’m looking for a simple way to just have the system convert the words into numbers, strip off anything in excess of 10 digits.

Words to digits is easy - it’s going the other way that’s hard.

^^In terms a 5th grader can understand, elaborate on easy :slight_smile:

You type 323 for DAD but 323 can also be

DAD DAE DAF DBD DBE DBF DCD DCE DCF EAD EAE EAF EBD EBE EBF ECD ECE ECF FAD FAE FAF FBD FBE FBF FCD FCE FCF

pseudocoble

take the string,
remove anything but 0-9a-zA-Z
step through the string replacing
[abc2] with 2
[def3] with 3
.
.
.
remove any 1 from the beginning
select the first 10 characters

asterisk or bash or php can do that with some string manipulation and a case statement ,

a minimalist bashism

echo ${STRING}|tr [:upper:] [:lower:]|tr -cd 0-9a-x|tr abcdefghijklmnopqrstuvwxyz 1112223334445556667778889999|sed -r ‘s/1?([0-9]{10})/\1/’