- $query=sprintf("select CONCAT(username,'@',domain) as account from grp where grp = 'quota' and username = '%s' and domain = '%s'",$username,$domain);
-
- if (!$this->AccountsDB->query($query)) {
- $log=sprintf ("Database error for query %s: %s (%s)",$query,$this->AccountsDB->Error,$this->AccountsDB->Errno);
- syslog(LOG_NOTICE,$log);
- return 0;
- }
-
- if ($this->AccountsDB->num_rows()) {
- return 1;
- } else {
- return 0;
- }
-
- }
-
- return 0;
}
function resetQuota($accounts=array()) {
$_reset_array=array_unique($accounts);
foreach ($_reset_array as $_el) {
if (strlen($_el)) $_accounts[]=$_el;
}
$_reset_array=$_accounts;
$log=sprintf("Next quota check will rebuild the counters for %s accounts",count($_reset_array));
syslog(LOG_NOTICE,$log );
$query=sprintf("delete from memcache where `key` in ('%s','%s')",$this->quota_init_flag,$this->quota_reset_flag);
if (!$this->cdrtool->query($query)) {
$log=sprintf ("Database error for query %s: %s (%s)",$query,$this->cdrtool->Error,$this->cdrtool->Errno);
print $log;
syslog(LOG_NOTICE, $log);
return false;
}
$query=sprintf("insert into memcache (`key`,`value`) values ('%s','%s')",$this->quota_reset_flag,json_encode($_reset_array));
if (!$this->cdrtool->query($query)) {
$log=sprintf ("Database error for query %s: %s (%s)",$query,$this->cdrtool->Error,$this->cdrtool->Errno);
print $log;
syslog(LOG_NOTICE, $log);
return false;
}
$query="delete from quota_usage where account in (";
+ $query=sprintf("select CONCAT(username,'@',domain) as account from grp where grp = 'quota' and username = '%s' and domain = '%s'",$username,$domain);
+
+ if (!$this->AccountsDB->query($query)) {
+ $log=sprintf ("Database error for query %s: %s (%s)",$query,$this->AccountsDB->Error,$this->AccountsDB->Errno);
+ syslog(LOG_NOTICE,$log);
+ return 0;
+ }
+
+ if ($this->AccountsDB->num_rows()) {
+ return 1;
+ } else {
+ return 0;
+ }
+
+ }
+
+ return 0;
+ }
}
class CDR_ser_radius extends CDR {
var $show_in_icon=0;
var $show_out_icon=0;
var $QoSParameters=array(
"PS"=>"Audio packets sent",
"OS"=>"Audio octets sent",
"SP"=>"Comfort noise packets sent",
"SO"=>"Silence octets sent",
"PR"=>"Audio packets received",
"OR"=>"Audio octets received",
"CR"=>"Comfort noise packets received",
"SR"=>"Comfort noise octets received",
"PL"=>"Receive packets lost",
"BL"=>"Receive maximum burst packets lost",
"EN"=>"Encoder1, encoder 2",
"DE"=>"Decoder1, decoder 2",
"JI"=>"Jitter in ms"
);
function CDR_ser_radius(&$parent, $CDRfields) {
$this->CDRS = &$parent;
$this->cdr_source = $this->CDRS->cdr_source;
foreach (array_keys($this->CDRS->CDRFields) as $field) {
'toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1,width=1000,height=600')\"><font color=red>Click here to see the SIP trace for this call</font></a> ";
$CallInfoVerbose.= "
<tr>
<td width=10></td>
<td>Call id: </td>
<td>$this->callId</td>
</tr>
";
}
$CallInfoVerbose.= sprintf("
<tr>
<td width=10></td>
<td colspan=2>%s</td>
</tr>
", $this->traceLink);
$CallInfoVerbose.= "
<tr>
<td width=10></td>
<td>From/to tags: </td>
<td>$this->SipFromTag/$this->SipToTag</td>
</tr>
<tr>
<td></td>
<td>Start time: </td>
<td>$this->startTime $providerTimezone</td>
</tr>
";
if ($this->normalized) {
$CallInfoVerbose.= "
<tr>
<td></td>
<td>Stop time: </td>
<td>$this->stopTime $providerTimezone</td>
</tr>
";
}
$CallInfoVerbose.= "
<tr>
<td></td>
<td>Method:</td>
<td>$this->SipMethod from <i>$this->SourceIP:$this->SourcePort</i>