Support archive of phone calls
[infodrom/phone] / index.php
1 <?
2 include_once('phone.php');
3
4 if (!empty($_POST['func'])) {
5   $data = array();
6   if ($_POST['func'] == 'incoming') {
7     $data['incoming'] = read_directory('incoming');
8   } elseif ($_POST['func'] == 'archive') {
9     $data['archive'] = read_directory('archive');
10   } elseif ($_POST['func'] == 'callinfo') {
11     $data = callinfo($_POST['dir'],$_POST['call']);
12   }
13   header('Content-type: application/json; charset=UTF-8');
14   echo json_encode($data);
15   exit;
16 } elseif (!empty($_GET['dir']) && !empty($_GET['call'])) {
17   send_call($_GET['dir'], $_GET['call']);
18   exit;
19 }
20
21 ?>
22 <html>
23 <head>
24 <title>Infodrom Phone Answering Machine</title>
25 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
26 <link href="phone.css" rel="stylesheet" type="text/css">
27 </head>
28 <script type="text/javascript" src="lib/json_parse.js"></script>
29 <script type="text/javascript" src="lib/basics.js"></script>
30 <script type="text/javascript" src="phone.js"></script>
31 <script type="text/javascript" src="lib/debug_joey.js"></script>
32
33 <body onload="page_init()">
34 <div style="margin-top: -5px">
35 </div>
36
37 <div>
38 <div class="phonelist" id="incoming">
39 <p class="title">Incoming Calls</p>
40 <ul class="phonelist" id="incoming_calls">
41 <li>Loading data...</li>
42 </ul>
43 </div>
44
45 <div class="phonelist" id="archive">
46 <p class="title">Archived Calls</p>
47 <ul class="phonelist" id="archive_calls">
48 <li>Loading data...</li>
49 </ul>
50 </div>
51
52 </div>
53
54 <div class="phonecall">
55 <p class="title">Play message</p>
56 <p id="callspeaker">&nbsp;</p>
57 <iframe class="phonecall" id="phonecall"></iframe>
58 <p id="calldate">&nbsp;</p>
59 <p id="callnote"></p>
60 </div>
61
62 </body>
63 </html>