Nathan Pralle wrote:
    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.

Scott,

This would be darned easy to do with the AGI and a perl script.

<snip>

$number=~s/-//g;
$number=~s/ //g;
$number=~s/\(//g;
$number=~s/\)//g;

change this to be...

$number =~ s/\D//g;  # \D is regexp for non-digit

...or if some letters were ok to dial (ABCD) you could do...

$number =~ s/(?i)[^\dabcd]//g;  # \d is regexp for digits
                                # (?i) make the express case-insensitive
                                # the [^...] construct effectively means
                                #   anything not specified between [ & ]


my $two_cents = 'a grain of salt';
--
Christopher L. Wade, CCNA, CCDA, CQS-CIPTES, CQS-CWLSS

_______________________________________________
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to