[Asterisk-Users] ISDN LCR USING ASTERISK
FastJack
xfjx at m4tr1Xx.de
Mon Feb 16 11:03:27 MST 2004
hi everybody,
here is what I've done to make my asterisk* act as a LCR.
first, you'll have to install isdnrate (part of isdnutils) and get a recent
rate-??.dat (check rates4linux.sourceforge.net for that.)
to test isdnrate just try the following command:
lcr -o -b3 -l60 *any_number_you_want_to_test*
the -o tells isdnrate to only use provides activated in /etc/isdn/rate.conf
(e.g. if you have some preselection providers or tisdn-xxl)
-b3 is for the best 3 providers
-l60 says call duration 60 seconds (the default-value I also used in my AGI
is 153 secs. so if you want to use annother duration please change the
commandline in the agi)
then I wrote a very little (and simple) AGI.
-----
/lcr.agi -------------------------------------------------------------------
-----------
#!/usr/bin/perl
$|=1;
while(<STDIN>) {
chomp;
last unless length($_);
if (/^agi_(\w+)\:\s+(.*)$/) {
$AGI{$1} = $2;
}
}
$number = $ARGV[0];
$length = 60;
$raw = `/usr/bin/isdnrate -o -b1 -L -l$length $number`;
$raw =~ /([0-9]*)_.;(.*?);/;
$prefix = $1;
$provider = $2;
print "VERBOSE \"Using LCR Provider $provider - $prefix!\"\n";
$result = <STDIN>;
print "SET VARIABLE LCR $prefix\n";
$result = <STDIN>;
----------------------------------------------------------------------------
------------------------
as you can see, my AGI just sets a variable called LCR.
here is how I use it in my dialplan:
exten => _0.,1,Answer
exten => _0.,2,DigitTimeout,5 ; Set Digit Timeout to 5 seconds
exten => _0.,3,ResponseTimeout,10 ; Set Response Timeout to 10
seconds
exten => _0.,4,agi,/lcr.agi|${EXTEN:${TRUNKMSD}}
exten => _0.,5,Dial,CAPI/@6294096:b${LCR}${EXTEN:${TRUNKMSD}}|60|T
I know that this is all very simple - and maybe there are some errors in my
setup but I just wanted to share my expirence with you.
bye
... thorsten
More information about the asterisk-users
mailing list