[Home]

Summary:ASTERISK-18240: UniqueID is posted twice to CDR when CDR(userfield) is extended/broken in the process.
Reporter:Shane Spencer (whardier)Labels:
Date Opened:2011-08-08 12:00:08Date Closed:2011-09-19 15:24:50
Priority:MinorRegression?
Status:Closed/CompleteComponents:Applications/app_cdr Applications/app_queue
Versions:1.8.4 Frequency of
Occurrence
Occasional
Related
Issues:
Environment:Attachments:
Description:First off, I'm not sure if posting a record twice is usual and intentional for queues.  It doesn't appear to happen for all calls that go through app_queue - instead only a small percentage have this happen.

Here is an example of a call that was answered by SIP telephone (SIP or local channels react the same).  Identical uniqueid.  The userfield is always a repeat of the original userfield with the semi-colon always in the same pattern.  I haven't been able to find code in app_queue.c or cdr.c that modify the userfield to this extent.

{noformat}
*************************** 263. row ***************************
  uniqueid: pbx01.voip.cda01-1312495042.10971
     start: 2011-08-04 21:57:22
disposition: ANSWERED
   lastapp: Queue
  lastdata: Sales-ID,i,,,15
 userfield: Main-Sales-ID-CDA-Queue-State
*************************** 264. row ***************************
  uniqueid: pbx01.voip.cda01-1312495042.10971
     start: 2011-08-04 21:58:10
disposition: ANSWERED
   lastapp: Dial
  lastdata: SIP/4317,25,dwWiI
 userfield: Main-Sales-ID-CDA-Queue-StateMain-Sales-ID-CDA-Queue-State;Main-Sales-ID-CDA-Queue-State
{noformat}

Heres a few more:


{noformat}
*************************** 259. row ***************************
  uniqueid: pbx01.voip.cda01-1312493287.10893
     start: 2011-08-04 21:28:07
disposition: ANSWERED
   lastapp: Queue
  lastdata: Sales-ID,i,,,15
 userfield: Main-Sales-ID-CDA-Queue-State
*************************** 260. row ***************************
  uniqueid: pbx01.voip.cda01-1312493287.10893
     start: 2011-08-04 21:28:41
disposition: NO ANSWER
   lastapp: VoiceMail
  lastdata: 4317,u
 userfield: Main-Sales-ID-CDA-Queue-StateMain-Sales-ID-CDA-Queue-State;Main-Sales-ID-CDA-Queue-State
{noformat}

{noformat}
*************************** 253. row ***************************
  uniqueid: pbx01.voip.cda01-1312486992.10616
     start: 2011-08-04 19:43:12
disposition: ANSWERED
   lastapp: Queue
  lastdata: Sales-ID,i,,,15
 userfield: Sales-ID-CDA-Queue-State
*************************** 254. row ***************************
  uniqueid: pbx01.voip.cda01-1312486992.10616
     start: 2011-08-04 19:44:30
disposition: ANSWERED
   lastapp: Dial
  lastdata: SIP/4309,25,dwWiI
 userfield: Sales-ID-CDA-Queue-StateSales-ID-CDA-Queue-State;Sales-ID-CDA-Queue-State
{noformat}

And here's the dialplan: 12084164301@did is the entry point for the first example.

{noformat}
[locale]
 exten => locale,1,Set(npanxx=${FILE(/usr/local/share/asterisk/nanpa/${ARG1:1:3}/${ARG1:4:3})})
 exten => locale,n,Set(CDR(npanxx)=${npanxx})
 exten => locale,n,Set(CDR(origcid)=${CALLERID(num):-10})
 exten => locale,n,Set(CDR(orignpanxx)=${FILE(/usr/local/share/asterisk/nanpa/${CDR(origcid):0:3}/${CDR(origcid):3:3})})
 exten => locale,n,ExecIF($[ "${GLOBAL(${npanxx})}" != "" ]?Set(ARRAY(tostate,tocity)=${GLOBAL(${npanxx})}))
 exten => locale,n,ExecIF($[ "${ARG1:0:4}" = "1800" ]?Set(ARRAY(tostate,tocity)=ID,CDA)) ; FIXME - Toll free numbers should go to global queues/trees of $
 exten => locale,n,ExecIF($[ "${ARG1:0:4}" = "1866" ]?Set(ARRAY(tostate,tocity)=ID,CDA)) ; FIXME - Toll free numbers should go to global queues/trees of $
 exten => locale,n,ExecIF($[ "${ARG1:0:4}" = "1877" ]?Set(ARRAY(tostate,tocity)=ID,CDA)) ; FIXME - Toll free numbers should go to global queues/trees of $
 exten => locale,n,ExecIF($[ "${ARG1:0:4}" = "1888" ]?Set(ARRAY(tostate,tocity)=ID,CDA)) ; FIXME - Toll free numbers should go to global queues/trees of $
 exten => locale,n,Return()

