├── license.txt
├── index.php
├── README.md
└── status.php
/license.txt:
--------------------------------------------------------------------------------
1 | 2014-01-07 - sysadminman-call-status
2 |
3 | This program is free software: you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License as published by
5 | the Free Software Foundation, either version 2 of the License, or
6 | (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 |
13 | You should have received a copy of the GNU General Public License
14 | along with this program. If not, see .
15 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | FeePBX Call Status
2 | ===================
3 |
4 | Forked from http://sysadminman.net/blog/2013/asterisk-outbound-call-status-page-5600 and modified for FreePBX system running version 2.9 or higher.
5 | This is a simple HTML page that displays all active calls on a FreePBX system. This is not a FreePBX module, and does not require system credentials to view.
6 |
7 | ## Requirements
8 | * FreePBX version 2.9 or later
9 | * Tested with Asterisk 1.8 and 11
10 |
11 | ## Installation
12 | * On a FreePBX system, download the files to the folder `[webroot]/call-status`
13 | * chown and chmod folder and files as necessary
14 | * In a browser, navigate to `http:///call-status`.
15 |
16 | As an example, to install on a Centos based distro such as PIAF or the FreePBX distro, you might use the following commands:
17 | ```
18 | cd /var/www/html
19 | git clone https://github.com/POSSA/freepbx-Call_Status.git call-status
20 | chown -R asterisk:asterisk /var/www/html/call-status
21 | ```
22 | ## License
23 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
24 |
25 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
26 |
27 | You should have received a copy of the GNU General Public License along with this program. If not, see .
28 |
--------------------------------------------------------------------------------
/status.php:
--------------------------------------------------------------------------------
1 | connect())
10 | {
11 | $result = $asm->Command("core show channels concise");
12 | $ccount = $asm->Command("core show channels count");
13 | }
14 | $asm->disconnect();
15 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/
16 |
17 |
18 |
19 | // FreePBX bootstrap loader
20 | if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
21 | include_once('/etc/asterisk/freepbx.conf');
22 | }
23 |
24 | // These lines modifed from original to use FreePBX $astman class
25 | if($astman->connected()) {
26 | $result = $astman->Command("core show channels concise");
27 | $ccount = $astman->Command("core show channels count");
28 | }
29 | //echo $result['data']; //debug
30 |
31 | $data = array();
32 | echo "
";
33 | echo "
call length
from
to
Channel(s)
";
34 |
35 | foreach(explode("\n", $result['data']) as $line)
36 | if (preg_match("/Up/i", $line) && preg_match("/!Dial!/i", $line))
37 | {
38 | {
39 | /* summary of $pieces and $to array values
40 | $pieces[0] = channel
41 | $pieces[1] = context
42 | $pieces[2] = extension (which could be 's' on FreePBX system)
43 | $pieces[3] = priority
44 | $pieces[4] = state
45 | $pieces[5] = application
46 | $pieces[6] = data
47 | $pieces[7] = callerid number
48 | $pieces[8] =
49 | $pieces[9] =
50 | $pieces[10] = peer account
51 | $pieces[11] = duration
52 | $pieces[12] = bridged channel
53 | */
54 | $pieces = explode("!", $line);
55 |
56 | // use regular expression to search thru concise channel data to determine the CID and trunk for the "to" end of the call
57 | // regex works for Asterisk 11 & 1.8
58 | $regex = "~".preg_quote($pieces[12],"~")."!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!(.*?)!~";
59 | preg_match($regex,$result['data'],$to);
60 |
61 | echo "