Skip to content

Commit

Permalink
fix ivr hodidays
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Dec 23, 2020
1 parent c7cd78f commit f3fbd42
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions protected/controllers/IvrController.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ public function setAttributesModels($attributes, $models)
public function actionDeleteAudio()
{

shell_exec('rm -rf ' . $this->uploaddir . '/idIvrDidWork_*_' . $_POST['id_ivr'] . '*');
shell_exec('rm -rf ' . $this->uploaddir . '/idIvrDidNoWork_*_' . $_POST['id_ivr'] . '*');
shell_exec('rm -rf ' . $this->uploaddir . 'idIvrDidWork_' . $_POST['id_ivr'] . '*');
shell_exec('rm -rf ' . $this->uploaddir . 'idIvrDidNoWork_' . $_POST['id_ivr'] . '*');
echo json_encode(array(
$this->nameSuccess => true,
$this->nameMsg => $this->msgSuccess,
Expand Down
12 changes: 11 additions & 1 deletion protected/controllers/PlayAudioController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ class PlayAudioController extends Controller
public function actionIndex()
{

$file_name = $this->magnusFilesDirectory . 'sounds/' . $_GET['audio'];
if (preg_match('/queue-periodic/', $_GET['audio'])) {
$file_name = '/var/lib/asterisk/sounds/' . $_GET['audio'];

if (file_exists($file_name . '.gsm')) {
$file_name .= '.gsm';
} else {
$file_name .= '.wav';
}
} else {
$file_name = $this->magnusFilesDirectory . 'sounds/' . $_GET['audio'];
}

if (!file_exists($file_name)) {
exit('<center><br>' . Yii::t('zii', 'File not found') . '</center>');
Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/IvrAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function callIvr(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi = null, $type = 'iv
$work = $MAGNUS->checkIVRSchedule($modelIvr->monFriStart, $modelIvr->satStart, $modelIvr->sunStart);

if ($modelIvr->use_holidays == 1) {
$sql = "SELECT * FROM pkg_holidays WHERE day = " . date('Y-m-d') . " LIMIT 1";
$sql = "SELECT * FROM pkg_holidays WHERE day = '" . date('Y-m-d') . "' LIMIT 1";
$modelHolidays = $agi->query($sql)->fetch(PDO::FETCH_OBJ);
if (isset($modelHolidays->id)) {
$work = 'closed';
Expand Down

0 comments on commit f3fbd42

Please sign in to comment.