case 'dahdi':
if ($count_inbound) {
$channel_filter="(dstchannel LIKE 'DAHDI/".$destrunk_channelid."%' OR channel LIKE 'DAHDI/".$destrunk_channelid."%')";
} else {
$channel_filter="dstchannel LIKE 'DAHDI/".$destrunk_channelid."%'";
}
break;
case 'dongle':
if ($count_inbound) {
$channel_filter="(dstchannel LIKE 'dongle/".$destrunk_channelid."%' OR channel LIKE 'dongle/".$destrunk_channelid."%')";
} else {
$channel_filter="dstchannel LIKE 'dongle/".$destrunk_channelid."%'";
}
break;
//test number of calls
$sqldatechannel=' AND lastdata>\''.$channel_filter.'\'';
$sql='SELECT COUNT(*) FROM cdr WHERE '.$disposition.' '.$sqldatechannel.' '.$sqldate.$sqlpattern;
$sql='SELECT DISTINCT(dst) FROM cdr WHERE '.$disposition.' '.$sqldatechannel.' '.$sqldate.$sqlpattern;
$sql='SELECT SUM(billsec) FROM cdr WHERE '.$disposition.' '.$sqldatechannel.' '.$sqldate.$sqlpattern;
$sql='SELECT COUNT(*) FROM
cdr
WHERE '.$disposition.' '.$sqldatechannel.' '.$sqldate.$sqlpattern;$sql='SELECT DISTINCT(dst) FROM
cdr
WHERE '.$disposition.' '.$sqldatechannel.' '.$sqldate.$sqlpattern;$sql='SELECT SUM(billsec) FROM
cdr
WHERE '.$disposition.' '.$sqldatechannel.' '.$sqldate.$sqlpattern;