Re: [asterisk-users] Switched from Asterisk 1.8 to 13 - CDR ringtime now always zero (Joshua C. Colp)

2019-01-09 Thread Joshua C. Colp
On Wed, Jan 9, 2019, at 6:08 AM, Tony Mountifield wrote:
> In article <009d01d4a7e0$af2e0a50$0d8a1ef0$@verishare.co.za>,
> Stefan Viljoen  wrote:
> > 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?
> 
> 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?

An excellent question. Unlike in the past versions calls can actually generate 
multiple CDRs because CDRs now represent the flow of communication between 
things.

Providing the actual CDR records that were generated as well as console output 
would allow better understanding of what is going on.

-- 
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Switched from Asterisk 1.8 to 13 - CDR ringtime now always zero (Joshua C. Colp)

2019-01-09 Thread Tony Mountifield
In article <009d01d4a7e0$af2e0a50$0d8a1ef0$@verishare.co.za>,
Stefan Viljoen  wrote:
> 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?

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: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Switched from Asterisk 1.8 to 13 - CDR ringtime now always zero (Joshua C. Colp)

2019-01-08 Thread Stefan Viljoen
Message: 2
Date: Mon, 07 Jan 2019 06:07:54 -0500
From: "Joshua C. Colp" 

>> 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/@local 

where  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(390:6:3))

${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=>_082xxx,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(390:6:3))
exten=>s,n,NoOp(Dial Status: ${DIALSTATUS})
exten=>s,n,GoTo(s-${DIALSTATUS},1)
exten=>s,n(dialLimit),Dial(${chantouse}/${numtodial},60,TL(390:6:3))
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


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: 

Re: [asterisk-users] Switched from Asterisk 1.8 to 13 - CDR ringtime now always zero (Joshua C. Colp)

2019-01-08 Thread Stefan Viljoen
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" 

>> 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/@local 

where  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(390:6:3))

${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=>_082xxx,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(390:6:3))
exten=>s,n,NoOp(Dial Status: ${DIALSTATUS})
exten=>s,n,GoTo(s-${DIALSTATUS},1)
exten=>s,n(dialLimit),Dial(${chantouse}/${numtodial},60,TL(390:6:3))
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