Switched From Asterisk 1.8 To 13 – CDR Ringtime Now Always Zero (Joshua C. Colp)

Home » Asterisk Users » Switched From Asterisk 1.8 To 13 – CDR Ringtime Now Always Zero (Joshua C. Colp)
Asterisk Users 2 Comments

Regarding this I’ve read the specs linked to in detail, but I can find no mention anywhere of any change that implies or states that no ring time will be recorded anymore in Asterisk 13 and that all times in start and answer columns will now be equal for all calls.

Can this be because I nowhere use the Answer() application in my dialplan when dialing out?

—–Original Message—–
From: Stefan Viljoen
Sent: Tuesday, 08 January 2019 08:49
To: ‘asterisk-users@lists.digium.com’
Subject: RE: Re: Switched from Asterisk 1.8 to 13 – CDR ringtime now always zero (Joshua C. Colp)

Message: 2
Date: Mon, 07 Jan 2019 06:07:54 -0500
From: “Joshua C. Colp”

.
.
.

Hi Joshua

Thank you for the reply. I’ll go read the spec in detail (which is probably what I should have done in the first place anyway.)

Yes, I am using local channels and generating the calls via AJAM by calling the Originate AMI / AJAM application. The “local” extension that is calling out is defined as local/xxxx@local where xxxx is the extension number, e. g. 3509, 3175, or whatever.

So my AJAM Originate command is

ActionID=201901080814t4qn82v Action=Originate Channel=local/3916@local Exten=0825588996
Context=local Priority=1
CallerID=3916_ctd Account=201901080814t4qn82v ChannelID=201901080814t4qn82v OtherChannelID=201901080814t4qn82vB
Variable=__CallLimit=3600
Async=true

I’m not calling the Answer application in the dialplan when dialing out.

Effectively the flow is the user clicks dial in our external application. This sends the above AJAM command to Asterisk, with parameters as specified. Asterisk originates the call on his extension as passed in the AJAM command, he picks up and the call then goes into the local context and gets routed. The STDOUT macro is called which does some prep (lots of 1.8 legacy stuff still in here) and this then calls VCCALLOUT, which contains the call to the dial() application.

VCCALLOUT calls

exten=>s,n(dialNoLimit),Dial(${chantouse}/${numtodial},60,TL(3900000:60000:30000))

${chantouse} will be something like SIP/sip-trunk-name ${numtodial} will be the target number, e. g. 27825588996

to dial out.

Detail:

My local context (simplified):

[local]

exten=>_082xxxxxxx,1,Macro(STDOUT,SIP/centra-out,27${EXTEN:1})

and the STDOUT macro, edited for brevity:

[macro-STDOUT]
;${ARG1} = channel
;${ARG2} = number exten=>s,1,Macro(WAITCHANNEL)
exten=>s,n,Macro(WAITCDR)
exten=>s,n,Macro(VCRECORD,${MACRO_CONTEXT}X${CALLERID(num)}ACC${CHANNEL(accountcode)},${ARG2})
exten=>s,n(dodial),Macro(VCCALLOUT,${ARG1},${ARG2},${ARG3},${ARG4})
exten=>s,n,NoOp(Setting Userfield after call completion)
exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
exten=>s,dodial+101,Busy()
exten=>s,n,Hangup()
exten=>s,n,MacroExit

exten=>h,1,NoOp(Call hangup MACROSTDOUT)
exten=>h,n,UserEvent(RecordingToFile,Uniqueid: ${UNIQUEID},Channel: ${Channel},Filename: ${MIXMONITOR_FILENAME}) exten=>h,n,NoOp(Recorded to ${MIXMONITOR_FILENAME})
exten=>h,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
exten=>h,n,NoOp(Account code is ${CHANNEL(accountcode)}) exten=>h,n,NoOp(call link var is ${call_Link}) exten=>h,n,GotoIf($[“${CHANNEL(accountcode)}” != “”]?done)
exten=>h,n(setacc),Set(CHANNEL(accountcode)=${call_Link})
exten=>h,n(done),noOp(Call Completed)

and the VCCALLOUT macro:

