Imagine if you wanted to play a message to a caller, or do something in your code AFTER the agent hangs up, vs the agent needing to xfer them manually. Here's what you do
(tested in FreePBX Distro)
The ‘small c’ in the queue section of the dialplan will allow the dialplan to continue on when the agent hangs up (vs triggering a hangup of both agent and caller).
Then it will automatically call the script and the caller into your queue will hear it and be able to respond.
We are copying the QUEUE code into the override file. Here is the caveat to this that you will need to remember for this particular code change.
ANY Changes that you need to make to the queues via the GUI will have NO effect on the queue’s behavior. Since we are using the override file. What this means is if you need to make changes to the queue, you will need to perform the steps below for those changes to take effect in your production PBX as well as allow the automatic message to play. Without doing it, you will make changes, but asterisk will continue with the code that is in the override file, ignoring the changes.
Its the price of free.
INSTRUCTIONS
First create your queue, assuming you have one already, but if not, create the queue you want and make sure it works.
Open up extensions_additional.conf
Go [ext-queues] and copy everything from [ext-queues] all the way to ;–== end of [ext-queues] ==–;
[ext-queues]
include => ext-queues-custom
exten => 8860,1,Macro(user-callerid,)
exten => 8860,n,Answer
.............
bla bla bla
bla bla bla
..............
exten => 8860,n,Set(VQ_DEST=)
exten => 8860,n,Dial(Local/554@from-internal/n,)
exten => 8860,n(gotodest),GotoIf($["${QDEST}"=""]?app-
blackhole,hangup,1:${CUT(QDEST,^,1)},${CUT(QDEST,^,2)},${CUT(QDEST,^,3)})
exten => 8860*,1,Macro(agent-add,8860,)
exten => 8860**,1,Macro(agent-del,8860)
exten => h,1,Macro(hangupcall,)
;--== end of [ext-queues] ==--;
Copy this into “extensions_override_freepbx.conf”
Now you will need to modify two lines in the override file.
1> For the section that reflects your queue (in my example my queue is 8860) that will look basically like this (just remember yours will reflect the number that you have assigned to your queue)
exten => 8860,n(qcall),Queue(8860,${QOPTIONS},,${QAANNOUNCE},${QMAXWAIT},${QAGI},,${QGOSUB},${QRULE},${QPOSITION})
The change you will make is
exten => 8860,n(qcall),Queue(8860,${QOPTIONS}c,,${QAANNOUNCE},${QMAXWAIT},${QAGI},,${QGOSUB},${QRULE},${QPOSITION})
specfically you will add a “c” (lower case) right after QOPTIONS and before the first “,” comma mark
${QOPTIONS}c,${QAANNOUNCE}
Now, scroll down about 5 or so lines and you’ll see this:
exten => 8860,n,Set(VQ_DEST=)
exten => 8860,n(gotodest),GotoIf($["${QDEST}"=""]?app blackhole,hangup,1:${CUT(QDEST,^,1)},${CUT(QDEST,^,2)},${CUT(QDEST,^,3)})
Now between these lines insert the following line, except modify the XXXX value to be the number you dial to test your script with.
exten => 8860,n,Set(VQ_DEST=)
exten => 8860,n,Dial(Local/XXXX@from-internal/n,)
exten => 8860,n(gotodest),GotoIf($["${QDEST}"=""]?app blackhole,hangup,1:${CUT(QDEST,^,1)},${CUT(QDEST,^,2)},${CUT(QDEST,^,3)})
Now save your changes
from command line type in asterisk -rx 'core reload’
TEST!
To backout this code if there is a problem that is affecting a production system, it the extensions_override_freepbx.conf file, change the heading [ext-queues] to [ext-queues-bypass]
save that change
then in the cli type in
asterisk -rx 'core reload’
This will revert the pbx back to the original code.
You can then identify the changes, remove the -bypass
save/reload the script and test.