# How can I get billsec value in CDR by AGI

**URL:** <https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664>\
**Category:** Asterisk Support\
**Created:** [January 15, 2007, 4:00pm UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664 "2007-01-15T16:00:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![headman](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@headman](https://community.asterisk.org/u/headman)\
**Post date:** [January 15, 2007, 4:00pm UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664/1 "2007-01-15T16:00:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![headman](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@headman](https://community.asterisk.org/u/headman)\
**Post date:** [January 16, 2007, 3:33pm UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664/2 "2007-01-16T15:33:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ags\_squale](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@ags\_squale](https://community.asterisk.org/u/ags_squale)\
**Post date:** [January 17, 2007, 11:09am UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664/3 "2007-01-17T11:09:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![headman](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@headman](https://community.asterisk.org/u/headman)\
**Post date:** [January 17, 2007, 3:26pm UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664/4 "2007-01-17T15:26:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yusuf](https://avatars.discourse-cdn.com/v4/letter/y/c68b51/32.png) [@yusuf](https://community.asterisk.org/u/yusuf)\
**Post date:** [January 18, 2007, 7:33pm UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664/5 "2007-01-18T19:33:36Z")

</div>

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](http://bugs.digium.com). Then use DeadAGI, and now the CDR values are available.

Asterisk 1.4 does not suffer from this, I think.

---

<div class="post-metadata">

**Author:** ![jud](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jud](https://community.asterisk.org/u/jud)\
**Post date:** [January 19, 2007, 3:11am UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664/6 "2007-01-19T03:11:25Z")

</div>

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](http://www.voip-info.org/wiki/index.php?page=Asterisk+func+cdr)

---

<div class="post-metadata">

**Author:** ![headman](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@headman](https://community.asterisk.org/u/headman)\
**Post date:** [January 23, 2007, 9:21am UTC](https://community.asterisk.org/t/how-can-i-get-billsec-value-in-cdr-by-agi/11664/7 "2007-01-23T09:21:13Z")

</div>

Thank you for help!!!
