[Asterisk-Users] Obtaining billsecs in the dialplan after a call?

Simone Cittadini mymailforlists at gmail.com
Mon Feb 13 05:53:10 MST 2006


steve at daviesfam.org ha scritto:

>Hi,
>
>I'm stuck on a silly thing.  I need to get the "billsec" CDR value after a 
>call.  But I'm finding its always 0.
>
>Here's my test code:
>
>exten => *244*,1,Dial(Local/test at custom-tests/n,,g)
>exten => *244*,n,Noop(after dial duration is ${CDR(duration)} billsec is 
>${CDR(billsec)})
>exten => *244*,n,Hangup
>
>[custom-tests]
>
>exten => test,1,Answer
>exten => test,n,Playback(tt-somethingwrong)
>exten => test,n,Hangup
>
>
>
>The actual CDR record that gets posted in Master.csv looks like so:
>
>"","200","*244*","default","""Exten 200"" <200>","SIP/200-94dd","Local/test at custom-tests-0255,1","Hangup","","2006-02-10 
>11:57:42","2006-02-10 11:57:42","2006-02-10 11:57:45",3,3,"ANSWERED","DOCUMENTATION"
>
>So the duration is there just fine.  But ${CDR(billsec)} remains stubbonly 
>0.
>
>Now I don't really understand the CDR code 100% - but it looks like 
>billsec is only worked out then the cdr is posted.  But there is no way to 
>force the cdr to be posted from the dialplan, is there?
>
>  
>
You have to read that variable after the hangup, use the h extension

and / or

ResetCDR([options])

Causes the Call Data Record to be reset, optionally storing the current 
CDR before zeroing it out (if 'w' option is specifed).
A CDR record *will* be stored for any activity following this command.

using h is cleaner in my opinion



More information about the asterisk-users mailing list