I try to track down an error that causes that Astcc just reports the time, but 
not the costs.


I could narrow the problem down into this sub routine:


sub calccost() {
        my ($adjconn, $adjcost, $answeredtime, $increment) = @_;
        eval { my $adjtime = int(($answeredtime + $increment - 1) / $increment) 
* $increment };
        my $cost;
        print STDERR "Adjusted time is $adjtime, cost is $adjcost with $adjconn 
fee\n";
        eval { $cost = int($adjcost * $adjtime / 60) };
        $cost += $adjconn;
        print STDERR "Total cost is $cost\n";
        return $cost;


I have added changes some lines

           } elsif ($res eq "ANSWER") {
-->                    my $increment = $carddata->{inc};
--x                    my $cost = &calccost($adjconn, $adjcost, $answeredtime, 
$increment);
-->                    print STDERR " adjconn is $adjconn\n adjcost is 
$adjcost\n answeredtime is $answeredtime\n \
                   inc is $carddata->{inc}\n increment is $increment";
                   $carddata->{used} += $cost;
                   print STDERR "Total used is now $carddata->{used}\n";
                   &savecdr($cardno, $callerid, $phoneno, $trunk, $res, 
$answeredtime, $cost,$callstart);
                   &savedata($carddata);


The result is:
[Jul 23 12:20:29]   == Spawn extension (Line-optimize, 901185228376786, 512) 
exited non-zero on 'Local/[EMAIL PROTECTED],2'
res is ANSWER, answered time is 26
Adjusted time is , cost is 603 with 0 fee
Total cost is 0
adjconn is 0
adjcost is 603
answeredtime is 26
inc is 6
Total used is now 70

Why? What do I need to correct?


bye

Ronald Wiplinger
[Jul 23 12:20:29]     -- AGI Script astcc.agi completed, returning 0






_______________________________________________
Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to