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:
[first-leg]
exten => _XXXX,1,Dial(SIP/${EXTEN})
same => n,Hangup
exten => h,1,NoOp(disposition: ${CDR(disposition)} - billsec: ${CDR(billsec)} - duration: ${CDR(duration)} - answertime: ${ANSWEREDTIME} - dialedtime: ${DIALEDTIME} - dialstatus: ${DIALSTATUS})
[second-leg]
exten => _XXX.,1,Set(CALLERID(num)=0873099001)
same => n,Dial(SIP/82700${calleeNum}@01ivoice-41 )
same => n,Hangup
exten => h,1,NoOp(disposition: ${CDR(disposition)} - billsec: ${CDR(billsec)} - duration: ${CDR(duration)} - answertime: ${ANSWEREDTIME} - dialedtime: ${DIALEDTIME} - dialstatus: ${DIALSTATUS})
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):
-- Executing [8801@first-leg:1] Dial("Local/8801@first-leg-000001ce;2", "SIP/8801") in new stack
-- Called 8801@first-leg/n
-- Called SIP/8801
-- SIP/8801-00004e37 is ringing
-- Local/8801@first-leg-000001ce;1 is ringing
-- SIP/8801-00004e37 answered Local/8801@first-leg-000001ce;2
-- Local/8801@first-leg-000001ce;1 answered
-- Executing [0907172380@second-leg:1] Set("Local/8801@first-leg-000001ce;1", "CALLERID(num)=0873099001") in new stack
-- Executing [0907172380@second-leg:2] Dial("Local/8801@first-leg-000001ce;1", "SIP/827000909368338@01ivoice-41") in new stack
-- Channel SIP/8801-00004e37 joined 'simple_bridge' basic-bridge <2a3534f2-add7-45ec-8c55-6fb40fa7c3a0>
-- Channel Local/8801@first-leg-000001ce;2 joined 'simple_bridge' basic-bridge <2a3534f2-add7-45ec-8c55-6fb40fa7c3a0>
-- Called SIP/827000909368338@01ivoice-41
-- Local/8801@first-leg-000001ce;1 requested media update control 26, passing it to SIP/01ivoice-41-00004e38
-- SIP/01ivoice-41-00004e38 is making progress passing it to Local/8801@first-leg-000001ce;1
-- SIP/01ivoice-41-00004e38 answered Local/8801@first-leg-000001ce;1
-- Channel SIP/01ivoice-41-00004e38 joined 'simple_bridge' basic-bridge <0063a4a3-7fd8-49d5-aa60-51b3c5f43b67>
-- Channel Local/8801@first-leg-000001ce;1 joined 'simple_bridge' basic-bridge <0063a4a3-7fd8-49d5-aa60-51b3c5f43b67>
-- Channel SIP/01ivoice-41-00004e38 left 'simple_bridge' basic-bridge <0063a4a3-7fd8-49d5-aa60-51b3c5f43b67>
-- Channel Local/8801@first-leg-000001ce;1 left 'simple_bridge' basic-bridge <0063a4a3-7fd8-49d5-aa60-51b3c5f43b67>
== Spawn extension (second-leg, 0907172380, 2) exited non-zero on ‘Local/8801@first-leg-000001ce;1’
– Executing [h@second-leg:1] NoOp(“Local/8801@first-leg-000001ce;1”, “disposition: ANSWERED - billsec: 14 - duration: 14 - answertime: 14 - dialedtime: 23 - dialstatus: ANSWER”) in new stack
– Channel Local/8801@first-leg-000001ce;2 left ‘simple_bridge’ basic-bridge <2a3534f2-add7-45ec-8c55-6fb40fa7c3a0>
– Channel SIP/8801-00004e37 left ‘simple_bridge’ basic-bridge <2a3534f2-add7-45ec-8c55-6fb40fa7c3a0>
== Spawn extension (first-leg, 8801, 1) exited non-zero on ‘Local/8801@first-leg-000001ce;2’
– Executing [h@first-leg:1] NoOp(“Local/8801@first-leg-000001ce;2”, “disposition: ANSWERED - billsec: 14 - duration: 23 - answertime: 14 - dialedtime: 23 - dialstatus: ANSWER”) in new stack
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)
[first-leg]
exten => _XXXX,1,Dial(SIP/${EXTEN})
same => n,Hangup
exten => h,1,NoOp(disposition: ${CDR(disposition)} - billsec: ${CDR(billsec)} - duration: ${CDR(duration)} - answertime: ${ANSWEREDTIME} - dialedtime: ${DIALEDTIME} - dialstatus: ${DIALSTATUS})
[second-leg]
exten => _XXX.,1,ResetCDR()
same => n,Set(CALLERID(num)=0873099001)
same => n,Dial(SIP/82700${calleeNum}@01ivoice-41 )
same => n,Hangup
exten => h,1,NoOp(disposition: ${CDR(disposition)} - billsec: ${CDR(billsec)} - duration: ${CDR(duration)} - answertime: ${ANSWEREDTIME} - dialedtime: ${DIALEDTIME} - dialstatus: ${DIALSTATUS})
from verbose:
-- Called 8801@first-leg/n
-- Executing [8801@first-leg:1] Dial("Local/8801@first-leg-000001d0;2", "SIP/8801") in new stack
-- Called SIP/8801
-- SIP/8801-00004eeb is ringing
-- Local/8801@first-leg-000001d0;1 is ringing
-- SIP/8801-00004eeb answered Local/8801@first-leg-000001d0;2
-- Local/8801@first-leg-000001d0;1 answered
**-- Executing [0907172380@second-leg:1] ResetCDR("Local/8801@first-leg-000001d0;1", "") in new stack**
-- Channel SIP/8801-00004eeb joined 'simple_bridge' basic-bridge <ff206920-51fd-4a07-a3d2-8e89a00c983e>
-- Channel Local/8801@first-leg-000001d0;2 joined 'simple_bridge' basic-bridge <ff206920-51fd-4a07-a3d2-8e89a00c983e>
-- Executing [0907172380@second-leg:2] Set("Local/8801@first-leg-000001d0;1", "CALLERID(num)=0873099001") in new stack
-- Executing [0907172380@second-leg:3] Dial("Local/8801@first-leg-000001d0;1", "SIP/827000909368338@01ivoice-41") in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/827000909368338@01ivoice-41
– Local/8801@first-leg-000001d0;1 requested media update control 26, passing it to SIP/01ivoice-41-00004eec
– SIP/01ivoice-41-00004eec is making progress passing it to Local/8801@first-leg-000001d0;1
– SIP/01ivoice-41-00004eec answered Local/8801@first-leg-000001d0;1
– Channel SIP/01ivoice-41-00004eec joined ‘simple_bridge’ basic-bridge
– Channel Local/8801@first-leg-000001d0;1 joined ‘simple_bridge’ basic-bridge
– Channel SIP/01ivoice-41-00004eec left ‘simple_bridge’ basic-bridge
– Channel Local/8801@first-leg-000001d0;1 left ‘simple_bridge’ basic-bridge
== Spawn extension (second-leg, 0907172380, 3) exited non-zero on ‘Local/8801@first-leg-000001d0;1’
– Executing [h@second-leg:1] NoOp(“Local/8801@first-leg-000001d0;1”, “disposition: ANSWERED - billsec: 13 - duration: 13 - answertime: 13 - dialedtime: 18 - dialstatus: ANSWER”) in new stack
– Channel Local/8801@first-leg-000001d0;2 left ‘simple_bridge’ basic-bridge
– Channel SIP/8801-00004eeb left ‘simple_bridge’ basic-bridge
== Spawn extension (first-leg, 8801, 1) exited non-zero on ‘Local/8801@first-leg-000001d0;2’
– Executing [h@first-leg:1] NoOp(“Local/8801@first-leg-000001d0;2”, “disposition: ANSWERED - billsec: 13 - duration: 18 - answertime: 13 - dialedtime: 18 - dialstatus: ANSWER”) in new stack
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
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?