Skip to content

Commit f3fbd42

Browse files
fix ivr hodidays
1 parent c7cd78f commit f3fbd42

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

protected/controllers/IvrController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ public function setAttributesModels($attributes, $models)
250250
public function actionDeleteAudio()
251251
{
252252

253-
shell_exec('rm -rf ' . $this->uploaddir . '/idIvrDidWork_*_' . $_POST['id_ivr'] . '*');
254-
shell_exec('rm -rf ' . $this->uploaddir . '/idIvrDidNoWork_*_' . $_POST['id_ivr'] . '*');
253+
shell_exec('rm -rf ' . $this->uploaddir . 'idIvrDidWork_' . $_POST['id_ivr'] . '*');
254+
shell_exec('rm -rf ' . $this->uploaddir . 'idIvrDidNoWork_' . $_POST['id_ivr'] . '*');
255255
echo json_encode(array(
256256
$this->nameSuccess => true,
257257
$this->nameMsg => $this->msgSuccess,

protected/controllers/PlayAudioController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ class PlayAudioController extends Controller
2626
public function actionIndex()
2727
{
2828

29-
$file_name = $this->magnusFilesDirectory . 'sounds/' . $_GET['audio'];
29+
if (preg_match('/queue-periodic/', $_GET['audio'])) {
30+
$file_name = '/var/lib/asterisk/sounds/' . $_GET['audio'];
31+
32+
if (file_exists($file_name . '.gsm')) {
33+
$file_name .= '.gsm';
34+
} else {
35+
$file_name .= '.wav';
36+
}
37+
} else {
38+
$file_name = $this->magnusFilesDirectory . 'sounds/' . $_GET['audio'];
39+
}
3040

3141
if (!file_exists($file_name)) {
3242
exit('<center><br>' . Yii::t('zii', 'File not found') . '</center>');

resources/asterisk/IvrAgi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function callIvr(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi = null, $type = 'iv
4040
$work = $MAGNUS->checkIVRSchedule($modelIvr->monFriStart, $modelIvr->satStart, $modelIvr->sunStart);
4141

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

0 commit comments

Comments
 (0)