Queue stats - agent state

I have huge problem with agent stats in queue. When I call the queue and an agent will pick up it is all OK, I mean when I will look at “queue show testy” i see “Local/6704@queue-agent/n (dynamic) (In use)”, but when I will transfer the call to another agent using blind transfer the state persists, so I see:

Local/6704@queue-agent/n (dynamic) (In use)
Local/7001@queue-agent/n (dynamic) (Not in use)

But Local/7001 should be In Use, because after transfer 7001 is talking to the client and 6704 is on hook. Finally when 7001 ends the call - 6704 become Not in use

Here is basic configuration:

exten => _*20,1,Answer
same => 2,AddQueueMember(testy,Local/${CALLERID(num)}@queue-agent/n)
same => 3,Playback(agent-loginok)
same => 3,Hangup
exten => _*21,1,Answer
same => 2,RemoveQueueMember(testy,Local/${CALLERID(num)}@queue-agent/n)
same => 3,Playback(agent-loggedoff)
same => 3,Hangup

exten => _X.,1,Set(GROUP()=${EXTEN})
exten => _X.,2,GotoIf($[${GROUP_COUNT()} > 1]?5:3)
exten => _X.,3,GoTo(accounts,${EXTEN},1)
exten => _X.,4,Wait(3)
exten => _X.,5,Congestion

exten => 6704,1,Dial(SIP/6704@proxy,30,t)
exten => 7001,1,Dial(SIP/7001@proxy,30,t)


And yes, I tried to log in agents with: AddQueueMember(testy,Local/${CALLERID(num)}@queue-agent/n,SIP/${CALLERID(num)}@proxy), but then I have always “In use” no matter what is the real state.

Can anybody help me please?

PS. Proxy is SIP trunk to OpenSips

Type of transfer? (blind/attended? SIP/dahdi/features? (Note that some SIP blind transfers are really attended ones.)
You didn’t say the queue member was a local channel; that had to be deduced from the diagnostics.

As the local is marked as no-optimise, it is probable that its ;1 end is still running the queue application, and only the ;2 end has been transferred. I’m not sure if allowing it to optimised will make a difference. That option might break the queue logic or it might be ignored.

Asterisk version: 1.8.3 and

blindxfer => *0
atxfer => #0

I tried blind and attended with same effect. Well agent interface is a Local channel i assumed that anybody will get it after reading conf. files.

I tried with and without /n option so this is not the matter.

I’m not sure whether optimisation is attempted for queue members.

Looks like you are using features. That adds the complication that the DTMF might not be processed at the closest point to the person dialing it. If it is, and the channel doesn’t optimise, the outcome I described will occur.

Where do you have your t options set?


And yes I use features as described.

Another strange thing. When I change interface in AddQueueMember to SIP/${CALLERID(num)} like this:

Please note that proxy is SIP trunk to OpenSIPS.

states of all logged agents is always an only “In use” no matter what is their real state.

Asterisk doesn’t know how many lines are in a particular hunt group at the end of a SIP trunk, so can only use the in-use state of the trunk as a whole. (I haven’t checked that it is using the device state in this context, rather than a local, member name based, state.

So are you saying that it is impossible to monitor state of remote (via SIP trunk) agents, or there is ANY other way to do so? This is kind of strange because I know many companies having Asterisk in cloud/cluster and having valid queue statistics (with agent state). Anyways thanks for your support, it means a lot for me!

You can use always on (AgentLogin) agents. You can also use queue logs.

Asterisk only supports remote presence information using XMPP, not SIP.