[didroute]
 include => locale

 exten => s,1,Set(CDR(accountcode)=${ARG1})
 exten => s,n,Set(CDR(cid_name)=${CALLERID(name)})
 exten => s,n,Set(CDR(cid_num)=${CALLERID(num):-10})
 exten => s,n,Set(CDR(cid_ani)=${CALLERID(ANI-all)})
 exten => s,n,Set(CDR(cid_rdnis)=${CALLERID(RDNIS)})
 exten => s,n,Set(CDR(cid_dnid)=${CALLERID(DNID)})
 exten => s,n(locale),Gosub(locale,1(${ARG1}))      ; Look up 11 digit number.. also set the tostate/tocity based on the first argument.
 exten => s,n,GotoIf($[ "${ARG2:-9}" = "+cidstate" ]?cidstate)
 exten => s,n,GotoIf($[ "${ARG2:-9}" = "+override" ]?override)
 exten => s,n,Set(ARRAY(state,city)=${tostate},${tocity})
 exten => s,n(route),ExecIf($[ "${ARG2:-6}" = "+state" ]?Set(ARG2=${ARG2:0:-6}-${tostate}))
 exten => s,n,Goto(${ARG2},${ARG3},${ARG4})
 exten => s,n,Hangup()
 exten => s,n(cidstate),Set(ARG2=${ARG2:0:-9}+state)
 exten => s,n,GotoIf($[ ${state} ]?route)              ; Lookup existing state and use it if exists
 exten => s,n,Set(ARG1=1${CALLERID(num):-10})          ; Otherwise set the locale preference to inbound CID
 exten => s,n,Goto(locale)             ; Go back to locale which will return nothing if match not found
 exten => s,n(override),Set(ARG2=${ARG2:0:-9})
 exten => s,n,Set(ARRAY(state,city)=${ARG5},${ARG6})
 exten => s,n,Goto(route)

[did]
 exten => _1208416430[3456789],1,Gosub(didroute,s,1(${EXTEN},phones,${EXTEN:7},1))
 exten => _12084164301,1,Gosub(didroute,s,1(${EXTEN},tree-main,menu,1))

[tree-extensions]
 exten => prep,1,ExecIf($[ ${LEN(${state}${city})} = 0 ]?Set(ARRAY(state,city)=ID,CDA)}) ;; FIXME
 exten => prep,n,GotoIf($[ "${ARG1}" = "" & "${ARG2}" != "" & "${breadcrumbs}" = "" ]?default)
 exten => prep,n,GotoIf($[ "${ARG2}" != "" & "${breadcrumbs}" != "" ]?continue)
 exten => prep,n,Set(breadcrumbs=${ARG1}-${state}-${city})
 exten => prep,n(continue),Set(CDR(userfield)=${breadcrumbs})
 ;;exten => prep,n,Set(CDR(accountfield)=${CDR(cid_dnid)}) ;; REQUIRES LOCALE TO BE RUN FIRST ;; COMMENTED BECAUSE IT SHOULD BE DONE ALREADY
 exten => prep,n,Set(CHANNEL(musicclass)=Tune3)
 exten => prep,n,Set(TIMEOUT(digit)=2)
 exten => prep,n,Set(TIMEOUT(response)=30)
 exten => prep,n,Set(TIMEOUT(absolute)=7200)
 exten => prep,n,Return()
 exten => prep,n(default),Set(breadcrumbs=${ARG2}-${state}-${city})
 exten => prep,n,Goto(continue)

 ;;;; exten => _[a-z].,1,Goto(${EXTEN},1) ; DO I NEED THIS? FIXME

 exten => timeout,1,Answer()
 exten => timeout,n,Set(CDR(userfield)=${breadcrumbs}-Timeout)
 exten => timeout,n,Voicemail(${ARG1},u)
 exten => timeout,n,Return()

 exten => invalid,1,Answer()
 exten => invalid,n,ExecIf($[${EXISTS(${i})}]?Set(i=$[0${i}+1]):Set(i=1))
 exten => invalid,n,GotoIf($[${i}>2]?voicemail)
 exten => invalid,n,Background(pbx-invalid)
 exten => invalid,n,Return()
 exten => invalid,n(voicemail),Set(CDR(userfield)=${breadcrumbs}-Invalid)
 exten => invalid,n,Voicemail(${ARG1},u)
 exten => invalid,n,Return()

 exten => hangup,1,NoOp(${CDR(disposition)})
 exten => hangup,n,NoOp(${CDR(userfield)})
 exten => hangup,n,Set(CDR(monitor_files)=${MIXMONITOR_FILENAME}) ;; fun
 exten => hangup,n,DumpChan()
 exten => hangup,n,ExecIf($["${VMSTATUS}" = "SUCCESS"]?Return())
 exten => hangup,n,ExecIf($[${EXISTS(${BRIDGEPEER})}]?Return())
 exten => hangup,n(route),Return()
 exten => hangup,n,Return()

 exten => mainmenu,1,GotoIf($[ ${DIALPLAN_EXISTS(${mainmenu},menu,1)} ]?${mainmenu},menu,1)
 exten => mainmenu,n,Goto(tree-main,menu,1)

 exten => monitor,1,Set(MONITOR_PREFIX=${ARG1})
 exten => monitor,n,Return()

