📄 outboundlcr.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;use Time::Local;$|=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();# SWITCH MODEif ($ARGV[0] eq 'lcr') { &lcronly(); exit;} else { &full(); exit;}#--------------------------------------------------------------------------------------------------------# full variables#--------------------------------------------------------------------------------------------------------sub full{my $ASTERCON_CALLEE=$AGI->get_variable('ASTERCON_CALLEE'); #------------------------------BASIC CHECKINGmy ($caller_matched,$callee_matched); # CALLER DISABLED MATCHED foreach (split(/\,/,$astcon_conf->{'billing'}{'outbound_disabled_caller'}[0])) { chomp($_); if ($input{callerid} =~ /^$_/){ $caller_matched++; last;; } } &full_todie('3') if ($caller_matched); # CALLEE DISABLED MATCHED foreach (split(/\,/,$astcon_conf->{'billing'}{'outbound_disabled_callee'}[0])) { chomp($_); if ($ASTERCON_CALLEE =~ /^$_/){ $callee_matched++; last;; } } &full_todie('3') if ($callee_matched); #------------------------------ACCOUNT CHECKING # CHECK ACCOUNTCODE EXISTSmy ($exists_account,$accountref) = $astodm->exten_exists_accountcode($input{'accountcode'}); &full_todie('1') if ($exists_account != 2); # CHECK EXPIRY OR (FREE AND CREDIT)my ($check_expiry,$check_free); if ($accountref->{'Billing_expiry'} ne '' && $accountref->{'Billing_expiry'} ne '0000-00-00 00:00:00') {my ($tmpYear, $tmpMon, $tmpDay, $tmpHour, $tmpMin, $tmpSec) = split(/[\s\-\:]/,$accountref->{'Billing_expiry'});my $tmpTime = timelocal($tmpSec, $tmpMin, $tmpHour, $tmpDay, $tmpMon-1, $tmpYear-1900);my $curTime = time(); $check_expiry++ if ($curTime > $tmpTime); #濡傛灉褰撳墠鏃堕棿瓒呰繃浜嗗寘鏈堟渶闀挎椂闂
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -