<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>That solutions kind of works, but only for
phone numbers that are in the format xxx-xxx-xxxx. The records I am receiving
from LDAP vary significantly because the user can control their entry. So I
can receiving mostly the following formats…<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>(xxx) xxx-xxxx <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>xxx xxx-xxxx<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>xxx-xxx-xxxx<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Ideally, I’d like a function that
would remove all characters but the numbers, but I haven’t found a way to
do that. If I were more fluent in C, I might write a module to do it. Instead,
I added some extensions to try to compensate for the common formats, and it
looks like this…<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>[app-clean-ldap]<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten =>
_XXX-XXX-XXXX,1,SetVar(AreaCode=${EXTEN:0:3})<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten =>
_XXX-XXX-XXXX,2,SetVar(Prefix=${EXTEN:4:3})<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten =>
_XXX-XXX-XXXX,3,SetVar(Suffix=${EXTEN:8:4})<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten =>
_XXX-XXX-XXXX,4,Goto(from-internal,91${AreaCode}${Prefix}${Suffix},1)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _(XXX)
XXX-XXXX,1,SetVar(AreaCode=${EXTEN:1:4})<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _(XXX)
XXX-XXXX,2,SetVar(Prefix=${EXTEN:5:3})<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _(XXX)
XXX-XXXX,3,SetVar(Suffix=${EXTEN:9:4}) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _(XXX)
XXX-XXXX,4,Goto(from-internal,${AreaCode}${Prefix}${Suffix},1)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _XXX
XXX-XXXX,1,SetVar(AreaCode=${EXTEN:0:3}) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _XXX
XXX-XXXX,2,SetVar(Prefix=${EXTEN:4:3}) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _XXX
XXX-XXXX,3,SetVar(Suffix=${EXTEN:8:4}) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=1 color=navy face="Courier New"><span
style='font-size:8.0pt;font-family:"Courier New";color:navy'>exten => _XXX
XXX-XXXX,4,Goto(from-internal,91${AreaCode}${Prefix}${Suffix},1)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>My only problem now is that I can’t
pattern match a space character in the last two sections. I was able use a
period as a wildcard to match the space, but that returns unexpected results if
someone has more than one character in there. Does anyone know how to match a
space character in the dial plan? Help is always appreciated.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Scott Miller<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Colin Anderson<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, September 23, 2005
2:47 PM<br>
<b><span style='font-weight:bold'>To:</span></b> '<st1:PersonName w:st="on">Asterisk
Users Mailing List - Non-Commercial Discussion</st1:PersonName>'<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [Asterisk-Users]
Removing "-" (Dash) from Dialed Numbers</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>Not very elegant, but:</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>exten =>
1,1,SetVar(MyNumber=780-555-1212)</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>exten =>
1,2,SetVar(AreaCode=${MyNumber:3:3})</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>exten =>
1,3,SetVar(Prefix=${MyNumber:5:7})</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>exten =>
1,4,SetVar(Suffix=${MyNumber:8:11})</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>exten =>
1,5,Dial(ZAP/g0/1${AreaCode}${Prefix}${Suffix})</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=blue face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:blue'>hth</span></font><o:p></o:p></p>
</div>
<blockquote style='margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Scott Miller
[mailto:scoscmil@imap.iu.edu]<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, September 23, 2005
1:22 PM<br>
<b><span style='font-weight:bold'>To:</span></b>
asterisk-users@lists.digium.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> [Asterisk-Users] Removing
"-" (Dash) from Dialed Numbers</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to enable dial-by-email by using LDAPget to
query an Active Directory server. I've got it retrieving the phone number
fine. Unforunately, the numbers stored in active directory are either in
the format: (xxx) xxx-xxxx or xxx-xxx-xxxx. Is there any way
to parse characters out of the dialed phone number so that I only end up with
digits (remove spaces, parenthesis and dashes)? From there, my
outbound routes can take care of where to send the call.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Help is always appreciated! </span></font><font size=2
face=Wingdings><span style='font-size:10.0pt;font-family:Wingdings'>J</span></font><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thank you,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Scott Miller<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</blockquote>
</div>
</body>
</html>