📄 balance.agi
字号:
#!/astercon2/perl/bin/perl# scperl /astercon2/perl (project info don't remove or modify)#!/usr/bin/perl#--------------------------------------------------------------## Astercon -- An open source softswitch and ippbx system.## Copyright (C) 2005 - 2008, Sun bing.## Sun bing <hoowa.sun@gmail.com>## See http://astercon.0420.com for more information about# the Astercon project.## license# The astercon project is licensed under the GNU 2.0 GPL. # astercon carries no restrictions on re-branding and # people are free to commercially re-distribute it.## any questions?# Please do not directly contact any of the maintainers of# this project for assistance;# the project provides a web site, bugs tracker,really chat.##--------------------------------------------------------------# ------------------------------------------------------------------------------# HEADER OF SCRIPTS# ------------------------------------------------------------------------------use FindBin qw($Bin);use strict "vars";use astercon::common;use astercon::database;use Asterisk::AGI;$|=1;#------------------------------------------------------------------------------# INIT SECTION#------------------------------------------------------------------------------# AUTO FLASH$|=1;# GET OUT COMMONmy $common = new astercon::common;my ($astcon_conf) = $common->{rc}->load_config(filename=>'/astercon2/etc/astcon.conf');# GET DATABASE SUPPORTmy $astodm = new astercon::database( dbuser=>$astcon_conf->{'general'}{'dbuser'}[0],dbpasswd=>$astcon_conf->{'general'}{'dbpasswd'}[0], dbhost=>$astcon_conf->{'general'}{'dbhost'}[0],dbname=>$astcon_conf->{'general'}{'dbname'}[0], dbport=>$astcon_conf->{'general'}{'dbport'}[0],dbsock=>$astcon_conf->{'general'}{'dbsock'}[0], conn=>1 );# GET AGI OBJECTmy $AGI = new Asterisk::AGI;my %input = $AGI->ReadParse();# CHECK ACCOUNTCODE EXISTSmy ($exists_account,$accountrow) = $astodm->exten_exists_accountcode($input{'accountcode'});if ($exists_account == 2) {my $Billing_free = $accountrow->{Billing_free}; $Billing_free = '0.00' if ($accountrow->{Billing_free} < 0); # GET OUT CURRENT LANGUAGE SETTINGS if (-e"$Bin/balance_$input{language}.pm") { open(CODE,"$Bin/balance_$input{language}.pm"); my @code = <CODE>; close(CODE); eval "@code"; if (defined *{"playfree_current"}{CODE}) { &playfree_current($Billing_free); } else { &playfree_default($Billing_free); } } else { &playfree_default($Billing_free); }}sub playfree_default{my $number = shift;my ($int,$float)=split(/\./,$number); if (length($float) > 2) {$float=substr($float,0,2);} $AGI->exec('Playback',"astercon/account-youhave|noanswer"); $AGI->say_number($int); $AGI->exec('Playback',"digits/oclock|noanswer"); $AGI->say_number($float); $AGI->exec('Playback',"digits/dollars|noanswer");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -