Add agent to multiple queues

Discussion in 'General' started by Ashraf.jabali, Sep 14, 2010.

  1. Ashraf.jabali

    Joined:
    Nov 15, 2009
    Messages:
    22
    Likes Received:
    0
    Hi there,

    I have the flowing queues:

    1000
    2000
    5000
    6000

    with out assign any static agent to those queues, so in my case if the agent need to login to the queue he need to press

    1000*
    2000*
    5000*
    6000*

    and if he want to make logout he has to press

    1000**
    2000**
    5000**
    6000**

    but as you see it look to long for them to login and logout from 4 queue

    So i need any one to help me if i can make the agent login in to more than queue as a dynamic agent with one code or one dial plan and the same with the logout

    Thank you
     
  2. rphenix

    Joined:
    Feb 25, 2009
    Messages:
    25
    Likes Received:
    0
    This is what I came up with (perhaps not elegant but it works) inside extensions_custom.conf.
    Code:
    exten => 9998,1(9998),Answer
    exten => 9998,n,Set(QEXT1=${CALLERID(number)})
    exten => 9998,n,Set(QCOUNT=0)
    exten => 9998,n,MYSQL(Connect connid localhost asteriskuser yourDBPassword asterisk)
    exten => 9998,n,MYSQL(Query resultid ${connid} SELECT DISTINCT id FROM queues_details)
    exten => 9998,n(query),MYSQL(Fetch foundRow ${resultid} id)
    exten => 9998,n,GotoIf($["${foundRow}" = "0"]?finish)
    exten => 9998,n,GotoIf($[${DB_EXISTS(QPENALTY/${id}/agents/${QEXT1})} != 1]?query)
    ;exten => 9998,n,AddQueueMember(${id},Local/${QEXT1}@from-internal/n)
    exten => 9998,n,AddQueueMember(${id},Local/${QEXT1}@from-internal/n,${DB(QPENALTY/${id}/agents/${QEXT1})})
    exten => 9998,n,Set(DEVICE_STATE(Custom:${QEXT1})=INUSE)
    exten => 9998,n,Set(QCOUNT=$[${QCOUNT} + 1])
    exten => 9998,n,Goto(query)
    
    exten => 9998,n,UserEvent(RefreshQueue)
    exten => 9998,n(clearsql),MYSQL(Clear ${resultid})
    exten => 9998,n,MYSQL(Disconnect ${connid})
    exten => 9998,n,Hangup
    
    
    exten => 9998,n(finish),GotoIf($[${QCOUNT} = 0]?invalid)
    exten => 9998,n,Playback(agent-loginok&with&extension)
    exten => 9998,n,SayDigits(${QEXT1})
    exten => 9998,n,MYSQL(Clear ${resultid})
    exten => 9998,n,MYSQL(Disconnect ${connid})
    exten => 9998,n,Hangup
    
    exten => 9998,n(invalid),Playback(pbx-invalid)
    exten => 9998,n,MYSQL(Clear ${resultid})
    exten => 9998,n,MYSQL(Disconnect ${connid})
    exten => 9998,n,Hangup
    1) Make sure for each queue that you restrict the dynamic users and then specify the extensions and their priorities or the above wont work.
    2) Make sure you confirm the asterisk db user and password before you copy/paste into that file it needs to match your setup.

    Now your users can just dial 9998 and it will log them into any queue they need to be in, likewise if they redial it, it will log them out of any queue they were in.
     
  3. pguima

    Joined:
    Jul 20, 2011
    Messages:
    70
    Likes Received:
    0
    this code keeps my box going into a loop back to line 6. i am running elastix 2.0.3.
    I would love to be able to have my agents login to multiple queues by dialing one code.

    Any ideas?

    Thanks

    pguima
     
  4. rphenix

    Joined:
    Feb 25, 2009
    Messages:
    25
    Likes Received:
    0
    Are you sure the sql credentials are correct?

    Can you login to the local mysql console with the same credentials?

    Also check your not out of sql connections (show processlist).

    What version of Elastix are you trying and is it 32 or 64bit? I'll try the same version as your using on a VM and see how I go.
     
  5. pguima

    Joined:
    Jul 20, 2011
    Messages:
    70
    Likes Received:
    0
    I am able to login to sql using the credentials without a problem. This is a 32 bit system. I don't have access to the box right now but tomorrow I will check the sql connections.

    Thank you,

    pguima
     
  6. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    I know this is an old thread, but I am trying to do this same exact thing. Using this I just get dead air when I call and the agent does not get logged into any queues or logged out.

    I also found a similar way of doing this here http://www.freepbx.org/forum/multiple-queues-agent-login-logout

    Using this I get the message that the user has either logged in or out, but it does not reflect in queue show.

    I have checked and my mysql credentials work fine. I am running elastix 2.3 x86.

    Any help would be appreciated.
     
  7. rphenix

    Joined:
    Feb 25, 2009
    Messages:
    25
    Likes Received:
    0
    Can you set your verbosity to say 99 then do a login/logout and show me a snippet of your full log?
     
  8. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    what is the CLI command for that?

    EDIT: Nevermind I found it.

    Well your script works for logging in now. Not sure why it decided to start working, but it is.

    Could you tell me how to make one that will log users off?
     
  9. rphenix

    Joined:
    Feb 25, 2009
    Messages:
    25
    Likes Received:
    0
    if you dial the same number again from the same extension it will log them straight back out.
     
  10. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    Then that is not working.

    Here is my log.

    Code:
    Verbosity is at least 99
      == Using SIP RTP TOS bits 184
      == Using SIP RTP CoS mark 5
        -- Executing [54*@from-internal:1] Answer("SIP/7329-00000002", "") in new stack
        -- Executing [54*@from-internal:2] Set("SIP/7329-00000002", "QEXT1=7329") in new stack
        -- Executing [54*@from-internal:3] Set("SIP/7329-00000002", "QCOUNT=0") in new stack
        -- Executing [54*@from-internal:4] MYSQL("SIP/7329-00000002", "Connect connid localhost asteriskuser **** asterisk") in new stack
        -- Executing [54*@from-internal:5] MYSQL("SIP/7329-00000002", "Query resultid 1 SELECT DISTINCT id FROM queues_details") in new stack
        -- Executing [54*@from-internal:6] MYSQL("SIP/7329-00000002", "Fetch foundRow 2 id") in new stack
        -- Executing [54*@from-internal:7] GotoIf("SIP/7329-00000002", "0?finish") in new stack
        -- Executing [54*@from-internal:8] GotoIf("SIP/7329-00000002", "0?query") in new stack
        -- Executing [54*@from-internal:9] AddQueueMember("SIP/7329-00000002", "5501,Local/7329@from-internal/n,1") in new stack
        -- Executing [54*@from-internal:10] Set("SIP/7329-00000002", "DEVICE_STATE(Custom:7329)=INUSE") in new stack
        -- Executing [54*@from-internal:11] Set("SIP/7329-00000002", "QCOUNT=1") in new stack
        -- Executing [54*@from-internal:12] Goto("SIP/7329-00000002", "query") in new stack
        -- Goto (from-internal,54*,6)
        -- Executing [54*@from-internal:6] MYSQL("SIP/7329-00000002", "Fetch foundRow 2 id") in new stack
        -- Executing [54*@from-internal:7] GotoIf("SIP/7329-00000002", "0?finish") in new stack
        -- Executing [54*@from-internal:8] GotoIf("SIP/7329-00000002", "0?query") in new stack
        -- Executing [54*@from-internal:9] AddQueueMember("SIP/7329-00000002", "5502,Local/7329@from-internal/n,0") in new stack
        -- Executing [54*@from-internal:10] Set("SIP/7329-00000002", "DEVICE_STATE(Custom:7329)=INUSE") in new stack
       -- Executing [54*@from-internal:11] Set("SIP/7329-00000002", "QCOUNT=2") in new stack
        -- Executing [54*@from-internal:12] Goto("SIP/7329-00000002", "query") in new stack
        -- Goto (from-internal,54*,6)
        -- Executing [54*@from-internal:6] MYSQL("SIP/7329-00000002", "Fetch foundRow 2 id") in new stack
        -- Executing [54*@from-internal:7] GotoIf("SIP/7329-00000002", "0?finish") in new stack
        -- Executing [54*@from-internal:8] GotoIf("SIP/7329-00000002", "1?query") in new stack
        -- Goto (from-internal,54*,6)
        -- Executing [54*@from-internal:6] MYSQL("SIP/7329-00000002", "Fetch foundRow 2 id") in new stack
        -- Executing [54*@from-internal:7] GotoIf("SIP/7329-00000002", "1?finish") in new stack
        -- Goto (from-internal,54*,17)
        -- Executing [54*@from-internal:17] GotoIf("SIP/7329-00000002", "0?invalid") in new stack
        -- Executing [54*@from-internal:18] Playback("SIP/7329-00000002", "agent-loginok") in new stack
        -- <SIP/7329-00000002> Playing 'agent-loginok.gsm' (language 'en')
        -- Executing [54*@from-internal:19] MYSQL("SIP/7329-00000002", "Clear 2") in new stack
        -- Executing [54*@from-internal:20] MYSQL("SIP/7329-00000002", "Disconnect 1") in new stack
        -- Executing [54*@from-internal:21] Hangup("SIP/7329-00000002", "") in new stack
      == Spawn extension (from-internal, 54*, 21) exited non-zero on 'SIP/7329-00000002'
        -- Executing [h@from-internal:1] Macro("SIP/7329-00000002", "hangupcall") in new stack
        -- Executing [s@macro-hangupcall:1] GotoIf("SIP/7329-00000002", "1?endmixmoncheck") in new stack
        -- Goto (macro-hangupcall,s,9)
        -- Executing [s@macro-hangupcall:9] NoOp("SIP/7329-00000002", "End of MIXMON check") in new stack
        -- Executing [s@macro-hangupcall:10] GotoIf("SIP/7329-00000002", "1?nomeetmemon") in new stack
        -- Goto (macro-hangupcall,s,28)
        -- Executing [s@macro-hangupcall:28] NoOp("SIP/7329-00000002", "End of MEETME check") in new stack
        -- Executing [s@macro-hangupcall:29] GotoIf("SIP/7329-00000002", "1?noautomon") in new stack
        -- Goto (macro-hangupcall,s,31)
        -- Executing [s@macro-hangupcall:31] NoOp("SIP/7329-00000002", "TOUCH_MONITOR_OUTPUT=") in new stack
        -- Executing [s@macro-hangupcall:32] GotoIf("SIP/7329-00000002", "1?noautomon2") in new stack
        -- Goto (macro-hangupcall,s,38)
        -- Executing [s@macro-hangupcall:38] NoOp("SIP/7329-00000002", "MONITOR_FILENAME=") in new stack
        -- Executing [s@macro-hangupcall:39] GotoIf("SIP/7329-00000002", "1?skiprg") in new stack
        -- Goto (macro-hangupcall,s,42)
        -- Executing [s@macro-hangupcall:42] GotoIf("SIP/7329-00000002", "1?skipblkvm") in new stack
        -- Goto (macro-hangupcall,s,45)
        -- Executing [s@macro-hangupcall:45] GotoIf("SIP/7329-00000002", "1?theend") in new stack
        -- Goto (macro-hangupcall,s,47)
        -- Executing [s@macro-hangupcall:47] Hangup("SIP/7329-00000002", "") in new stack
      == Spawn extension (macro-hangupcall, s, 47) exited non-zero on 'SIP/7329-00000002' in macro 'hangupcall'
      == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/7329-00000002'
    
     
  11. rphenix

    Joined:
    Feb 25, 2009
    Messages:
    25
    Likes Received:
    0
    Actually I've just looked at what I submitted originally, my example above is just for logging in I would have cut the other parts of my script out for simplicity.

    If your at ease modifying it basically just have a new dial extension say *55 and clone pretty much the login script above but use queueremovemember.

    Then you can assign a login and logout button on your agents phones.

    If you would rather have a login/logout "toggle" button I can give an example of what I currently use.

    Robert
     
  12. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    I actually have tried using removequeuemember but this did not work.

    This is what I put for the logout that I tried.

    Code:
    exten => 56*,1(56*),Answer
    exten => 56*,n,Set(QEXT1=${CALLERID(number)})
    exten => 56*,n,Set(QCOUNT=0)
    exten => 56*,n,MYSQL(Connect connid localhost asteriskuser **** asterisk)
    exten => 56*,n,MYSQL(Query resultid ${connid} SELECT DISTINCT id FROM queues_details)
    exten => 56*,n(query),MYSQL(Fetch foundRow ${resultid} id)
    exten => 56*,n,GotoIf($["${foundRow}" = "0"]?finish)
    exten => 56*,n,GotoIf($[${DB_EXISTS(QPENALTY/${id}/agents/${QEXT1})} != 1]?query)
    exten => 56*,n,RemoveQueueMember(${id}|Local/${QEXT1}@from-internal/n)
    exten => 56*,n,Set(DEVICE_STATE(Custom:${QEXT1})=INUSE)
    exten => 56*,n,Set(QCOUNT=$[${QCOUNT} + 1])
    exten => 56*,n,Goto(query)
    
    exten => 56*,n,UserEvent(RefreshQueue)
    exten => 56*,n(clearsql),MYSQL(Clear ${resultid})
    exten => 56*,n,MYSQL(Disconnect ${connid})
    exten => 56*,n,Hangup
    
    
    exten => 56*,n(finish),GotoIf($[${QCOUNT} = 0]?invalid)
    exten => 56*,n,Playback(agent-loggedoff)
    exten => 56*,n,MYSQL(Clear ${resultid})
    exten => 56*,n,MYSQL(Disconnect ${connid})
    exten => 56*,n,Hangup
    
    exten => 56*,n(invalid),Playback(pbx-invalid)
    exten => 56*,n,MYSQL(Clear ${resultid})
    exten => 56*,n,MYSQL(Disconnect ${connid})
    exten => 56*,n,Hangup
    

    Here is what the log shows when I log off using the new macro.

    Code:
    Verbosity is at least 99
      == Using SIP RTP TOS bits 184
      == Using SIP RTP CoS mark 5
        -- Executing [56*@from-internal:1] Answer("SIP/7329-00000006", "") in new stack
        -- Executing [56*@from-internal:2] Set("SIP/7329-00000006", "QEXT1=7329") in new stack
        -- Executing [56*@from-internal:3] Set("SIP/7329-00000006", "QCOUNT=0") in new stack
        -- Executing [56*@from-internal:4] MYSQL("SIP/7329-00000006", "Connect connid localhost asteriskuser TM15olutions asterisk") in new stack
        -- Executing [56*@from-internal:5] MYSQL("SIP/7329-00000006", "Query resultid 1 SELECT DISTINCT id FROM queues_details") in new stack
        -- Executing [56*@from-internal:6] MYSQL("SIP/7329-00000006", "Fetch foundRow 2 id") in new stack
        -- Executing [56*@from-internal:7] GotoIf("SIP/7329-00000006", "0?finish") in new stack
        -- Executing [56*@from-internal:8] GotoIf("SIP/7329-00000006", "0?query") in new stack
        -- Executing [56*@from-internal:9] RemoveQueueMember("SIP/7329-00000006", "5501|Local/7329@from-internal/n") in new stack
        -- Executing [56*@from-internal:10] Set("SIP/7329-00000006", "DEVICE_STATE(Custom:7329)=INUSE") in new stack
        -- Executing [56*@from-internal:11] Set("SIP/7329-00000006", "QCOUNT=1") in new stack
        -- Executing [56*@from-internal:12] Goto("SIP/7329-00000006", "query") in new stack
        -- Goto (from-internal,56*,6)
        -- Executing [56*@from-internal:6] MYSQL("SIP/7329-00000006", "Fetch foundRow 2 id") in new stack
        -- Executing [56*@from-internal:7] GotoIf("SIP/7329-00000006", "0?finish") in new stack
        -- Executing [56*@from-internal:8] GotoIf("SIP/7329-00000006", "0?query") in new stack
        -- Executing [56*@from-internal:9] RemoveQueueMember("SIP/7329-00000006", "5502|Local/7329@from-internal/n") in new stack
        -- Executing [56*@from-internal:10] Set("SIP/7329-00000006", "DEVICE_STATE(Custom:7329)=INUSE") in new stack
        -- Executing [56*@from-internal:11] Set("SIP/7329-00000006", "QCOUNT=2") in new stack
        -- Executing [56*@from-internal:12] Goto("SIP/7329-00000006", "query") in new stack
        -- Goto (from-internal,56*,6)
        -- Executing [56*@from-internal:6] MYSQL("SIP/7329-00000006", "Fetch foundRow 2 id") in new stack
        -- Executing [56*@from-internal:7] GotoIf("SIP/7329-00000006", "0?finish") in new stack
        -- Executing [56*@from-internal:8] GotoIf("SIP/7329-00000006", "1?query") in new stack
        -- Goto (from-internal,56*,6)
        -- Executing [56*@from-internal:6] MYSQL("SIP/7329-00000006", "Fetch foundRow 2 id") in new stack
        -- Executing [56*@from-internal:7] GotoIf("SIP/7329-00000006", "1?finish") in new stack
        -- Goto (from-internal,56*,17)
        -- Executing [56*@from-internal:17] GotoIf("SIP/7329-00000006", "0?invalid") in new stack
        -- Executing [56*@from-internal:18] Playback("SIP/7329-00000006", "agent-loggedoff") in new stack
        -- <SIP/7329-00000006> Playing 'agent-loggedoff.gsm' (language 'en')
        -- Executing [56*@from-internal:19] MYSQL("SIP/7329-00000006", "Clear 2") in new stack
        -- Executing [56*@from-internal:20] MYSQL("SIP/7329-00000006", "Disconnect 1") in new stack
        -- Executing [56*@from-internal:21] Hangup("SIP/7329-00000006", "") in new stack
      == Spawn extension (from-internal, 56*, 21) exited non-zero on 'SIP/7329-00000006'
        -- Executing [h@from-internal:1] Macro("SIP/7329-00000006", "hangupcall") in new stack
        -- Executing [s@macro-hangupcall:1] GotoIf("SIP/7329-00000006", "1?endmixmoncheck") in new stack
        -- Goto (macro-hangupcall,s,9)
        -- Executing [s@macro-hangupcall:9] NoOp("SIP/7329-00000006", "End of MIXMON check") in new stack
        -- Executing [s@macro-hangupcall:10] GotoIf("SIP/7329-00000006", "1?nomeetmemon") in new stack
        -- Goto (macro-hangupcall,s,28)
        -- Executing [s@macro-hangupcall:28] NoOp("SIP/7329-00000006", "End of MEETME check") in new stack
        -- Executing [s@macro-hangupcall:29] GotoIf("SIP/7329-00000006", "1?noautomon") in new stack
        -- Goto (macro-hangupcall,s,31)
        -- Executing [s@macro-hangupcall:31] NoOp("SIP/7329-00000006", "TOUCH_MONITOR_OUTPUT=") in new stack
        -- Executing [s@macro-hangupcall:32] GotoIf("SIP/7329-00000006", "1?noautomon2") in new stack
        -- Goto (macro-hangupcall,s,38)
        -- Executing [s@macro-hangupcall:38] NoOp("SIP/7329-00000006", "MONITOR_FILENAME=") in new stack
        -- Executing [s@macro-hangupcall:39] GotoIf("SIP/7329-00000006", "1?skiprg") in new stack
        -- Goto (macro-hangupcall,s,42)
        -- Executing [s@macro-hangupcall:42] GotoIf("SIP/7329-00000006", "1?skipblkvm") in new stack
        -- Goto (macro-hangupcall,s,45)
        -- Executing [s@macro-hangupcall:45] GotoIf("SIP/7329-00000006", "1?theend") in new stack
        -- Goto (macro-hangupcall,s,47)
        -- Executing [s@macro-hangupcall:47] Hangup("SIP/7329-00000006", "") in new stack
      == Spawn extension (macro-hangupcall, s, 47) exited non-zero on 'SIP/7329-00000006' in macro 'hangupcall'
      == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/7329-00000006'
    
    Thanks again for your help. I am heading home now and will return to work on Friday, so I will be able to see your reply, but will not be able to make changes until them.
     
  13. pguima

    Joined:
    Jul 20, 2011
    Messages:
    70
    Likes Received:
    0
    I've attached my code to this thread I can't post because I keep getting flagged. This code works perfectly on my system. The time it will actually take to complete depends on the numbers of queues you are logging into. http://forum.elastix.org/old_files/extension_custom.txt
     
  14. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    Thanks for your method. Although I think the loop method will be best for my setup. The loop method should allow me to add new queues in the future without having to change the macro.

    -Sent using EVO 3D w/ ICS
     
  15. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    @rphenix

    Can you post your toggle macro so I can see how it works?
     
  16. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    rphenix

    Do you mind posting your toggle macro?
     
  17. EliteTech

    Joined:
    May 18, 2012
    Messages:
    53
    Likes Received:
    0
    I found my problem.
    I had a pipe instead of a comma
    Code:
    exten => 56*,n,RemoveQueueMember(${id}|Local/${QEXT1}@from-queue/n)
    exten => 56*,n,RemoveQueueMember(${id},Local/${QEXT1}@from-internal/n)
    This i what I needed
    Code:
    exten => 56*,n,RemoveQueueMember(${id},Local/${QEXT1}@from-queue/n)
    exten => 56*,n,RemoveQueueMember(${id},Local/${QEXT1}@from-internal/n)
     
  18. rphenix

    Joined:
    Feb 25, 2009
    Messages:
    25
    Likes Received:
    0
    Good to see you fixed it EliteTech. I've created a new thread #104014 showing the queue toggle system I use. As I think there is a few examples here that will confuse people searching the forums.
     

Share This Page