Author Topic: Hotdesking tracking with the wrong agent code  (Read 2805 times)

ozzik

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Hotdesking tracking with the wrong agent code
« on: September 22, 2013, 09:55:17 »
Hi,

I already saw some topics discussing it, but they're mostly 5 years old.
So here's my setup:
Elastix 2.3 (Asterisk 1.8.11.0)
separate server for Queuemetrics 13.04.2, qloaderd, mysql
I have several access code to dial different lines, so I had to change one line in the extensions_queuemetrics.conf:
[queuedial]
;exten => _XXX.,n,Set(QDIALER_CHANNEL=SIP/${QDIALER_NUMBER})
exten => _XXX.,n,Set(QDIALER_CHANNEL=Local/${QDIALER_NUMBER}@from-internal/n)

this way everything works as expected.
Now I need to use hotdesking and the queue_log looks like this:
1379833867|1379833867.16571|NONE|Agent/801|HOTDESK|SIP/220||
1379833867|1379833867.16571|016|SIP/220|ADDMEMBER|
1379833870|1379833870.16573|NONE|Agent/801|HOTDESK|SIP/220||
1379833890|1379833890.16576|q-080|Agent/220|CALLOUTBOUND||some_dialed_number|
1379833892|1379833890.16576|q-080|Agent/220|ABANDON|1|1|2

As you can see - Agent 801 logged on to extension 220.
He tries to make an outbound call and it registers as Agent/220.
This, of course, renders the hotdesking useless as I have no way of knowing what agent uses what extension.

Can you please help? I'm trying to play with this for 2 days now.
I read all the docs and still don't understand what must be changed here.

default.rewriteLocalChannels=true
default.hotdesking=86400

my confs:
[queuedial]
exten => _XXX.,1,Set(QDIALER_QUEUE=q-${EXTEN:0:3})
exten => _XXX.,n,Set(QDIALER_NUMBER=${EXTEN:3})
exten => _XXX.,n,Set(QDIALER_AGENT=Agent/${CALLERID(num)})
exten => _XXX.,n,Set(QDIALER_CHANNEL=Local/${QDIALER_NUMBER}@from-internal/n)
exten => _XXX.,n,Set(QueueName=${QDIALER_QUEUE})
exten => _XXX.,n,MixMonitor(Q-${QDIALER_QUEUE}-${UNIQUEID}.WAV,b,)
exten => _XXX.,n,Goto(qm-queuedial,s,1)

[queuedial-loggedon]
exten => _XXX.,1,Set(QDIALER_QUEUE=q-${EXTEN:0:3})
exten => _XXX.,n,Set(QDIALER_NUMBER=${EXTEN:3})
exten => _XXX.,n,Set(QDIALER_AGENT=Agent/${AGENTBYCALLERID_${CALLERID(num)}})
exten => _XXX.,n,Set(QDIALER_CHANNEL=SIP/${QDIALER_NUMBER})
exten => _XXX.,n,Set(QueueName=${QDIALER_QUEUE})
exten => _XXX.,n,MixMonitor(Q-${QDIALER_QUEUE}-${UNIQUEID}.WAV,b,)
exten => _XXX.,n,GotoIf($[${LEN(${QDIALER_AGENT})} > 6]?qm-queuedial,s,1)
exten => _XXX.,n,NoOp,Extension ${CALLERID(num)} is not logged on as agent.
exten => _XXX.,n,Playback(agent-loggedoff)
exten => _XXX.,n,Congestion

[qm-queuedial]
exten => s,1,NoOp( "Outbound call - A:${QDIALER_AGENT} N:${QDIALER_NUMBER} Q:${QDIALER_QUEUE} Ch:${QDIALER_CHANNEL}" )
exten => s,n,Set(CDR(accountcode)=QDIALAGI)
exten => s,n,Set(ST=${EPOCH})
exten => s,n,Set(GM=QDV-${QDIALER_AGENT})
exten => s,n,Set(GLOBAL(${GM})=U)
exten => s,n,Set(GLOBAL(${GM}ans)=0)
exten => s,n,Macro(queuelog,${ST},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},CALLOUTBOUND,,${QDIALER_NUMBER})
exten => s,n,Dial(${QDIALER_CHANNEL},300,gM(queuedial-answer^${UNIQUEID}^${GM}^${QDIALER_QUEUE}^${QDIALER_AGENT}^${ST}))
exten => s,n,Set(CAUSECOMPLETE=${IF($["${DIALSTATUS}" = "ANSWER"]?C)})

; Trapping call termination here
exten => h,1,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()

Thank you
« Last Edit: September 22, 2013, 13:44:46 by ozzik »

ozzik

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Hotdesking tracking with the wrong agent code
« Reply #1 on: September 23, 2013, 15:59:41 »
I just noticed that I shouldn't create an outbound queue on asterisk.
So with a new queue on Queuemetrics and no outbound queue on asterisk it looks like this:
exten => _XXX.,n,Set(QDIALER_AGENT=Agent/${AGENTBYCALLERID_${CALLERID(num)}}) - this is the line from the dial plan concerning the agent

1379940138|1379940138.18303|q-050|Agent/|CALLOUTBOUND||some_dialed_number| - this is what is written to the queue_log.

It seems that asterisk is unaware of an agent login?
Although if I login through agent page to multiple queues - asterisk knows about all the incoming but not outgoing.

Help?

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Hotdesking tracking with the wrong agent code
« Reply #2 on: September 24, 2013, 10:15:46 »
I'd change that to

QDIALER_AGENT=SIP/${CALLERID(num)}

So that it's the SIP extension that is tracked....

ozzik

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Hotdesking tracking with the wrong agent code
« Reply #3 on: September 24, 2013, 13:38:35 »
You're the man!
I'd never thought of it.

Thanks a lot!

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Hotdesking tracking with the wrong agent code
« Reply #4 on: September 26, 2013, 09:50:02 »
It's almost ten years we support people having troubles with Asterisk queues so we know a trick or two... :)