Script to restrict calls in the queue

Applicable Device:

Device Model: P-Series, S-Series

Firmware Version: Not required

 

Description:

Restrict active calls in the queue

Example:

There are 4 agents in the queue, only 1 agent to answer the inbound call at a time other agents can make outbound calls.

The new inbound calls will be routed to the failover destination when the agent is in a call

 

Code:

[queue_6400]
exten = 6400,1,Set(__QUEUENUMBER=6400)
exten = 6400,2,Set(__ODETIME=30)
exten = 6400,n,Set(CDR(qenum)=6400)
exten = 6400,n,Set(CDR(dstname)=6400)
exten = 6400,n,Set(DSCIDCALLFEATURE=6400)
exten = 6400,n,DistinctiveCid()
exten = 6400,n,Set(CDR(ringtype)=ringall)
exten = 6400,n,Set(ENABLETHANK=enable-thank-you-prompt)
exten = 6400,n,Set(result=${SHELL(asterisk -rx 'queue show queue-6400' | grep "In use" | wc -l)})
exten = 6400,n,Set(maxcall=${result:0:-1})
exten = 6400,n,Noop(${maxcall})
exten = 6400,n,GotoIf($[${maxcall}>=2]?failoveraction,1)
exten = 6400,n,Queue(queue-6400,tTkKxX,,,1800)
exten = 6400,n,GotoIf($["${QUEUESTATUS}"="CONTINUE"]?satisfaction,1:failoveraction,1)
exten = failoveraction,1,Set(CDR(transfertype)=failover)
exten = failoveraction,2,ExecIf($[x${QUEUE_TO_NORINGAGENT}=xyes]?Set(CDR(queue_to_noringagent)=yes))
exten = failoveraction,3,ExecIf($[x${QUEUE_TO_NORINGAGENT}=xyes]?ForkCDR(erv))
exten = failoveraction,4,Set(CDR(callflow)=ivr)
exten = failoveraction,5,Goto(ivrs,6200,1)
exten = fax,1,Goto(inrouter_${INROUTERNAME}_fax_detect,fax,1)
;exten = _.,1,Goto(from-outside,${EXTEN},1)
exten = h,1,Hangup()

 

The variable ${maxcall} is the number of established calls in the queue, you can change it according to your needs.

 

 

Have more questions? Submit a request

1 Comments

  • 0
    Avatar

    Hello,
    I would like to know if this script works in order to leave an operator always free in the queue, the operators are not always the same number.
    example: today there are 4 active operators in queue 1 must always be free. if tomorrow there are 3 operators, 1 must always be free and so on.

Please sign in to leave a comment.