Ok, now you should have a good result?
The test is realised with:
Array ( [calldate] => 2012-08-07 12:39:35 [dst] => 9425250 [billsec] => 34 [dstchannel] => DAHDI/2-1 [lastdata] => DAHDI/g2/425250,300, )
Array (
[1] => Array ( [id] => 5 [name] => l2 [prefix] => 9 [rate] => 2.0 [rate_offset] => 0.01 [trunk] => DAHDI/g2 [estado] => activo [fecha_creacion] => 2012-07-25 07:50:45 [fecha_cierre] => [hided_digits] => 2 [idParent] => 0 )
Test:
| Code: |
if (substr($value_cdr['dst'],0,strlen($arrRate[$Scan_Rate]['prefix'])) == $arrRate[$Scan_Rate]['prefix'] && substr($value_cdr['lastdata'],0,strlen($arrRate[$Scan_Rate]['trunk'])) == $arrRate[$Scan_Rate]['trunk'])
{
$price_rate = (($value_cdr['billsec'] / 60) * $arrRate[$Scan_Rate]['rate']) + $arrRate[$Scan_Rate]['rate_offset'];
$price_rate = intval($price_rate*100)/100;
$idx_rate = $Scan_Rate;
break;
}
|
If the destination begin by
9 and trunk include
DAHDI/g2 then the rate is calculated.
Otherwise, if it's not good, insert this code above
break;
| Code: |
echo "Prefix found";
|
When Prefix found will found then the test gonna be good.
Let me know.