[macro-VCCALLOUT] ;macro to dial numbers ; ${ARG1} Channel To Use ; ${ARG2} Number To Dial ; ${ARG3} FailOver Channel ; ${ARG4} FailOverNumber exten=>s,n(setchan),Set(chantouse=${ARG1})
exten=>s,n,Set(numtodial=${ARG2})
exten=>s,n(makecall),GotoIf($[“${timeLimit}” = “”]?dialNoLimit:dialLimit)
exten=>s,n(dialNoLimit),Dial(${chantouse}/${numtodial},60,TL(3900000:60000:30000))
exten=>s,n,NoOp(Dial Status: ${DIALSTATUS})
exten=>s,n,GoTo(s-${DIALSTATUS},1)
exten=>s,n(dialLimit),Dial(${chantouse}/${numtodial},60,TL(3900000:60000:30000))
exten=>s,n,NoOp(Dial Status: ${DIALSTATUS})
exten=>s,n,GoTo(s-${DIALSTATUS},1)
exten=>s,dialNoLimit+101,Goto(s-${DIALSTATUS},1)
exten=>s,dialLimit+101,Goto(s-${DIALSTATUS},1)
exten=>s,n(endcall),busy()
exten=>s,n,NoOp(Call Completed – setting userfield to recording)
exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
exten=>s,n,Hangup()
exten=>s,n,MacroExit

exten=>s-NOANSWER,1,goto(s,endcall)
exten=>s-CANCEL,1,goto(s,endcall)
exten=>s-BUSY,1,goto(s,endcall)

exten=>h,1,NoOp(Call Hungup)
exten=>h,n,UserEvent(RecordingToFile,Uniqueid: ${UNIQUEID},Channel: ${Channel},Filename: ${MIXMONITOR_FILENAME}) exten=>h,n,NoOp(Recorded to ${MIXMONITOR_FILENAME})
exten=>h,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
exten=>h,n,NoOp(Account code is ${CHANNEL(accountcode)}) exten=>h,n,NoOp(call link var is ${call_Link}) exten=>h,n,GotoIf($[“${CHANNEL(accountcode)}” != “”]?done)
exten=>h,n(setacc),Set(CHANNEL(accountcode)=${call_Link})
exten=>h,n(done),noOp(Call Completed)

Thank you very much for the reply!

Regards

Stefan