[tree-main]
 include => tree-extensions
 include => extensions
 include => phones

 exten => menu,1,Answer()
 exten => menu,n,Set(mainmenu=tree-main)
 exten => menu,n,Gosub(prep,1(Main,))
 exten => menu,n,Set(CDR(userfield)=${breadcrumbs}-Intro)
 exten => menu,n,WaitExten(1)
 exten => menu,n,Background(custom/idaho-tree-main)
 exten => menu,n,WaitExten(2)
 exten => menu,n,Background(custom/idaho-tree-main)
 exten => menu,n,WaitExten(2)
 exten => menu,n,Background(custom/idaho-tree-main)
 exten => menu,n,WaitExten(2)
 exten => menu,n,Background(custom/idaho-tree-main)
 exten => menu,n,WaitExten(2)
 exten => menu,n,Goto(voicemail,1)
 exten => menu,n,Hangup()

 exten => voicemail,1,Gosub(prep,1(Main,))
 exten => voicemail,n,Set(CDR(userfield)=${breadcrumbs}-VoiceMail)
 exten => voicemail,n,Voicemail(catchall,u)

 exten => sales,1,Gosub(prep,1(Main-Sales,))
 exten => sales,n,Goto(tree-sales-${state},menu,1)

 exten => csr,1,Gosub(prep,1(Main-CSR-Overflow,))
 exten => csr,n,Goto(to-microcom,csroverflow,1)

 exten => 1,1,Goto(sales,1)
 exten => 2,1,Goto(tree-main-option-2,menu,1)
 exten => 3,1,Goto(csr,1)
 exten => 4,1,Goto(tree-main-option-4,menu,1)

 exten => i,1,Gosub(prep,1(Main,))
 exten => i,n,Gosub(invalid,1(catchall))
 exten => i,n,Goto(menu,1)

 exten => t,1,Gosub(prep,1(Main,))
 exten => t,n,Gosub(timeout,1(catchall))

 exten => h,1,Gosub(hangup,1)

[tree-sales]
 include => tree-extensions

 exten => menu,1,Ringing() ;; No Answer()
 exten => menu,n,Gosub(prep,1(,Sales))
 exten => menu,n,Set(CDR(userfield)=${breadcrumbs}-Intro)
 ;;exten => menu,n,Playback(for-quality-purposes&this-call-may-be-monitored-or-recorded)
 exten => menu,n,Set(CALLERID(name)=(${CDR(promotion_code)}) ${CALLERID(name)})
 exten => menu,n(queue),Wait(1)
 exten => menu,n,Gosub(monitor,1(Sales))

 ;exten => menu,n,Set(CDR(userfield)=${breadcrumbs}-Queue-State-City)
 ;exten => menu,n,Queue(Sales-${state}-${city},i,,,10)
 exten => menu,n,Set(CDR(userfield)=${breadcrumbs}-Queue-State)
 exten => menu,n,Queue(Sales-${state},i,,,15)
 exten => menu,n,Set(CDR(userfield)=${breadcrumbs}-Queue-Global)
 exten => menu,n,Queue(Sales-Global,i,,,20)

 exten => menu,n(voicemail),Set(CDR(userfield)=${breadcrumbs}-VoiceMail)
 exten => menu,n,Goto(voicemail,1)
 exten => menu,n,Hangup()

 exten => voicemail,1,Gosub(prep,1(,Sales))
 exten => voicemail,n,Set(CDR(userfield)=${breadcrumbs}-VoiceMail)
 exten => voicemail,n,Voicemail(vmsales,u)

 exten => i,1,Gosub(prep,1(,Sales))
 exten => i,n,Gosub(invalid,1(sales))
 exten => i,n,Goto(menu,1)

 exten => t,1,Gosub(prep,1(,Sales))
 exten => t,n,Gosub(timeout,1(sales))

 exten => h,1,Gosub(hangup,1)

[tree-dish-XX](!)
 exten => menu,1,Goto(tree-main,menu,1)
[tree-dish-ID](tree-dish-XX)
{noformat}
Comments:By: Shane Spencer (whardier) 2011-08-08 12:03:17.556-0500

I should note this happens regardless of the CDR backend.

By: Leif Madsen (lmadsen) 2011-09-14 08:05:47.679-0500

Is there a chance you could provide a simpler set of dialplan that will generate this error? What you have there is doing a lot more than is probably necessary to repeat the condition you're describing.

By: Matthew Nicholson (mnicholson) 2011-09-14 11:21:18.447-0500

What you are seeing may be the intended behavior. It appears that after your calls leave the queue, they are going on to voicemail or to another dial operation sometimes. You can either prevent this from happening via your dialplan, or you should be able to use the NoCDR application to suppress the second (or first) CDR record.

By: Shane Spencer (whardier) 2011-09-14 12:05:59.560-0500

Thanks guys.  I believe this has to do with transfers post queue... I haven't had time to track down more information on this.

For now, while I am writing some CDR/CEL software, I will be using the CEL for correlations.

- Shane

By: Leif Madsen (lmadsen) 2011-09-19 15:24:50.949-0500

I'm closing this as Not A Bug for now. I'm in agreement with Matt after reviewing this last week, that I feel this is operating as it should.