How can I get billsec value in CDR by AGI

I wrote a AGI script which is base on PHP. But I can not get some values, like billsec in CDR, when hangup. Does AGI can access the value? If AGI can not, please tell me some other methods to get the aim.

Who can help me?

Thank you.

I just want to use AGI to realize Billing system. Who can help me resolving it?

I think you should use DeadAGI when the channel hung up…
But I don’t know anything about CDR.
Hope it helps.

Hi, Thank you!
Just forget CDR, I just want to get the duration fram call start to hangup.

Hi,

you probably using Asterisk 1.2.x, and due to a bug, Asterisk ‘loses’ some values in hangup, including CDR(billsec). There is a patch for this , search on bugs.digium.com. Then use DeadAGI, and now the CDR values are available.

Asterisk 1.4 does not suffer from this, I think.

use this in extensions.conf
exten => h,1,DeadAGI(/paht/to/script/xxx.agi|${CDR(xxx)}

look here for CDR synopsis:
voip-info.org/wiki/index.php … k+func+cdr

Thank you for help!!!