Hey Chlauber,
Sorry for the delay. I too am not a regex expert so I copyed what com_zimbra_phone was using.
Code:
(((\+\d{2}[-\. ]\d{5}[-\. ]?\d{5})|(\b(\d{1}[-. ])?(\(?\d{3}\)?[-. ])?\d{3}[-.]\d{4}\b)|(\(\d{3}\)[-\. ]?\d{7}))(( x| ext)[-#: ]?\d{1,5}){0,1}) Problem with this regex is it will send incorrectly formatted dial strings to Asterisk that include the extension number etc. There should be a way to have one regex string to cover all the different phone number formats and then we need to format them in a way Asterisk can place the call.
For North America we need we need a regex string that can account for 7 digit, 10 digit, and even 11 digit dialing. Also all the different separators people use space, dash, period, and brackets around the area code.
1 (555) 555 5555
(555) 555 5555
555-555-5555
555.555.5555
555 555 5555
555 555
This article from Wikipedia should help a great deal to cover all the international possibilities.
Telephone numbering plan - Wikipedia, the free encyclopedia
Let me see if I can come up with anything.