-
Notifications
You must be signed in to change notification settings - Fork 6
/
sip_trace.phtml
68 lines (58 loc) · 1.67 KB
/
sip_trace.phtml
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
<?php
require '/etc/cdrtool/global.inc';
// if ($_REQUEST['public']) {
// $db = new DB_CDRTool;
// $key="callid-".trim($_REQUEST['callid']).trim($_REQUEST['fromtag']);
// $query=sprintf("select * from memcache where `key` = '%s'",addslashes($key));
// sleep(1);
// dprint($query);
// if ($db->query($query)) {
// if ($db->num_rows()) {
// $authorize=0;
// } else {
// $authorize=1;
// }
// } else {
// $authorize=1;
// }
// } else {
// $authorize=1;
// }
// if ($authorize==1) {
// page_open(array(
// "sess" => "CDRTool_Session",
// "auth" => "CDRTool_Auth",
// "perm" => "CDRTool_Perm")
// );
// } else {
// unset($auth);
// unset($sess);
// unset($perm);
// }
$proxyIP = $_REQUEST['proxyIP'];
$callid = htmlspecialchars($_REQUEST['callid']);
$fromtag = $_REQUEST['fromtag'];
$totag = $_REQUEST['totag'];
$cdr_source = $_REQUEST['cdr_source'];
$format = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'html';
$title = sprintf("CDRTool SIP trace for session %s", $callid);
include 'header.phtml';
require 'cdr_generic.php';
if (!$authorize || in_array($cdr_source, $CDRTool['dataSourcesAllowed'])) {
$sipTrace = new SIP_trace($cdr_source);
if ($format == 'html') {
$sipTrace->show($proxyIP, $callid, $fromtag, $totag);
} elseif ($format == 'text') {
$sipTrace->showText($proxyIP, $callid, $fromtag, $totag);
}
} else {
printf("Error: Invalid datasource '%s' for user '%s'", $cdr_source, $auth->auth["uname"]);
}
print "
</body>
</html>
";
if ($authorize=1) {
page_close();
}
?>