How to limit number inbound calls per extension in context asterisk or freepbx


(Tunisie) #1

How to limit number inbound calls per extension in context asterisk or freepbx

exemple did number point to queue , and inside queue they are extension ( 1000 - 2000 - 3000 ) and i want just 1000 can answer 5 call throw the did or the queue per days ?
it’s there and solution or suggestion.


(Tunisie) #2

i do not speak about simultaneous call per extension i want limit per received call or answered call per extension inside queue , please any help


(Communication Technologies) #3

This is not something that exists today.

You could:

  1. Code something to keep track of calls per agent and route accordingly.
  2. Have the agent log out of the queue after 5 calls.

(Tunisie) #4

any way to 1. Have the agent log out of the queue after 5 calls. ?
any code exemple or contex that i can try ?


#5

I would start with an mysql query where the queue is 5556 and the agent is at 1020 much like

SELECT   dstchannel  FROM cdr WHERE `lastapp`='Queue' AND  `dst`=5556 AND `dstchannel` LIKE '%1020%' AND `calldate` >= CURRENT_DATE()  HAVING COUNT(*) > 5;

You could then remove or pause the agent.


(Tunisie) #6

Maybe but i don’t think the query need count the number of anwsered call per agent


#7

then leave out the HAVING clause


(Tunisie) #8

Did you have any ready exemple


#9

Not really, write your query and having found the culprit I would

rasterisk -x 'queue pause member  LOCAL/1020@from-queue'

unpause when you want.


(Tunisie) #10

Great but this will be manual work :blush:


#11

Not if you script it and make a cronjob


(Tunisie) #12

Emm great idea too with crontab and script not bad , but how can count call in real time for each agent


(Tunisie) #13

So after i can pause and unpause


#14

By using AMI but that’s not trivial as it wont tell you directly how many calls taken today


#15

a template for a cronjob

rasterisk -x "queue pause member $(mysql asteriskcdrdb -bsNe '<YOUR QUERY THAT RETURNS ONE  DSTCHANNEL like Local/1020@from-queue-000004a4;1>'|grep -v "$^"|sed 's/;1.*//'|cut -d '/' -f2|cut -d '-' -f1,2)"

(Tunisie) #16

Thank you , you have put me on road
I will try to do same thing with that