[Home]

Summary:ASTERISK-16998: AGI CDR Update bug
Reporter:Oguzhan Kayhan (gobris)Labels:
Date Opened:2010-11-22 03:12:40.000-0600Date Closed:2013-06-16 22:43:09
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
is duplicated byASTERISK-21688 CDR record cannot be modified in 'h' extension when 'g' option is used in Dial application
Environment:Attachments:
Description:We are trying to adapt an php-agi script to calculate billing. At hangup detected, we run a script called aftercall.php to calculate total bill and set this value to CDR. We added two additional fields as cost and rate to CDR table.
in aftercall.php we calculate the values and update the fields with
$agi->exec("set", "CDR(userfield)={$cost}");
$agi->exec("set", "CDR(rate)={$rateArray['data']}");
$agi->exec("set", "CDR(cost)={$cost}");

When a call made and other party doenst answer, it updates rate field correctly(which is a constant value) but, if other party answers set function doesnt work and no data written to this 2 fields . THis is when hangup deteceted without anwer:
aftercall.php: >>>>>>>>>>rate:0.04830
aftercall.php: >>>>>>>>>>duration:
   -- AGI Script Executing Application: (set) Options: (CDR(userfield)=0)
   -- AGI Script Executing Application: (set) Options: (CDR(rate)=0.04830)
   -- AGI Script Executing Application: (set) Options: (CDR(cost)=0) aftercall.php: >>>>>>>>>>>>>>>>cost:0
   -- <SIP/10010-0000000c>AGI Script aftercall.php completed, returning 0
at the end cdr fields (rate and cost field) set correctly on logs.

This is call after answer:
aftercall.php: >>>>>>>>>>duration:5
   -- AGI Script Executing Application: (set) Options:
(CDR(userfield)=0.0483)
   -- AGI Script Executing Application: (set) Options: (CDR(rate)=0.04830)
   -- AGI Script Executing Application: (set) Options: (CDR(cost)=0.0483)
aftercall.php: >>>>>>>>>>>>>>>>cost:0.0483
At the end cdr fields rate and cost set empty (As default values of sql 0.00)
There is no difference between 2 calls except one is no answer, other is answered.

****** ADDITIONAL INFORMATION ******

Asterisk version of default debian resp. 1.6.2.9-2
Comments:By: Leif Madsen (lmadsen) 2010-12-06 14:44:20.000-0600

I was doing something like this recently and was using the 'g' flag to trigger some dialplan to be executed when the other end answered the call.

By: Leif Madsen (lmadsen) 2010-12-06 14:45:16.000-0600

This may be related to the "Who hung up?" stuff we discussed at AstriCon this year:

https://wiki.asterisk.org/wiki/display/AST/AstriDevCon+2010#AstriDevCon2010-%28P3%29

By: Matt Jordan (mjordan) 2013-01-15 11:00:04.335-0600

I'm not entirely sure the Who Hung Up feature would solve this issue. You could query for the hangup causes and which channels hung up, but that doesn't really let you modify the CDR record.

By: Matt Jordan (mjordan) 2013-06-16 22:43:00.876-0500

Upon further thought, this is a duplicate of ASTERISK-21688. As noted on this issue, with certain flags set the CDR is dispatched immediately upon the bridge being broken and logic executed in hangup extensions/handlers will not affect the record. This is by design, and as such is not a bug.