Can you help me understand what you're doing in qm-queuedialer please?
I can trap the DIALSTATUS for the direct inbound calls in a context called: ext-local-custom
Given this I'm reconsidering moving to this code. Does it make sense?
[from-pstn-custom]
; ... your existing dialplan; We use the last 4 digits of the DID as the user's extension (check for your install)
exten => _X.,n,Set(user=${EXTEN:-4:4})
; eg. user=1111
; Set InQ to be the queue you want to track for incoming queue
; comma separated -- quotes are essential!
exten => _X.,n,Set(InQueues="125,126")
exten => _X.,n,Set(IsInQueue=0)
exten => _X.,n,While(${EXISTS(${InQueues})})
exten => _X.,n,Set(InQ="${CUT(InQueues,\,,1)}")
exten => _X.,n,Set(InQueues="${CUT(InQueues,\,,2-)}")
exten => _X.,n,Set(QML="${QUEUE_MEMBER_LIST(${InQ})}")
exten => _X.,n,While(${EXISTS(${QML})}))
exten => _X.,n,Set(IsInQueue=${IF($[ ${CUT(CUT(QML,@,1),/,2)} = ${user}]?$[${IsInQueue}+1]:${IsInQueue})})
exten => _X.,n,GotoIf($[${IsInQueue}]?matched) ; track it, stop looking!
exten => _X.,n,Set(QML="${CUT(QML,\,,2-)}")
exten => _X.,n,EndWhile
exten => _X.,n,EndWhile
exten => _X.,n(matched),Set(QDIALER_NUMBER=${CALLERID(number)})
exten => _X.,n,Set(QDIALER_QUEUE=q-${InQ})
exten => _X.,n,Set(QDIALER_AGENT=Local/${user}@from-queue)
exten => _X.,n,Set(QDIALER_CHANNEL=SIP/${user})
exten => _X.,n,NoOp(Track Call? ${IsInQueue})
exten => _X.,n,GotoIf($[${IsInQueue}]?queue:noqueue)
exten => _X.,n(queue),NoOp( "Inbound call - A:${QDIALER_AGENT} N:${QDIALER_NUMBER} Q:${QDIALER_QUEUE} Ch:${QDIALER_CHANNEL}" )
exten => _X.,n,Set(CDR(accountcode)=QDIALAGI)
exten => _X.,n,Set(ST=${EPOCH})
exten => _X.,n,Set(GM=QDV-${QDIALER_AGENT})
exten => _X.,n,Set(GLOBAL(${GM})=U)
exten => _X.,n,Set(GLOBAL(${GM}ans)=0)
exten => _X.,n,Macro(queuelog,${ST},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},CALLOUTBOUND,,${QDIALER_NUMBER})
exten => _X.,n(noqueue),Goto(ext-did,${EXTEN},1)
[ext-local-custom]
; Trapping call termination here
exten => h,1,Set(CAUSECOMPLETE=${IF($["${DIALSTATUS}" = "ANSWER"]?C)})
exten => h,n,NoOp( "Call exiting: status ${GLOBAL(${GM})} answered at: ${GLOBAL(${GM}ans)} DS: ${DIALSTATUS}" )
exten => h,n,Goto(case-${GLOBAL(${GM})})
exten => h,n,Hangup()
; Call unanswered
exten => h,n(case-U),Set(WT=$[${EPOCH} - ${ST}])
exten => h,n,Macro(queuelog,${EPOCH},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},ABANDON,1,1,${WT})
exten => h,n,Hangup()
; call answered: agent/callee hung
exten => h,n(case-A)i,Set(COMPLETE=${IF($["${CAUSECOMPLETE}" = "C"]?COMPLETECALLER:COMPLETEAGENT)})
exten => h,n,Set(WT=$[${GLOBAL(${GM}ans)} - ${ST}])
exten => h,n,Set(CT=$[${EPOCH} - ${GLOBAL(${GM}ans)}])
exten => h,n,Macro(queuelog,${EPOCH},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},${COMPLETE},${WT},${CT})
exten => h,n,Hangup()
; Call not tracked
exten => h,n(case-),NoOp(here)
exten => h,n,Hangup()
The problem with this is that it doesn't get called when connected and terminated.
Maybe the "cook the CDR" approach is better...