2 thoughts on - Switched From Asterisk 1.8 To 13 – CDR Ringtime Now Always Zero (Joshua C. Colp)

  • Message: 2
    Date: Mon, 07 Jan 2019 06:07:54 -0500
    From: “Joshua C. Colp”

    .
    .
    .

    Hi Joshua

    Thank you for the reply. I’ll go read the spec in detail (which is probably what I should have done in the first place anyway.)

    Yes, I am using local channels and generating the calls via AJAM by calling the Originate AMI / AJAM application. The “local” extension that is calling out is defined as local/xxxx@local where xxxx is the extension number, e. g. 3509, 3175, or whatever.

    So my AJAM Originate command is

    ActionID=201901080814t4qn82v Action=Originate Channel=local/3916@local Exten=0825588996
    Context=local Priority=1
    CallerID=3916_ctd Account=201901080814t4qn82v ChannelID=201901080814t4qn82v OtherChannelID=201901080814t4qn82vB
    Variable=__CallLimit=3600
    Async=true

    I’m not calling the Answer application in the dialplan when dialing out.

    Effectively the flow is the user clicks dial in our external application. This sends the above AJAM command to Asterisk, with parameters as specified. Asterisk originates the call on his extension as passed in the AJAM command, he picks up and the call then goes into the local context and gets routed. The STDOUT macro is called which does some prep (lots of 1.8 legacy stuff still in here) and this then calls VCCALLOUT, which contains the call to the dial() application.

    VCCALLOUT calls

    exten=>s,n(dialNoLimit),Dial(${chantouse}/${numtodial},60,TL(3900000:60000:30000))

    ${chantouse} will be something like SIP/sip-trunk-name
    ${numtodial} will be the target number, e. g. 27825588996

    to dial out.

    Detail:

    My local context (simplified):

    [local]

    exten=>_082xxxxxxx,1,Macro(STDOUT,SIP/centra-out,27${EXTEN:1})

    and the STDOUT macro, edited for brevity:

    [macro-STDOUT]
    ;${ARG1} = channel
    ;${ARG2} = number exten=>s,1,Macro(WAITCHANNEL)
    exten=>s,n,Macro(WAITCDR)
    exten=>s,n,Macro(VCRECORD,${MACRO_CONTEXT}X${CALLERID(num)}ACC${CHANNEL(accountcode)},${ARG2})
    exten=>s,n(dodial),Macro(VCCALLOUT,${ARG1},${ARG2},${ARG3},${ARG4})
    exten=>s,n,NoOp(Setting Userfield after call completion)
    exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
    exten=>s,dodial+101,Busy()
    exten=>s,n,Hangup()
    exten=>s,n,MacroExit

    exten=>h,1,NoOp(Call hangup MACROSTDOUT)
    exten=>h,n,UserEvent(RecordingToFile,Uniqueid: ${UNIQUEID},Channel: ${Channel},Filename: ${MIXMONITOR_FILENAME})
    exten=>h,n,NoOp(Recorded to ${MIXMONITOR_FILENAME})
    exten=>h,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
    exten=>h,n,NoOp(Account code is ${CHANNEL(accountcode)})
    exten=>h,n,NoOp(call link var is ${call_Link})
    exten=>h,n,GotoIf($[“${CHANNEL(accountcode)}” != “”]?done)
    exten=>h,n(setacc),Set(CHANNEL(accountcode)=${call_Link})
    exten=>h,n(done),noOp(Call Completed)

    and the VCCALLOUT macro:

    [macro-VCCALLOUT] ;macro to dial numbers
    ; ${ARG1} Channel To Use
    ; ${ARG2} Number To Dial
    ; ${ARG3} FailOver Channel
    ; ${ARG4} FailOverNumber exten=>s,n(setchan),Set(chantouse=${ARG1})
    exten=>s,n,Set(numtodial=${ARG2})
    exten=>s,n(makecall),GotoIf($[“${timeLimit}” = “”]?dialNoLimit:dialLimit)
    exten=>s,n(dialNoLimit),Dial(${chantouse}/${numtodial},60,TL(3900000:60000:30000))
    exten=>s,n,NoOp(Dial Status: ${DIALSTATUS})
    exten=>s,n,GoTo(s-${DIALSTATUS},1)
    exten=>s,n(dialLimit),Dial(${chantouse}/${numtodial},60,TL(3900000:60000:30000))
    exten=>s,n,NoOp(Dial Status: ${DIALSTATUS})
    exten=>s,n,GoTo(s-${DIALSTATUS},1)
    exten=>s,dialNoLimit+101,Goto(s-${DIALSTATUS},1)
    exten=>s,dialLimit+101,Goto(s-${DIALSTATUS},1)
    exten=>s,n(endcall),busy()
    exten=>s,n,NoOp(Call Completed – setting userfield to recording)
    exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
    exten=>s,n,Hangup()
    exten=>s,n,MacroExit

    exten=>s-NOANSWER,1,goto(s,endcall)
    exten=>s-CANCEL,1,goto(s,endcall)
    exten=>s-BUSY,1,goto(s,endcall)

    exten=>h,1,NoOp(Call Hungup)
    exten=>h,n,UserEvent(RecordingToFile,Uniqueid: ${UNIQUEID},Channel: ${Channel},Filename: ${MIXMONITOR_FILENAME})
    exten=>h,n,NoOp(Recorded to ${MIXMONITOR_FILENAME})
    exten=>h,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
    exten=>h,n,NoOp(Account code is ${CHANNEL(accountcode)})
    exten=>h,n,NoOp(call link var is ${call_Link})
    exten=>h,n,GotoIf($[“${CHANNEL(accountcode)}” != “”]?done)
    exten=>h,n(setacc),Set(CHANNEL(accountcode)=${call_Link})
    exten=>h,n(done),noOp(Call Completed)

    Thank you very much for the reply!

    Regards

    Stefan

  • In article <009d01d4a7e0$af2e0a50$0d8a1ef0$@verishare.co.za>, Stefan Viljoen wrote:

    You shouldn’t Answer() the originating channel before calling Dial() on it. You should allow Dial() to propagate the answer, busy or other failure from the destination channel back to the originating channel.

    Is it possible that the setup part of the call (between initiation and answer)
    is recorded in a separate CDR?

    Cheers Tony

    Tony Mountifield Work: tony@softins.co.ukhttp://www.softins.co.uk Play: tony@mountifield.orghttp://tony.mountifield.org