-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed directory issues on 2.8 and below
- Loading branch information
Showing
2 changed files
with
33 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,40 @@ | ||
#!/usr/bin/php -q | ||
<?php | ||
require('config.php'); | ||
require('/var/lib/asterisk/agi-bin/phpagi.php'); | ||
|
||
$agi = new AGI(); | ||
$thenumber = $agi->request['agi_callerid']; | ||
|
||
$sql = 'SELECT * FROM `sak_bwlist` ORDER BY `sort` ASC'; | ||
|
||
$list = $db->getAll($sql,array(), DB_FETCHMODE_ASSOC); | ||
|
||
$matchfound = false; | ||
foreach($list as $data) { | ||
$count = 0; | ||
if(preg_match("/".$data['nn']."/",$thenumber,$matches)) { | ||
if($matches[0] == $thenumber) { | ||
if($data['permit']) { | ||
$matchfound = true; | ||
$sql = 'SELECT count FROM sak_bwlist WHERE id = '.$data['id']; | ||
$count = $db->getOne($sql); | ||
$count++; | ||
$sql = "UPDATE sak_bwlist SET count = '".$count."' WHERE id = ".$data['id']; | ||
$db->query($sql); | ||
break; | ||
} else { | ||
$agi->hangup(); | ||
break; | ||
} | ||
chdir(dirname(__FILE__)); | ||
require('../config.php'); | ||
require('/var/lib/asterisk/agi-bin/phpagi.php'); | ||
|
||
$agi = new AGI(); | ||
$thenumber = $agi->request['agi_callerid']; | ||
|
||
$sql = 'SELECT * FROM `sak_bwlist` ORDER BY `sort` ASC'; | ||
|
||
$list = $db->getAll($sql,array(), DB_FETCHMODE_ASSOC); | ||
|
||
$matchfound = false; | ||
foreach($list as $data) { | ||
$count = 0; | ||
if(preg_match("/".$data['nn']."/",$thenumber,$matches)) { | ||
if($matches[0] == $thenumber) { | ||
if($data['permit']) { | ||
$matchfound = true; | ||
$sql = 'SELECT count FROM sak_bwlist WHERE id = '.$data['id']; | ||
$count = $db->getOne($sql); | ||
$count++; | ||
$sql = "UPDATE sak_bwlist SET count = '".$count."' WHERE id = ".$data['id']; | ||
$db->query($sql); | ||
break; | ||
} else { | ||
$agi->hangup(); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if(!$matchfound) { | ||
$agi->hangup(); | ||
} | ||
} | ||
|
||
if(!$matchfound) { | ||
$agi->hangup(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters