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.
IE:
exten => _X.,1,agi,fixnumbers|${MyNumber}
exten => _X.,2,Dial(ZAP/g0/1${MyNumber})
Then, in a perl script called "fixnumbers" and inside the agi-bin directory:
########## START CODE #############
#!/usr/bin/perl -w
use strict;
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
my $number=$ARGV[0];
$number=~s/-//g;
$number=~s/ //g;
$number=~s/\(//g;
$number=~s/\)//g;
print $AGI->set_variable('MyNumber',"$number");
exit;
####### END CODE ########
Nathan
--
-------------------------------------
Nathan E. Pralle
Give the Director a Serpent Deflector
www.nathanpralle.com
-------------------------------------
_______________________________________________
--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