[ * It is possible to mark individual sip traces as public Adrian Georgescu **20061127152430] hunk ./cdrlib_ser.phtml 4094 - global $DATASOURCES; + global $DATASOURCES, $auth; + $this->cdrtool = new DB_CDRTool(); hunk ./cdrlib_ser.phtml 4103 + + $query="select count(*) as c, + min(date) as min, + max(date) as max + from $this->table"; + dprint($query); + if ($this->db->query($query) && $this->db->next_record()) { + $this->summary=array( + "count" => $this->db->f('c'), + "startDate" => $this->db->f('min'), + "endDate" => $this->db->f('max') + ); + } else { + print "

Error: database error. "; + return 0; + } + hunk ./cdrlib_ser.phtml 4121 + if (is_object($auth)) { + $this->isAuthorized=1; + } + hunk ./cdrlib_ser.phtml 4127 - print "

";
-            print_r($this);
-            print "
"; hunk ./cdrlib_ser.phtml 4130 - $query="select count(*) as c, - min(date) as min, - max(date) as max - from $this->table"; - dprint($query); - $this->db->query($query); - $this->db->next_record(); - $this->summary=array( - "count" => $this->db->f('c'), - "startDate" => $this->db->f('min'), - "endDate" => $this->db->f('max') - ); - hunk ./cdrlib_ser.phtml 4138 + $action = $_REQUEST['action']; + $toggleVisibility = $_REQUEST['toggleVisibility']; + + if ($action=='toggleVisibility') { + $this->togglePublicVisibility($callid,$fromtag,$toggleVisibility); + } + hunk ./cdrlib_ser.phtml 4165 - $fullURL=$protocolURL.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; - hunk ./cdrlib_ser.phtml 4167 -

SIP session trace $callid

+

SIP session trace $callid $authorize

hunk ./cdrlib_ser.phtml 4171 - URL for this trace - Click on the SIP message to see the trace +
+ + "; + if ($this->isAuthorized) { + $key="callid-".trim($callid).trim($fromtag); + + $query=sprintf("select * from memcache where `key` = '%s'",addslashes($key)); + dprint($query); + $this->cdrtool->query($query); + + if ($this->cdrtool->num_rows()) { + $selected_toggleVisibility['public']="selected"; + $fullURL=$protocolURL.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."&public=1"; + } else { + $selected_toggleVisibility['private']="selected"; + $fullURL=$protocolURL.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; + } + + print " + Trace is visible + + + + "; + print "URL for this trace"; + } + + + print " +
+ + Click on each trace entry to see the full message. + hunk ./cdrlib_ser.phtml 4482 - print " - "; + print ""; hunk ./cdrlib_ser.phtml 4485 - print " - - "; + print ""; hunk ./cdrlib_ser.phtml 4491 - print " - - "; + print ""; hunk ./cdrlib_ser.phtml 4494 - print " "; + print ""; hunk ./cdrlib_ser.phtml 4499 + } else { + print " "; hunk ./cdrlib_ser.phtml 4555 - - $status_color $msg + $status_color $msg hunk ./cdrlib_ser.phtml 4570 + } + + function togglePublicVisibility($callid,$fromtag,$public='0') { hunk ./cdrlib_ser.phtml 4574 + $key="callid-".trim($callid).trim($fromtag); + + if (!$public) { + $query=sprintf("delete from memcache where `key` = '%s'",addslashes($key)); + dprint($query); + $this->cdrtool->query($query); + } else { + $query=sprintf("delete from memcache where `key` = '%s'",addslashes($key)); + dprint($query); + $this->cdrtool->query($query); + $query=sprintf("insert into memcache values ('%s','public')",addslashes($key)); + dprint($query); + $this->cdrtool->query($query); + } hunk ./debian/changelog 8 - * CDRTool version number points to the changelog + * CDRTool version number points to the changelog + * It is possible to mark individual sip traces as public hunk ./debian/changelog 11 - -- Adrian Georgescu Sun, 26 Nov 2006 14:35:58 +0100 + -- Adrian Georgescu Mon, 27 Nov 2006 16:23:59 +0100 hunk ./sip-trace.phtml 3 -page_open(array( + +if ($_REQUEST['public']) { + $db = new DB_CDRTool; + $key="callid-".trim($callid).trim($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( hunk ./sip-trace.phtml 30 +} else { + unset($auth); + unset($sess); + unset($perm); +} + hunk ./sip-trace.phtml 43 -if (in_array($cdr_source,$CDRTool[dataSourcesAllowed])) { +if (!$authorize || in_array($cdr_source,$CDRTool[dataSourcesAllowed])) { hunk ./sip-trace.phtml 60 -page_close(); +if ($authorize=1) { + page_close(); +} hunk ./style.css 169 - vertical-align: top; + vertical-align: middle;