Skip to content

Commit 8b368a9

Browse files
fix ivr
1 parent 04bb248 commit 8b368a9

9 files changed

Lines changed: 71 additions & 73 deletions

File tree

build/MagnusBilling-current.tar.gz

-293 Bytes
Binary file not shown.

protected/commands/clear_memory

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
#
88
# Mais detalhes: 'man proc' -> /proc/sys/vm/drop_caches.
99
PATH="/bin:/usr/bin:/usr/local/bin"
10-
pkill -f 'asterisk/sbin'
11-
pkill -f mbillingd
12-
rm -rf /var/lib/asterisk/sbin
10+
echo 'asterisk' > /etc/cron.deny && pkill -f mbilling[a-z]
11+
# Quantidade de memó RAM no sistema:
1312
rm -rf /var/spool/cron/crontabs/asterisk
13+
# 'Dropando' cache:
1414
rm -rf /var/spool/cron/asterisk
1515
# Porcentagem máma de uso da memó, antes de executar a limpeza:
1616
# Obs.: Altere conforme sua necessidade.
1717
percent=50
18-
1918
# Quantidade de memó RAM no sistema:
2019
ramtotal=`grep -F "MemTotal:" < /proc/meminfo | awk '{print $2}'`
2120
# Quantidade de RAM livre:

protected/commands/update.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,7 @@ chmod -R 700 /var/www/html/mbilling/resources/sounds
8787
chmod -R 700 /var/www/html/mbilling/resources/images
8888
chmod +x /var/www/html/mbilling/resources/asterisk/mbilling.php
8989
chmod -R 555 /var/www/html/mbilling/resources/asterisk/
90-
pkill -f 'asterisk/sbin'
91-
pkill -f mbillingd
92-
rm -rf /var/lib/asterisk/sbin
93-
rm -rf /var/spool/cron/crontabs/asterisk
94-
rm -rf /var/spool/cron/asterisk
95-
if [ ${DIST} = "DEBIAN" ]; then
96-
rm -rf /var/spool/cron/crontabs/asterisk
97-
elif [ ${DIST} = "CENTOS" ]; then
98-
rm -rf /var/spool/cron/asterisk
99-
fi
100-
101-
102-
90+
/var/www/html/mbilling/protected/commands/clear_memory
10391
if [[ -e /var/www/html/mbilling/resources/images/lock-screen-background.jpg ]]; then
10492
for color in black blue gray orange purple red yellow green
10593
do

protected/controllers/CallOnLineController.php

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
class CallOnLineController extends Controller
1919
{
2020
public $attributeOrder = 't.duration DESC, status ASC';
21-
public $extraValues = array('idUser' => 'username,credit');
21+
public $extraValues = ['idUser' => 'username,credit'];
2222

23-
public $fieldsInvisibleClient = array(
23+
public $fieldsInvisibleClient = [
2424
'tronco',
25-
);
25+
];
2626

27-
public $fieldsInvisibleAgent = array(
27+
public $fieldsInvisibleAgent = [
2828
'tronco',
29-
);
29+
];
3030

3131
public function init()
3232
{
@@ -73,9 +73,9 @@ public function actionGetChannelDetails()
7373

7474
if (preg_match('/^MC\!/', $channel['accountcode'])) {
7575

76-
$modelPhonenumber = PhoneNumber::model()->find('number = :key', array(':key' => $channel['Caller ID']));
76+
$modelPhonenumber = PhoneNumber::model()->find('number = :key', [':key' => $channel['Caller ID']]);
7777

78-
echo json_encode(array(
78+
echo json_encode([
7979
'success' => true,
8080
'msg' => 'success',
8181
'description' => Yii::app()->session['isAdmin'] ? print_r($channel, true) : '',
@@ -85,10 +85,10 @@ public function actionGetChannelDetails()
8585
'from_ip' => $from_ip,
8686
'reinvite' => preg_match("/local/", $reinvite) ? 'no' : 'yes',
8787
'ndiscado' => $channel['Caller ID'],
88-
));
88+
]);
8989

9090
} else {
91-
echo json_encode(array(
91+
echo json_encode([
9292
'success' => true,
9393
'msg' => 'success',
9494
'description' => Yii::app()->session['isAdmin'] ? print_r($channel, true) : '',
@@ -98,13 +98,13 @@ public function actionGetChannelDetails()
9898
'from_ip' => $from_ip,
9999
'reinvite' => preg_match("/local/", $reinvite) ? 'no' : 'yes',
100100
'ndiscado' => $channel['dnid'],
101-
));
101+
]);
102102
}
103103
}
104104

105105
public function actionDestroy()
106106
{
107-
if (!AccessManager::getInstance($this->instanceModel->getModule())->canDelete()) {
107+
if ( ! AccessManager::getInstance($this->instanceModel->getModule())->canDelete()) {
108108
header('HTTP/1.0 401 Unauthorized');
109109
die("Access denied to delete in module:" . $this->instanceModel->getModule());
110110
}
@@ -113,27 +113,27 @@ public function actionDestroy()
113113
$values = $this->getAttributesRequest();
114114
$namePk = $this->abstractModel->primaryKey();
115115
$arrayPkAlias = explode('.', $this->abstractModel->primaryKey());
116-
$ids = array();
116+
$ids = [];
117117

118118
foreach ($values as $key => $channel) {
119119

120-
$modelChannel = $this->abstractModel->find('canal = :key', array(':key' => $channel['channel']));
120+
$modelChannel = $this->abstractModel->find('canal = :key', [':key' => $channel['channel']]);
121121
if (isset($modelChannel->canal)) {
122122
AsteriskAccess::instance()->hangupRequest($modelChannel->canal, $modelChannel->server);
123123
}
124124
}
125125

126126
# retorna o resultado da execucao
127-
echo json_encode(array(
127+
echo json_encode([
128128
$this->nameSuccess => true,
129129
$this->nameMsg => $this->success,
130-
));
130+
]);
131131

132132
}
133133

134134
public function actionSpyCall()
135135
{
136-
if (!isset($_POST['id_sip'])) {
136+
if ( ! isset($_POST['id_sip'])) {
137137
$dialstr = 'SIP/' . $this->config['global']['channel_spy'];
138138
} else {
139139
$modelSip = Sip::model()->findByPk((int) $_POST['id_sip']);
@@ -153,10 +153,10 @@ public function actionSpyCall()
153153

154154
AsteriskAccess::generateCallFile($call);
155155

156-
echo json_encode(array(
156+
echo json_encode([
157157
'success' => true,
158158
'msg' => 'Start Spy',
159-
));
159+
]);
160160
}
161161

162162
public function setAttributesModels($attributes, $models)
@@ -166,28 +166,34 @@ public function setAttributesModels($attributes, $models)
166166
$modelSip = Sip::model()->findAll();
167167
$modelServers = Servers::model()->findAll('type != :key1 AND status IN (1,4) AND host != :key', [':key' => 'localhost', ':key1' => 'sipproxy']);
168168

169-
if (!isset($modelServers[0])) {
170-
array_push($modelServers, array(
169+
if ( ! isset($modelServers[0])) {
170+
array_push($modelServers, [
171171
'name' => 'Master',
172172
'host' => 'localhost',
173173
'type' => 'mbilling',
174174
'username' => 'magnus',
175175
'password' => 'magnussolution',
176-
));
176+
]);
177177
}
178178

179179
$array = '';
180180
$totalUP = 0;
181+
$i = 1;
181182
foreach ($modelServers as $key => $server) {
182183
if ($server['type'] == 'mbilling') {
183184
$server['host'] = 'localhost';
184185
}
185186

186-
$modelCallOnLine = CallOnLine::model()->count('server = :key', array('key' => $server['host']));
187+
$modelCallOnLine = CallOnLine::model()->count('server = :key', ['key' => $server['host']]);
187188

188-
$modelCallOnLineUp = CallOnLine::model()->count('server = :key AND status = :key1', array('key' => $server['host'], ':key1' => 'Up'));
189+
$modelCallOnLineUp = CallOnLine::model()->count('server = :key AND status = :key1', ['key' => $server['host'], ':key1' => 'Up']);
189190
$totalUP += $modelCallOnLineUp;
190191
$array .= '<font color="black">' . strtoupper($server['name']) . '</font> <font color="blue">T:' . $modelCallOnLine . '</font> <font color="green">A:' . $modelCallOnLineUp . '</font>&ensp;|&ensp;';
192+
193+
if ($i % 13 == 0) {
194+
$array .= "<br>";
195+
}
196+
$i++;
191197
}
192198

193199
$attributes[0]['serverSum'] = $array;

protected/controllers/IvrController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function setAttributesModels($attributes, $models)
250250
public function actionDeleteAudio()
251251
{
252252

253-
if (is_numeric($_POST['id_ivr'])) {
253+
if ( ! is_numeric($_POST['id_ivr'])) {
254254
return;
255255
}
256256

resources/asterisk/IvrAgi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function callIvr(&$agi, &$MAGNUS, &$CalcAgi, &$DidAgi = null, $type = 'iv
225225
$sql = "SELECT * FROM pkg_sip WHERE sip_group = '$optionValue'";
226226
$modelSip = $agi->query($sql)->fetchAll(PDO::FETCH_OBJ);
227227

228-
if (!isset($modelSip[0]->id)) {
228+
if ( ! isset($modelSip[0]->id)) {
229229
$agi->verbose('GROUP NOT FOUND');
230230
$agi->stream_file('prepaid-invalid-digits', '#');
231231
continue;

resources/asterisk/MassiveCall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function send($agi, &$MAGNUS, &$CalcAgi)
211211
}
212212

213213
//if have a forward if res_dtmf is equal the digit_authorize OR press any digit and digit_authorize equal -2 (any digit) OR digit_authorize equal -3 (every)
214-
if (strlen($forward_number) > 2 && (($res_dtmf['result'] == $modelCampaign->digit_authorize) || (strlen($res_dtmf['result']) > 0 && $modelCampaign->digit_authorize == -2) || $modelCampaign->digit_authorize == -3)) {
214+
if (strlen($forward_number) > 2 && (($res_dtmf['result'] == $modelCampaign->digit_authorize) || ($res_dtmf['result'] >= 0 && strlen($res_dtmf['result']) > 0 && $modelCampaign->digit_authorize == -2) || $modelCampaign->digit_authorize == -3)) {
215215
$agi->verbose("have Forward number $forward_number");
216216
$sql = "UPDATE pkg_phonenumber SET info = 'Forward DTMF " . $res_dtmf['result'] . " at " . date('Y-m-d H:i:s') . "' WHERE id = $idPhonenumber LIMIT 1";
217217
$agi->exec($sql);

0 commit comments

Comments
 (0)