If you are trying to get the duration / billsec variables they are not available during the call. It has to do with how asterisk stores this information internally. You will probably have to do some sort of post processing on your CDR (ie. cron script).
Yes I want to access the BillSec field.
I need to bill the call, and update a table i have created (cdrcost).
Acutally i’m doing my own Billing System.
Do you mean that I must run cron script to update my database ???
There is no way to run a script after the call is hangup ?
You can run a script afterr the user hangs up, that is what the ‘h’ extension is for. However, Asterisk doesn’t calculate the billsecs & duration fields until it posts the CDR.
I can think of two choices for handling this.
1.) Use Asterisk CDR and cron scripts to do post processing.
2.) Keep your own timer, so you know how long the call has been up.
You can use the variable EPOCH, which will give you the current unix timestamp, or you can do it in your AGI script.