How to get billsec of the second leg when originate call

hello guys
after upgrading from asterisk-11 to asterisk-13.15.0, i’m facing problem of getting correct billsec of the second leg when originating call via AMI. It always return with billsec of 1st-leg.

below is my scenario:

My dialplan:

i originated a call like this:

picked my cellphone with 3s talktime. But from verbose, all variables returned with billsec of 1st-leg call (since i answered my extension):

this was not happen in asterisk-11, but i can not rollback to 11 because of some features i need in asterisk-13.

i have been searching a lot, many peoples mentioned about this issue but none of them are resolved. Hope someone here can help me out of this.

any helps, comments or advises would be much appreciated.

This is the same as for the outgoing side of an incoming call that you answer early.

In theory you can use ForkCDR, but I never worked out how to do it, so I use ResetCDR before the B leg Dial.

thanks for your advise, David, but nothing better with resetCDR (i tried this before already)

from verbose:

also tried with ForkCDR, but still the same.

I think I always used it with the w option. If that doesn’t make a difference, there was a big rework of CDRs that may have changed the behaviour.

Also note that, at one stage, at least, channel event logging was introduced as the preferred way of dealing with non-trivial calls.

ResetCDR(w) is still not luck, David.

But i found the way to approach this, by dialing with post-answer subroutine executed on outbound channel to get the time when B leg answer. Not sure if this way is the best, but so far it works for me :slight_smile:

thanks again David, for follow up this.

We have the same issue. Is it a bug in asterisk? ResetCDR doesn’t work. thanks

1 Like

Having same issue here.
Billsec data is correct in Asterisk 11 version, but on Asterisk 15 Billsec is always the same as Duration.
I’ve been trying to use ResetCDR, ForkCDR,… nothing changes. I am using same configuration on both versions, but Asterisk 15 sets Billsec for whole leg.
Got this topic Broken billsec and seems like lots of users have the same problem and looks like only solution is using CEL, which is not available inside dialplan. So, lots of writing/reading from database which was not at all necessary in earlier versions.
Can anyone answer why this functionality was “disabled” in a way that worked just fine in previous versions of Asterisk?
Can anyone suggest where in source code this part of billsec can be fixed so that one can fix it manually and rebuild from given sources?