📄 authaccount.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 EXISTSif ($input{'accountcode'} eq '') {my ($exists_account) = $astodm->exten_exists_accountcode($input{'accountcode'}); if ($exists_account == 2) { $AGI->exec('set',"ASTERCON_CHECKUSER=1"); exit; }}# AUTHmy $newaccountcode = $AGI->get_data('astercon/auth_account',10000,20);my $newpassword = $AGI->get_data('astercon/auth_password',10000,20);my ($exists_account,$row) = $astodm->exten_exists_accountcode($newaccountcode);if ($exists_account == 2) { # MATCHED if ($row->{'Secret'} eq $newpassword) { $AGI->exec('set',"ASTERCON_CHECKUSER=1"); # NO MATCHED SECRET } else { $AGI->stream_file('astercon/auth_incorrect'); $AGI->exec('set',"ASTERCON_CHECKUSER=0"); } exit;# NO MATCHED ACCOUNTCODE} else { $AGI->stream_file('astercon/auth_incorrect'); $AGI->exec('set',"ASTERCON_CHECKUSER=0"); exit;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -