-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathstatusSummary.php
More file actions
220 lines (194 loc) · 10.4 KB
/
statusSummary.php
File metadata and controls
220 lines (194 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
/**
*
* =======================================
* ###################################
* PortabilidadeCelular
*
* @package ChipCerto ChanDongle
* @author Adilson Leffa Magnus.
* @copyright Copyright (C) 2005 - 2016 MagnusSolution. All rights reserved.
* ###################################
*
* This software is released under the terms of the GNU Lesser General Public License v2.1
* A copy of which is available from http://www.gnu.org/copyleft/lesser.html
*
* =======================================
* Magnusbilling.com <info@portabilidadecelular.com>
* 14/07/2016
*/
include 'phpagi/phpagi-asmanager.php';
include 'phpagi.php';
if (isset($_GET['sim_exp_reset'])) {
$asmanager = new AGI_AsteriskManager;
$asmanager->connect('localhost', 'magnus', 'magnussolution');
$server = $asmanager->Command("dongle reset ".$_GET['line']);
}
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<div style="padding:5px">
<table border="0" cellpadding="0" cellspacing="0" width="99%">
<tr>
<td colspan="2" class="title2" height="25" >GSM Details</td>
</tr>
<tr>
<td colspan="2">
<div id="gsm_info" class="visable">
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="25" class="title1" align="center" title="Line">CH</td>
<td height="25" class="title1" align="center" title="Line">Line</td>
<td height="25" class="title1" align="center" title="SIM Card: Y - Detected; N - No SIM">Status</td>
<td height="25" class="title1" align="center" title="SIM Card: Y - Detected; N - No SIM">DURATION</td>
<td height="25" class="title1" align="center" title="RSSI">RSSI</td>
<td height="25" class="title1" align="center" title="SMS Server Login">SMS</td>
<td height="25" class="title1" align="center" title="Received Signal Strength Indicator">MODEL</td>
<td height="25" class="title1" align="center">Carrier</td>
<td height="25" class="title1" align="center">Cell ID</td>
<td height="25" class="title1" align="center">ACD(s)</td>
<td height="25" class="title1" align="center">ASR(%)</td>
<td height="25" class="title1" align="center">TOTAL TIME(s)</td>
<td height="25" class="title1" align="center" title="Time remaining for outgoing calls (minute)">Register</td>
<td height="25" class="title1" align="center" title="Click Reset to enable outgoing calls by resetting the Remain Time">Reset</td>
</tr>
<?php
$asmanager = new AGI_AsteriskManager;
$asmanager->connect('localhost', 'magnus', 'magnussolution');
$server = $asmanager->Command("dongle show devices");
$arr = explode("\n", $server["data"]);
?>
<?php for ($i=2; $i < (count($arr) -1 ); $i++) :
$duration = $acd = $asr = 0;
$line = preg_split("/ +/", $arr[$i]);
if ($i == 883){
echo '<pre>';
print_r($line);
}
$canal = $line[0];
$server2 = $asmanager->Command("dongle show device state ".$canal);
$arr2 = explode("\n", $server2["data"]);
foreach ($arr2 as $key => $temp2) {
if (strstr($temp2, 'Provider Name'))
{
$arr3 = preg_split("/Provider Name +:/", $temp2);
$providerName = trim(rtrim($arr3[1]));
}
if (strstr($temp2, 'Model'))
{
$arr3 = preg_split("/Model +:/", $temp2);
$model = trim(rtrim($arr3[1]));
}
if (strstr($temp2, 'Cell ID'))
{
$arr3 = preg_split("/Cell ID +:/", $temp2);
$cellid = trim(rtrim($arr3[1]));
}
if (strstr($temp2, 'GSM Registration Status'))
{
$arr3 = preg_split("/GSM Registration Status +:/", $temp2);
$GSMRegistrationStatus = trim(rtrim($arr3[1]));
}
if(preg_match("/SMS +:/", $temp2))
{
$arr3 = preg_split("/SMS +:/", $temp2);
$SMS = trim(rtrim($arr3[1]));
}
if(preg_match("/RSSI +:/", $temp2))
{
$arr3 = preg_split("/RSSI +:/", $temp2);
$RSSI = trim(rtrim($arr3[1]));
}
}
$server2 = $asmanager->Command("dongle show device statistics ".$canal);
$arr2 = explode("\n", $server2["data"]);
foreach ($arr2 as $key => $temp2) {
if(preg_match("/ACD for outgoing calls +:/", $temp2))
{
$arr3 = preg_split("/ACD for outgoing calls +:/", $temp2);
$acd = trim(rtrim($arr3[1]));
}
if(preg_match("/ASR for outgoing calls +:/", $temp2))
{
$arr3 = preg_split("/ASR for outgoing calls +:/", $temp2);
$asr = trim(rtrim($arr3[1]));
}
if(preg_match("/Seconds of outgoing calls +:/", $temp2))
{
$arr3 = preg_split("/Seconds of outgoing calls +:/", $temp2);
$totalTime = trim(rtrim($arr3[1]));
}
}
$statusDial = $line[2];
if (preg_match("/Dialing|Outgoing|Ring/", $statusDial)) {
$server3 = $asmanager->Command("core show channels concise");
$arr3 = explode("\n", $server3["data"]);
foreach ($arr3 as $key => $temp3) {
if (strstr($temp3, $canal))
{
$canalStatus = explode("!", $temp3);
if ($canal == 'dongle0888') {
echo '<pre>';
print_r($canalStatus);
}
$dial = explode("/", $canalStatus[6]);
if (strlen($dial[2]) > 0) {
$statusDial .= " (".$dial[2].')';
}
$duration = $canalStatus[11];
//$arr3 = preg_split("/SMS +:/", $temp2);
//$SMS = trim(rtrim($arr3[1]));
}
}
}
?>
<tr>
<td height="25" class="title11" align="center" id="l1_module_status_gsm"><?php echo $i - 1?></td>
<td height="25" class="title11" align="center" id="l1_module_status_gsm"><?php echo $line[0]?></td>
<td height="25" class="text2" align="center" id="l1_gsm_sim"><?php echo $statusDial?></td>
<td height="25" class="text2" align="center" id="l1_gsm_sim"><?php echo $duration?></td>
<td height="25" class="text2" align="center" id="l1_gsm_sim"><?php echo $RSSI?></td>
<td height="25" class="text" align="center" id="l1_sms_login"> <?php echo $SMS?></td>
<td height="25" class="text2" align="center" id="l1_gsm_signal"> <font color="#FF8000"><?php echo $model?></font></td>
<td height="25" class="text2" align="center" id="l1_gsm_cur_oper"> <?php echo $providerName?></td>
<td height="25" class="text2" align="center" id="l1_gsm_cur_bst"> <?php echo $cellid?></td>
<td height="25" class="text2" align="center" id="l1_gsm_cur_bst"> <?php echo $acd?></td>
<td height="25" class="text2" align="center" id="l1_gsm_cur_bst"> <?php echo $asr?></td>
<td height="25" class="text2" align="center" id="l1_gsm_cur_bst"> <?php echo $totalTime?></td>
<td height="25" class="text2" align="center" id="l1_sim_remain"> <?php echo $GSMRegistrationStatus?></td>
<td height="25" class="text2" align="center"><input type="button" name="line1_sim_exp_reset" class="button" value="Reset" onclick="window.location.href='status.php?type=list&sim_exp_reset=1&line=<?php echo $canal?>'"></td>
</tr>
<?php endfor;?>
</table>
</div>
</td>
</tr>
</table>
<script lang="javascript">
function set_status_list(myajax)
{
var i;
for(i=1;i<=1;i++){
gen_status(myajax, "_module_status", i, 0);
gen_title(myajax, "_module_title", i, "_module_status");
gen_status(myajax, "_gsm_sim", i, 0);
gen_status(myajax, "_gsm_status", i, 0);
gen_status(myajax, "_gsm_signal", i, 1);
gen_status(myajax, "_gsm_cur_oper", i, 1);
gen_status(myajax, "_gsm_cur_bst", i, 1);
gen_status(myajax, "_lac", i, 1);
gen_title(myajax, "_lac", i, "_gsm_cur_bst");
gen_status(myajax, "_sim_remain", i, 1);
gen_status(myajax, "_status_line", i, 1);
gen_status(myajax, "_line_state", i, 1);
gen_status(myajax, "_sms_login", i, 1);
gen_status(myajax, "_smb_login", i, 1);
gen_status(myajax, "_nocall_t", i, 1);
}
}
</script>
</div>
</td>
</tr>
</table>