Dynamic numbero of waiting calls in queue

Hi all,
We have a Asterisk 1.8 in our office
i’m searching a way to check the number of connected sip phone in a queue (Variable) and set max call in queue on registered phones +1

Example

3 phone Max calls 3 +1
4 phone Max calls 4 +1

This could be possible?

Thanks a lot
Fabio

1.8 is well past its use by date.

You can use functions to read the length of the queue.

Hi David,
Thanks for your answer!

I know that is out of date but no one after me check this PBX in the last 6 years…

Which functions can i use it? Or where can i found it?

I’m watching all parameters of queue.conf but i don’t find nothing that can help me to do this.

Sorry but i’m a newbie of Asterisk

Thanks
Fabio

core show functions or https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Dialplan+Functions

Look for ones with QUEUE in their name.

I suppose you could do this with GROUP() and GROUP_COUNT() and the QUEUE_MEMBER function.

Use QUEUE_MEMBER to retrieve how many agents are available in the queue, Use GROUP_COUNT to limit the number of callers before they get to the queue.

Where can i put on this check with Group and Group_Count? On Dialplan.conf?
How can i set this check only on one specific queue?

If there is some Guide or knowledge base to see i’ll try to do this alone

Thanks
Fabio

There’s the Wiki at https://wiki.asterisk.org

You’d apply a group to all the calls that are going into your queue with the GROUP function.

Then you’d retrieve the number of agents with QUEUE_MEMBER and use GROUP_COUNT to see if the number of calls is greater than your number of agents and then do whatever logic you need.

1 Like

There is a function that gives the number of calls.

1 Like

Hi All,
I know that something is wrong with that but i don’t know what…


I'm setting this on queue 1241
;set group name
exten => 1241,n,set(GROUP()=ForwardTest)
;Gotoif queue member
exten => 1241,n,GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "2"]?Test1:Test2)
;if true set max calls in queue to 3
exten => 1241,n(Test1),set("*PARAMETER*"="3")
;if false set max calls in queue to 5
exten => 1241,n(Test2),set("*PARAMETER*"="5")

1st error is that it process Test2 even if it match and return true and i don’t know why
2nd error: Can I set Max Call in queue with command like this? Group Count?

Many Thanks for your support i hope my question is properly asked and sorry if is a newbie thing

Fabio

Although it looks right, the quotation marks aren’t needed.

You can’t set the maximum number of calls in the queue, you can only set a variable that you can compare against it.

Hi David thanks for your answer.

I’m trying to set a Gotoif that check the numbers of members and forward the call on one specific queue.

At example I have write like this but didn’t works.

40x are queues

;Trasferimento in base al numero di operatori connessi
exten => 1241,n,set(GROUP()=TestFWD)
exten => 1241,n,GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "1"]?dial1:test2)
exten => 1241,n(dial1),Goto(VoncQueues,401,1)
;1 operator
exten => 1241,n(test2),GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "2"]?dial2:test3)
exten => 1241,n(dial2),Goto(VoncQueues,402,1)
;2 operators
exten => 1241,n(test3),GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "3"]?dial3:test4)
exten => 1241,n(dial3),Goto(VoncQueues,403,1)
;3 operators
exten => 1241,n(test4),GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "4"]?dial4:test5)
exten => 1241,n(dial4),Goto(VoncQueues,404,1)
;4 operators
exten => 1241,n(test5),GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "5"]?dial5)
exten => 1241,n(dial5),Goto(VoncQueues,405,1)
;5 operators

My problem now is that if i forward it on queue 201 it close istantly the call

