OK, so my apologies for being unclear. I completely understand QM's need for integration with Asterisk, so I have no qualms with adding a custom [queuemetrics] context to my dialplan. Having said that, I also recognize that just bypassing FreePBX's built-in dialplan for things like queue login/out can sometimes result in unexpected behavior. For that reason, I am seeking to determine what might be the best combination of FreePBX and QM dialplan bits to get the best of both worlds.
Mudslide, thanks for the input. We have a simple queue system here: one queue with ~35 dynamic agents who log in and out using the FreePBX queue toggle. Basically, they dial *45XXX, where 'XXX' is the queue #. This can be saved as a speed dial on their phone and it logs them in if they are logged off, and it logs them off if they are logged in. Quite handy. Here is the relevant piece of dialplan logic.
[app-queue-toggle]
include => app-queue-toggle-custom
exten => s,1(start),Answer
exten => s,n,Wait(1)
exten => s,n,Macro(user-callerid,)
exten => s,n,Set(QUEUESTAT=LOGGEDOUT)
exten => s,n,AGI(queue_devstate.agi,getqueues,${AMPUSER})
exten => s,n,GotoIf($["${QUEUESTAT}" = "LOGGEDOUT"]?activate)
exten => s,n,GotoIf($["${QUEUESTAT}" = "LOGGEDIN"]?deactivate)
exten => s,n,GotoIf($["${QUEUESTAT}" = "STATIC"]?static:end)
exten => s,n(deactivate),Noop(Agent Logged out)
exten => s,n,Macro(toggle-del-agent,)
exten => s,n,Set(STATE=NOT_INUSE)
exten => s,n,Gosub(sstate,1)
exten => s,n,Playback(agent-loggedoff)
exten => s,n,Macro(hangupcall,)
exten => s,n(activate),Noop(Agent Logged In)
exten => s,n,Macro(toggle-add-agent,)
exten => s,n,Set(STATE=INUSE)
exten => s,n,Gosub(sstate,1)
exten => s,n,Playback(agent-loginok)
exten => s,n,SayDigits(${CALLBACKNUM})
exten => s,n,Macro(hangupcall,)
exten => s,n(static),Noop(User is a Static Agent)
exten => s,n,Set(STATE=INUSE)
exten => s,n,Gosub(sstate,1)
exten => s,n,Playback(agent-loginok)
exten => s,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = "" ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:QUEUE${CUT(DEVICES,&,${ITER})}*${QUEUENO})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()
; end of [app-queue-toggle]
From what I can see, it does nothing to add the login and logout states to the log, which is just as well, considering we're on the realtim log (echoing to a file would accomplish nothing....). I would like to get some input so that I can make a FreePBX feature request to have login and logout actions logged.
As for Chanspy weirdness, I can say that I tried it without realizing it needed a proper context, and I think I inadvertently bridged two customer's calls in the queue, such that they ended up talking to each other! I do know that FreePBX has its own chanspy context set up such that a feature code is dialed and you are connected to chanspy. Maybe QM could be pointed towards that?
[app-chanspy]
include => app-chanspy-custom
exten => 555,1,Macro(user-callerid,)
exten => 555,n,Answer
exten => 555,n,Wait(1)
exten => 555,n,ChanSpy()
exten => 555,n,Hangup
; end of [app-chanspy]
Tom