Automated Callback is a feature that allows callers waiting in a queue to press a digit and have the PBX call them back once they are next in line.
Add Custom Dialplan
- create file /var/log/cpbx/callback.log (must be saved containing at least 2 lines for asterisk to read it properly)
- create file /etc/asterisk/ombutel/extensions__65-custom.conf with the following content:
[create_callback]
exten => s,1,NoOp(Create callback file)
same => n,Set(DB(${DB(pbx/instance)}/callback/${QUEUE_NUMBER}/${MASTER_CHANNEL(UNIQUEID)})=${CALLERID(num,${CURRENT_EXTERNAL_CID})})
same => n,System(echo “Channel: Local/${CALLERID(num,${CURRENT_EXTERNAL_CID})}@cos-all \nWaitTime: 30 \nExtension: s \nContext: callback-out \nMaxRetries: 2\nRetryTime: 1800\nSetvar: Language=${CHANNEL(language)}\nSetvar: __QUEUE_NUMBER=${QUEUE_NUMBER}\nSetvar: __ORIGINAL_INTERNAL_CID=”Call Back” <${CALLERID(num,${CURRENT_EXTERNAL_CID})}>\n” > ${ASTSPOOLDIR}/${MASTER_CHANNEL(UNIQUEID)}.call)
same => n,Set(FILE(/var/log/cpbx/callback.log,,,al)=${STRFTIME(${EPOCH},,%F %r)},${MASTER_CHANNEL(UNIQUEID)},${QUEUE_NUMBER},${CALLERID(num,${CURRENT_EXTERNAL_CID})})
same => n,Return()
[check_position]
exten => s,1,NoOp(Check position for queue ${QUEUE_NUMBER})
same => n,Set(waiting_callbacks=${DB_KEYS(${DB(pbx/instance)}/callback/${QUEUE_NUMBER})})
same => n,GoToIf(${ISNULL(${waiting_callbacks})}?:checkcallback)
same => n,Return()
same => n(checkcallback),Set(waiting_callbacks=${DB_KEYS(${DB(pbx/instance)}/callback/${QUEUE_NUMBER})})
same => n,Set(count=${DB_KEYCOUNT(${DB(pbx/instance)}/callback/${QUEUE_NUMBER})})
same => n,Set(first=${CUT(waiting_callbacks,\,,1)})
same => n,GoToIf($[$[${first}<${MASTER_CHANNEL(UNIQUEID)}]&&$[${count}>0]]?callback)
same => n,Return()
same => n(callback),System(mv ${ASTSPOOLDIR}/${first}.call ${ASTSPOOLDIR}/outgoing/${first}.call)
same => n,DBdeltree(${DB(pbx/instance)}/callback/${QUEUE_NUMBER}/${first})
same => n,Return()
[callback_out]
exten => s,1,NoOp(Suggest return to queue)
same => n,Set(CALLERID(all)=${ORIGINAL_INTERNAL_CID})
same => n,Set(__CALL_DESTINATION=${CALLERID(num,${ORIGINAL_INTERNAL_CID})})
same => n,Set(__CURRENT_INTERNAL_CID=${ORIGINAL_INTERNAL_CID})
same => n,GoTo(cos-all,797,1);797 custom application going to queue priority 1
Create breakout IVR
- Add a custom application that routes to create_callback context

- Create the breakout IVR with an entry going to the Custom Application

- On Queues settings, set IVR to your newly added breakout IVR.

Configure Trigger for Queue
- Go to Call Center > Queues > (select the queue) > CUSTOM (tab)
- Add parameter membergosub with value check_position, this triggers the dialplan that checks if a callback is next in line for dialing.