If i check the CLI i see that it enters correctly in the right queue ( in this case 402) but QueueLog says that is OUTOFORDER

 -- Executing [1241@VoncGroup_1241:32] Set("SIP/8169-000000b3", "GROUP()=TestFWD") in new stack
    -- Executing [1241@VoncGroup_1241:33] GotoIf("SIP/8169-000000b3", "0?dial1:test2") in new stack
    -- Goto (VoncGroup_1241,1241,35)
    -- Executing [1241@VoncGroup_1241:35] Goto("SIP/8169-000000b3", "VoncQueues,402,1") in new stack
    -- Goto (VoncQueues,402,1)
    -- Executing [402@VoncQueues:1] UserEvent("SIP/8169-000000b3", "QENTER,EventData: <vonc><to>all</to><from>VoncGroup_1241</from><QKey>  </QKey><CKey></CKey><Chan>SIP/8169-000000b3</Chan><Num>8169</Num><UID>1504021460.179</UID></vonc>") in new stack
    -- Executing [402@VoncQueues:2] SIPAddHeader("SIP/8169-000000b3", "PbxChannel:SIP/8169-000000b3") in new stack
    -- Executing [402@VoncQueues:3] SIPAddHeader("SIP/8169-000000b3", "QueueKeywords:") in new stack
    -- Executing [402@VoncQueues:4] SIPAddHeader("SIP/8169-000000b3", "Keywords: ") in new stack
    -- Executing [402@VoncQueues:5] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_0") in new stack
    -- Goto (VoncQueues,402,7)
    -- Executing [402@VoncQueues:7] Set("SIP/8169-000000b3", "CDR(QueueCallId)=1504021460.179") in new stack
    -- Executing [402@VoncQueues:8] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_1") in new stack
    -- Goto (VoncQueues,402,10)
    -- Executing [402@VoncQueues:10] NoOp("SIP/8169-000000b3", "Inizio Valutazione Parametri") in new stack
    -- Executing [402@VoncQueues:11] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_2") in new stack
    -- Goto (VoncQueues,402,17)
    -- Executing [402@VoncQueues:17] NoOp("SIP/8169-000000b3", "Fine Valutazione Parametri") in new stack
    -- Executing [402@VoncQueues:18] NoOp("SIP/8169-000000b3", "Gestione Header Sip") in new stack
    -- Executing [402@VoncQueues:19] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_5") in new stack
    -- Goto (VoncQueues,402,21)
    -- Executing [402@VoncQueues:21] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_6") in new stack
    -- Goto (VoncQueues,402,23)
    -- Executing [402@VoncQueues:23] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_7") in new stack
    -- Goto (VoncQueues,402,25)
    -- Executing [402@VoncQueues:25] GotoIf("SIP/8169-000000b3", "1?:lbl_VoncQueues_8") in new stack
    -- Executing [402@VoncQueues:26] SIPAddHeader("SIP/8169-000000b3", "ParentUnique:1504021460.179") in new stack
    -- Executing [402@VoncQueues:27] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_9") in new stack
    -- Goto (VoncQueues,402,29)
    -- Executing [402@VoncQueues:29] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_10") in new stack
    -- Goto (VoncQueues,402,31)
    -- Executing [402@VoncQueues:31] NoOp("SIP/8169-000000b3", "Fine Gestione Header Sip") in new stack
    -- Executing [402@VoncQueues:32] Set("SIP/8169-000000b3", "CDR(Queue)=VoncGroup_1241") in new stack
    -- Executing [402@VoncQueues:33] NoOp("SIP/8169-000000b3", "VoncQueue Start") in new stack
    -- Executing [402@VoncQueues:34] Log("SIP/8169-000000b3", "NOTICE,Entrata in coda VoncGroup_1241 7a5c4887-ae54-4426-8485-12a6c5a86199   ") in new stack
