[Asterisk-Users] ASTCC: perl / mysql or me???
Ronald Wiplinger
ronald at elmit.com
Mon Mar 21 01:03:31 MST 2005
I try to change something in ASTCC, but I am now totally blind, ....
I hang on one line now. I changed:
vpbx:/var/lib/asterisk/agi-bin # diff astcc-original.agi astcc.agi
22c22
< # exten => _00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN})
---
> # exten =>
_00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},${TARIFF},${EXTEN})
35c35
< # exten => _00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},BALANCE,1)
---
> # exten => _00XXXXXXXXX,1,DeadAGI(astcc.agi,${CALLERIDNUM},BALANCE,'',1)
273,274c273,276
I added one parameter ${TARIFF}
< my ($number) = @_;
< my $sth = $dbh->prepare("SELECT * FROM routes WHERE " .
$dbh->quote($number) . " RLIKE pattern ORDER BY LENGTH(pattern) DESC");
---
> my ($number, $tariff1) = @_;
> my $sth = $dbh->prepare("SELECT * FROM " . $tariff1 . " WHERE "
. $dbh->quote($number) . " RLIKE pattern ORDER BY LENGTH(pattern) DESC");
> print STDERR "sth = $sth\n";
277a280
> print STDERR "res = $res\n";
413c416
< ($calleridnum, $phoneno, $quiet) = @ARGV;
---
> ($calleridnum, $phoneno, $tariff, $quiet) = @ARGV;
521c524
< print STDERR "Phone number is $phoneno\n";
---
> print STDERR "1. Phone number is $phoneno\nTariff is
$tariff\n";
526c529
< $numdata = &getphone($phoneno);
---
> $numdata = &getphone($phoneno, $tariff);
554c557,560
< $numdata = &getphone($phoneno);
---
> print STDERR "2. Phone number is $phoneno\nTariff is $tariff\n";
> $numdata = &getphone($phoneno, $tariff);
> print STDERR "2.a numdata = $numdata\n";
> print STDERR "2.b Matching pattern is $numdata->{pattern}\n";
555a562
> print STDERR "2.c numdata = $numdata\n";
556a564
> print STDERR "2.d quiet = $quiet\n";
vpbx:/var/lib/asterisk/agi-bin #
What happens is, when I use the $TARIFF=routes (what was the original
name) it works! If I use the new table name I had added to the database,
than it does not work!
The database has both tables routes and newrates.
With "routes" I get: You have so much money, .... your call cost ....
With "newrates" I get: You have so much money left, I am sorry that is
not a recognized number
I created the newrates table via mysqldump, changed table name
everywhere and changed the rate, inserted the new table with mysql, ...
I tried to reload mysql, ...
Please, enlighten me!!!
bye
Ronald
More information about the asterisk-users
mailing list