Setup: Two servers, one acting as a queueing server and one acting as an extension server. I have created a queue on the queueing server and the associated dialplan logic to queue incoming calls. Create some agents and assign them to the queue. The script for logging the agents on and off looks as follows: #!/bin/bash asterisk -rx "set verbose 0" agents=`asterisk -rx "show agents" | egrep "(logged in|available)" | awk '{print $1}'` asterisk -rx "set verbose 3" while true do echo "Starting log in cycle" for agent in $agents do ./login $agent $agent done sleep 30 echo "Starting off-break cycle" for agent in $agents do ./offbreak $agent $agent done sleep 60 for agent in $agents do ./onbreak $agent $agent done sleep 60 for agent in $agents do ./offbreak $agent $agent done sleep 120 echo "Hanging up currently bridged calls" calls=`asterisk -rx "show channels verbose" | awk '{print $9}' | grep "IAX2"` for call in $calls do asterisk -rx "soft hangup $call" sleep 0.5 done echo "Starting logoff cycle" for agent in $agents do ./logoff $agent $agent done sleep 30 done The scripts logoff, logon, offbreak and onbreak simply create callfiles which go into the dialplan and execute AgentCallbackLogin, AgentCallbackLogoff, UnpauseQueueMember and PauseQueueMember to change the agent’s state. An example callfile would be: #!/bin/bash tmpfile=`date '+%y%m%d%H%M%S%N'` agent=$1 ext=$2 cat > $tmpfile << EOF Channel: Local/*@vital-out/n Extension: * Context: vital Priority: 1 MaxRetries: 0 Setvar: password=1234 Setvar: action=LOGIN Setvar: agent=$agent Setvar: ext=$ext EOF chmod 777 $tmpfile mv $tmpfile /var/spool/asterisk/outgoing Create a trunk between the two servers. I’ve also set up DuNDi on both servers to allow routing of calls to lots of agents using the following dialplan code in the default context: exten => _X.,1,Answer() exten => _X.,n,Set(DUNDDEST=${DUNDILOOKUP(${EXTEN},internals)}) exten => _X.,n,Dial(${DUNDDEST}) The extension server then answers with the following: exten => _X.,1,Ringing() exten => _X.,n,Wait(5) exten => _X.,n,Answer() exten => _X.,n(loop),Playback(custom/gem) exten => _X.,n,Goto(loop) Now to pump calls into the queue I use the following script: #! /bin/bash CHUNKS=1 # made at a faster rate # was 5 RATE=0.5 # pause this many secs after making "CHUNKS" files let n=0 while true; do let i=0 while [ $i -lt $CHUNKS ]; do cat </var/spool/asterisk/outgoing.temp/$$.$n Channel: local/@from-internal MaxRetries: 0 RetryTime: 60 WaitTime: 30 Context: custom-fakecaller Extension: s Priority: 1 EOD chown asterisk:asterisk /var/spool/asterisk/outgoing.temp/$$.$n mv /var/spool/asterisk/outgoing.temp/$$.$n /var/spool/asterisk/outgoing/ echo Made call $$.$n >&2 let n=n+1 let i=i+1 done sleep $RATE done Where the custom-fakecaller context looks as follows: [custom-fakecaller] exten => s,1,Set(loopcount=0) exten => s,n(loop),GotoIf($[${loopcount}=50]?hangup) exten => s,n,Playback(tt-monkeys) exten => s,n,Wait(2) exten => s,n,Set(loopcount=$[${loopcount}+1]) exten => s,n,Goto(loop) exten => s,n(hangup),Hangup You can then tweak the rate at which calls are put into the queue and just use the following command to keep an eye on the locks: watch –n 1 ‘asterisk –rx “core show locks”’ At 2 or 3 calls per second, Asterisk should lock up in less that 5 mins.