[Aug 29 17:44:20] NOTICE[4774]: Ext. 402:34 @ VoncQueues: Entrata in coda VoncGroup_1241 7a5c4887-ae54-4426-8485-12a6c5a86199
    -- Executing [402@VoncQueues:35] QueueLog("SIP/8169-000000b3", "VoncGroup_1241,1504021460.179,1,PREENTERQUEUE,7a5c4887-ae54-4426-8485-12a6c5a86199|8169| |SIP/8169-000000b3|") in new stack
    -- Executing [402@VoncQueues:36] GotoIf("SIP/8169-000000b3", "1?:lbl_VoncQueues_11") in new stack
    -- Executing [402@VoncQueues:37] Set("SIP/8169-000000b3", "CHANNEL(musicclass)=fbfe7296-c699-43a5-8d5c-ed4d23935b6a") in new stack
    -- Executing [402@VoncQueues:38] Set("SIP/8169-000000b3", "SlotCounter=0") in new stack
    -- Executing [402@VoncQueues:39] Set("SIP/8169-000000b3", "CurrentTimeSlot=") in new stack
    -- Executing [402@VoncQueues:40] GotoIf("SIP/8169-000000b3", "1?:lbl_VoncQueues_14") in new stack
    -- Executing [402@VoncQueues:41] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_15") in new stack
    -- Goto (VoncQueues,402,47)
    -- Executing [402@VoncQueues:47] QueueLog("SIP/8169-000000b3", "VoncGroup_1241,1504021460.179,1,OUTOFORDER,0|") in new stack
    -- Executing [402@VoncQueues:48] Set("SIP/8169-000000b3", "ExitAction=0") in new stack
    -- Executing [402@VoncQueues:49] Set("SIP/8169-000000b3", "ExitActionParameter=") in new stack
    -- Executing [402@VoncQueues:50] Set("SIP/8169-000000b3", "ExitActionMessage=") in new stack
    -- Executing [402@VoncQueues:51] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_19") in new stack
    -- Goto (VoncQueues,402,55)
    -- Executing [402@VoncQueues:55] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_20") in new stack
    -- Goto (VoncQueues,402,60)
    -- Executing [402@VoncQueues:60] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_22") in new stack
    -- Goto (VoncQueues,402,63)
    -- Executing [402@VoncQueues:63] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_23") in new stack
    -- Goto (VoncQueues,402,67)
    -- Executing [402@VoncQueues:67] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_24") in new stack
    -- Goto (VoncQueues,402,71)
    -- Executing [402@VoncQueues:71] GotoIf("SIP/8169-000000b3", "0?:lbl_VoncQueues_21") in new stack
    -- Goto (VoncQueues,402,61)
    -- Executing [402@VoncQueues:61] QueueLog("SIP/8169-000000b3", "VoncGroup_1241,1504021460.179,0,HANGUP,1241") in new stack
    -- Executing [402@VoncQueues:62] Hangup("SIP/8169-000000b3", "") in new stack
  == Spawn extension (VoncQueues, 402, 62) exited non-zero on 'SIP/8169-000000b3'
    -- Executing [h@VoncQueues:1] QueueLog("SIP/8169-000000b3", "VoncGroup_1241,1504021460.179,0,HANGUPUSER,SIP/8169-000000b3|1504021460.179|8169") in new stack
    -- Executing [h@VoncQueues:2] Set("SIP/8169-000000b3", "CDR(QueueResp)=") in new stack
    -- Executing [h@VoncQueues:3] Hangup("SIP/8169-000000b3", "") in new stack

If i try to call directly the queue i don’t have any problem, maybe i’m trying to use the wrong function?

How can I forward a call on a specific queue?

Many thanks
Fabio

Ok it works i post the code maybe that could help


;Start Forward
exten => 1241,n(test2),GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "2"]?:test3)
exten => 1241,n,Goto(VoncGroup_402,402,1)
exten => 1241,n(test3),GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "3"]?:test4)
exten => 1241,n,Goto(VoncGroup_403,403,1)
exten => 1241,n(test4),GotoIf($["${QUEUE_MEMBER(VoncGroup_1241,logged)}" = "4"]?:test5)
exten => 1241,n,Goto(VoncGroup_404,404,1)
exten => 1241,n(test5),Goto(VoncGroup_405,405,1)
;Stop Forward

Many thanks David and johnkiniston

1 Like