Ben Dinnerville
2010-Feb-03 00:43 UTC
[asterisk-users] CDR / billsec / originate / local chan
Hi All, I have been running a environment with asterisk 1.4.20.1 for some time now with no issue but have recently added some extra functionality (enabled call recording via MixMonitor) and ran into some deadlock issues which seem to be well documented with earlier 1.4.x releases so have decided to take the plunge and upgrade. I decided to start testing with 1.6.2 but have run into a couple of issues. We run an environment that triggers outbound calls via AMI / asterisk java and places the call upon answer back into a context that has IVR, TTS/ VXML etc. Running with 1.4.20.1, we have not had any issues and have been able to access all of the CDR fields in the h exten (using endbeforehexten=yes in cdr.conf) however after upgrading all our post answer related cdr information is reporting 0. Fields such as billsec, answer etc all return either 0 or null which is causing a lot of issues for us as we use some AGI post call via the h exten to perform processing based on billable duration etc. I have found a number of threads / articles etc discussing various billsec related issues but it is hard to get a picture of what should work on what version of asterisk. For example, I know that my environment works on 1.4.20 but it is broken in 1.4.23 and seems to be broken in 1.6.2 (pretty sure I tried 1.6.0.9 as well with the same result) How t works in 1.4.20.1 is as follows: We trigger call via Originate action as follows: action:.Originate.. actionid:.1306903_89#AJ_ORIGINATE_25 timeout:.40000 exten:.s async:.true callerid:."".<61211111111> context:.campaignType_5 priority:.1 channel:.SIP/trunk1/61212142321 And the campaignType_5 context looks similar to: [campaignType_5_] exten = s,1,Answer() exten = s,n,Set(timestarted=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}) exten = s,n,Set(CALLSTATUS=0) exten = s,n,Background(lyrics-louie-louie) exten = s,n,WaitExten(5) exten = s,n,Set(timefinished=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}) exten = s,n,Set(DIGITPRESSED=99) exten = s,n,Set(TIMETOPRESS=${timestarted)}) exten = s,n,NoOp(Billsec is: ${CDR(billsec)}) exten = s,n,Hangup exten = 1,1,Set(DIGITPRESSED=${EXTEN}) exten = 1,n,Set(TIMETOPRESS=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}) exten = 1,3,Playback(wait-moment) exten = 1,4,Dial(Local/${CALLLOGID}_${AGENTNUMBER}@campaignType_5_agent/n) exten = 1,5,Hangup exten = h,1,Set(timefinished=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}) exten = h,2,GotoIf($["${TIMETOPRESS}foo" = "foo"]?h,20) exten = h,3,GotoIf($["${DIGITPRESSED}foo" = "foo"]?h,10) exten = h,4,Set(carrier=9) exten = h,n,AGI(agi://${DB(APPS/AGISERVER)}/ccoAgentActivityAgi.agi?BILLABLEDURATION=${CDR(billsec)}&CALLLOGID=${CALLLOGID}&CALLSTATUS=${CALLSTATUS}&CAMPAIGNID=${CAMPAIGNID}&DIGITPRESSED=${DIGITPRESSED}&DURATION=${CDR(duration)}&TARGETID=${TARGETID}&TIMEFINISHED=${TIMEFINISHED}&TIMEPRESSED=${TIMETOPRESS}&TIME STARTED=${TIMESTARTED}&STATECHANGE=CALLDOWN&NODEID=${NODEID}) exten = h,10,Set(DIGITPRESSED=77) exten = h,11,Set(timefinished=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}) exten = h,12,Goto(h,3) exten = h,20,Set(TIMETOPRESS=${timestarted}) exten = h,21,Goto(h,3) exten = failed,1,Set(DIGITPRESSED=98) exten = failed,2,Set(TIMETOPRESS=${timestarted}) exten = failed,3,Set(CALLSTATUS=6) exten = failed,4,Set(timestarted=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}) exten = failed,5,Set(timefinished=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}) As mentioned, in 1.4.20 this works fine with all cdr fields being reported correctly, but on 1.6.2 (and various other versions, on the h exten with the AGI call we get duration reported correctly but billsec = 0 We are not using Local channels here unless Asterisk is optimising the outbound leg of the call into one invisibly. On 1.6.2 I have also tried using a local channel for the outbound leg with the originate looking like the following: action:.Originate.. actionid:.1306903_89#AJ_ORIGINATE_25 timeout:.40000 exten:.s async:.true callerid:."".<61211111111> context:.campaignType_5 priority:.1 channel:.Local/61212142321 at outboundsip/n And the Local context as follows; [outboundsip] exten = _XX.,1,Dial(SIP/trunk1/${EXTEN}) exten = _XX.,n,Hangup exten = h,1,NoOp(Billsec is: ${CDR(billsec)}) In this configuration, whilst the outbound call goes out and billsec gets reported correctly in the h exten, the call does not get bridged back into the campaignType_5 context so none of the call processing occurs. I cannot see any options that can be passed to the dial command that may affect the bridging of the call back into the campaignType_5 context??? Does anyone out there know which way I need to hang my tongue out of my mouth, how much i need to squint my eye and how far I need to tilt my head (and to which side) to get 1.6.2 or any other post 1.4.20 version of asterisk to report billsec etc back at the h exten for a call established via an Originate action similar to how it was working in 1.4.20? I have been through a number of bug reports, mailing lists posts, web sites etc and there seems to be a number of issues reported over the years relating to billsec / h exten / originate but it seems to change from version to version. Thanks in advance, Ben
>On 1.6.2 I have also tried using a local channel for the outbound leg >with the originate looking like the following: > > action:.Originate.. > actionid:.1306903_89#AJ_ORIGINATE_25 > timeout:.40000 > exten:.s > async:.true > callerid:."".<61211111111> > context:.campaignType_5 > priority:.1 > channel:.Local/61212142321 at outboundsip/n > >And the Local context as follows; > >[outboundsip] >exten = _XX.,1,Dial(SIP/trunk1/${EXTEN}) >exten = _XX.,n,Hangup > >exten = h,1,NoOp(Billsec is: ${CDR(billsec)}) > >In this configuration, whilst the outbound call goes out and billsec >gets reported correctly in the h exten, the call does not get bridged >back into the campaignType_5 context so none of the call processing >occurs. I cannot see any options that can be passed to the dial command >that may affect the bridging of the call back into the campaignType_5 >context???Have you tried removing the /n option from the local channel? Just a thought, but it's probably worth a try. You could also try calculating the billsec in the dialplan and write it to the CDR with the adaptive CDR feature in 1.6.2. Not sure if this is helpful but it was a thought. -Sean