artithw / asterisk-cdr-viewer

Automatically exported from code.google.com/p/asterisk-cdr-viewer
0 stars 0 forks source link

New rate_type 30s+s and 30s+6s #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Hello, I added the rate_type type 30s+s this way:

functions.inc.php > add >

} elseif ( $callrate_cache[$file][substr($dst,0,$i)][2] == '30s+s' ) {
// 30 second + per second
if ( $duration < 30) {
$call_rate = ($callrate_cache[$file][substr($dst,0,$i)][0] / 2);
} else {
$call_rate = $callrate_cache[$file][substr($dst,0,$i)][0] + ( ($duration-60) * 
($callrate_cache[$file][substr($dst,0,$i)][0] / 60) );
}

And I need to add rate_type 30s+6s to use Skype.

Could someone help, please?

Original issue reported on code.google.com by celo...@gmail.com on 23 Oct 2014 at 4:06

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, should be Enhancement not a Defect..

Original comment by celo...@gmail.com on 23 Oct 2014 at 4:13

GoogleCodeExporter commented 9 years ago
More optimized code for 30s+s:

} elseif ( $callrate_cache[$file][substr($dst,0,$i)][2] == '30s+s' ) {
// 30 second + per second
if ( $duration > 0 && $duration <= 30) {
$call_rate = ($callrate_cache[$file][substr($dst,0,$i)][0] / 2);
} elseif ( $duration > 30 && $duration < 60) {
$call_rate = ($callrate_cache[$file][substr($dst,0,$i)][0] / 2) + ( 
($duration-30) * ($callrate_cache[$file][substr($dst,0,$i)][0] / 60) );
} else {
$call_rate = $callrate_cache[$file][substr($dst,0,$i)][0] + ( ($duration-60) * 
($callrate_cache[$file][substr($dst,0,$i)][0] / 60) );
}

I need to add rate_type 30s+6s to use Skype.

Could someone help, please?

Original comment by celo...@gmail.com on 27 Oct 2014 at 11:23

GoogleCodeExporter commented 9 years ago
Is this right for 30s+6s (like Skype)?

} elseif ( $callrate_cache[$file][substr($dst,0,$i)][2] == '30s+6s' ) {
// 30 second + 6 second
if ( $duration > 0 && $duration <= 30) {
$call_rate = ($callrate_cache[$file][substr($dst,0,$i)][0] / 2);
} else {
$call_rate = ceil($duration / 6) * 
($callrate_cache[$file][substr($dst,0,$i)][0] / 10);
}

Thanks.

Original comment by celo...@gmail.com on 27 Oct 2014 at 1:32

GoogleCodeExporter commented 9 years ago
Thanks for the comment, I'm going to add this code to trunk.

Original comment by igor.oku...@gmail.com on 30 Oct 2014 at 8:24

GoogleCodeExporter commented 9 years ago
add to trunk and v 1.0.7 build.

Original comment by igor.oku...@gmail.com on 1 Nov 2014 at 11:55