Stefan Viljoen
2019-Jan-08 06:49 UTC
[asterisk-users] 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" <jcolp at digium.com>>> On Mon, Jan 7, 2019, at 3:04 AM, Stefan Viljoen wrote: >> Hi guys. . .>> E. g. on 13, I see this (zero ringtime) for a call that I make to my >> cellphone to test, with my cellphone ringing for at least 10 seconds >> and ringing heard on the Yealink connected to the asterisk - e. g. >> completely wrong:>This is the way it is supposed to work[1], but it ultimately depends on your dialplan. Are you using Local channels? Are you doing Answer in the dialplan? What is the complete flow?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 at 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 at 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