I am using Asterisk build 188.8.131.52 and I noticed that when the dialplan goes through AGI and the call is hanged up before being answered at the destination, the call is charged, ie billsec > 0 and the call disposition is marked as ‘ANSWERED’
However if the call is answered billsec is set correctly. eg if the whole call lasted for 20secs, and talk time was 8 secs, duration = 20, billsec = 8
However if the call was hung up before answering billsec is set incorrectly. eg if the whole call lasted for 20secs, duration = 20, billsec = 20 or in some cases billsec=19 (duration - 1)
Whether the dialling itself is done within the AGI, or the AGI drops into the dialplan to allow the call to originate there, the result is the same.
Is this normal Asterisk behaviour, or a bug?
It looks like the $agi->answer() command is treated as a normal call answer, unless the call is answered at the other end, in which the CDR uses the billsecs for that call. Even if I skip the dial in the dialplan and jump to Hangup in the context, it is still treated as ‘ANSWERED’ with duration as 0.