Hello. So here is my solution. Hope it will help someone.
My queue name is 120. It includes context=break.
Than there is next in dial plan:
[break]
exten => 6,1,Goto(go-ofline-queue-120,s,1)
Next context generates Asterisk call file. Than initiates call by moving it to /var/spool/asterisk/outgoing/:
[go-ofline-queue-120]
exten => s,1,Answer()
exten => s,n,Set(timestamp=${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)})
exten => s,n,NoOp(${timestamp})
exten => s,n, System(/bin/echo “Channel: Local/"${queueposition}"@get-to-the-queue-120-with-defined-position” > /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call) ;Generates channel that will be putted to the queue 120 with rules from get-to-the-queue-120-with-defined-position context.
exten => s,n, System(/bin/echo “MaxRetries: 1” >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo “WaitTime: 30” >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo “CallerID: “Offline queue 120” <”${CALLERID(num)}">" >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo “Context: agent-confirmation-to-accept-offline-caller-from-queue-120” >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo “Extension: 100” >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo “Priority: 1” >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo “Set: number-position=”${CALLERID(num)}"-"${QUEUEPOSITION} >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call) ;Sends variable with callers number and original queue position information (end up not using second)
;Makes loop on channel that will ask agent to press 1 over and over again.
exten => s,n, System(/bin/mv /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call /var/spool/asterisk/outgoing/)
exten => s,n,Hangup
This context is used by call file described above. It puts channel to appropriate queue position by using “EXTEN” variable:
[get-to-the-queue-120-with-defined-position]
exten => _X,1,Answer()
exten => _X,n,Set(CHANNEL(language)=ua)
exten => _X,n,Queue(120,t,${EXTEN})
exten => _X,n,Hangup
exten => _X.,1,Answer()
exten => _X.,n,Set(CHANNEL(language)=ua)
exten => _X.,n,Queue(120,t,${EXTEN})
exten => _X.,n,Hangup
And here is what will be going on on “callers” channel in the queue:
[agent-confirmation-to-accept-offline-caller-from-queue-120]
exten => 100,1,Answer()
exten => 100,n,Set(EXT=0)
exten => 100,n(noinput),Read(EXT,ua/offline-caller-press-1-to-confirm,1)
exten => 100,n,GotoIf($["${EXT}" = “1”]?proceed:noinput)
exten => 100,n(proceed),Playback(ua/will-connect-right-now)
exten => 100,n,Dial(Local/${CUT(number-position,1)}@from-internal)
exten => 100,n,Hangup
Next step will be to add couple more of voice prompts, caller ID number check just in case and few lines to write logs here and there.
I’ll appreciate any suggestion and ideas.
Thanks!