We’ve all placed calls to support lines that keep you waiting on hold for what seems like an eternity. While some companies now offer a call back service that holds your place in the queue, many still do not. One of our users recently asked whether there was a simple way with Asterisk® to preserve your place in line without tying up your phone waiting for the other party to finally pick up the call. Here’s what we came up with.

The idea here is to use Unattended Transfer to transfer your end of the call to an extension that plays a message to dial zero to be reconnected with the calling party once your turn in the call queue finally arrives. To send your call to Pseudo-Hold, dial ##4653# (4653 spells HOLD). On Incredible PBX platforms, this will initiate an unattended transfer of your call and free up your phone.

Now we only need a little Asterisk dialplan code plus a recorded message telling the other party to press 0 to be immediately reconnected with us when they come on the phone. When the other party presses 0, the dialplan will transfer the call back to the extension that transferred the call to what we are referring to as Pseudo-Hold.

To begin, navigate to the custom folder in either /var/lib/asterisk/sounds/custom or /var/lib/asterisk/sounds/en/custom depending upon your version of Asterisk. Now download and install both the recording and the dialplan snippet:

wget http://incrediblepbx.com/presszero.tar.gz
tar zxvf presszero.tar.gz
rm -f presszero.tar.gz
sed -i '\:// BEGIN Zero:,\:// END Zero:d' /etc/asterisk/extensions_custom.conf
sed -i '/\[from-internal-custom\]/r dialplan.txt' /etc/asterisk/extensions_custom.conf
rm -f dialplan.txt
asterisk -rx "dialplan reload"

For those that are curious, the dialplan.txt snippet looks like this:

;# // BEGIN Zero Reconnect
exten => 4653,1,Answer
exten => 4653,2,NoOp(Dialed Peer Number: ${DIALEDPEERNUMBER})
exten => 4653,3,Background(custom/PressZeroToReconnect)
exten => 4653,4,WaitExten(2)
exten => 0,1,Background(connecting)
exten => 0,2,Dial(SIP/${DIALEDPEERNUMBER})
exten => t,1,Goto(4653,3)
exten => i,1,Goto(4653,3)
exten => h,1,Hangup
;# // END Zero Reconnect

To walk you through how it works, here we go. When you press ##4653#, the call is transferred to the 4653 extension shown above. In line 1, it answers the call. In line 2, it deciphers the extension from which the call was transferred. In line 3, we play the Press Zero to Reconnect message. In step 4, we wait for the other party to press 0. If they don’t within 2 seconds, we loop back up to line 3 and play the message over and over again. If the other party presses zero, we drop down to 0,1 which plays a message saying "Connecting." Then 0,2 sends the call back to the extension that originally transferred the call to 4653.

Originally published: Monday, December 12, 2022



Need help with Asterisk? Visit the VoIP-info Forum.


 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls plus quadruple data center redundancy assures that you’ll never have a failed call. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 




 

This article has 2 comments

  1. You know Ward, you make me smile.

  2. When 0 is pressed to transfer the call back to the extension that originally transferred the call to 4653 – I then hear "connecting" – but immediately get a busy signal instead of a transfer. I have an Oracle cloud install.

    [WM: Please open a thread on the VoIP-Info.org Forum, and we will be happy to assist with troubleshooting.]

Leave a comment

Your email address will not be published. Required fields are marked *

*