What is the best way to get the call duration of B-leg in Asterisk?
A num--------(a-leg)------->Asterisk PBX--------(b-leg)-----------> B num
The simple dialplan is:
[bleg_duration]
exten => _X.,1,Answer()
same => n,Wait(10)
same => n,Dial(dahdi/G1/${B_NUM},30,gS(60))
same => n,Noop(${CDR(billsec)})
same => n,Noop(${DIALEDTIME}) ;Time for the call (seconds)
same => n,Noop(${ANSWEREDTIME}) ;Time from dial to answer (seconds)
same => n,Hangup()
so if A number call to that dialplan, it wait for 10 seconds before connect to B number. I would like to get the duration from when the B num is answered to when B num hangup. I think it's common need and but can't find the easy way to get it.