I’d usually encourage people to go through Sangoma, but since this is COVID-19 related and will make the job for health professionals a little easier, I will post what I think should be a workable solution.
Step 1. The Audios
Record 4 files.
The format does not really matter, it can be MP3 WAV as long as FreePBX accepts that format to upload.
Filename1 = c19_enter_amount
What it should say = “Please enter the amount of vaccination you need followed by the pound sign”
Filename2= c19_you_entered
What it should say = “You entered:”
Filename3 = c19_if_correct
What it should say = “If this is correct, press 1 to reserve, to re-enter the amount, press 2”
Filename4 = c19_order_success
What it should say = “Thank you! Your order has been successfully recorded. Goodbye!”
Go to Administration > System Recordings and upload each of these 4 recordings.
Step 2. The dialplan.
Here you give the caller 3 attempts to confirm their order, if more than 3 time the system will hang up (remember to replace your email)
[covid-19-vaccination]
exten => s,1,Noop(Entering custom context in extensions_custom.conf to record and email vaccination orders)
exten => s,n(start),Set(attempt=$[0${attempt}+1])
exten => s,n,Read(amount,custom/c19_enter_amount,,,,5)
exten => s,n,Playback(custom/c19_you_entered)
exten => s,n,SayDigits(${amount})
exten => s,n,Read(confirm,custom/c19_if_correct,,,,5)
exten => s,n,Gotoif($["${confirm}" = "1"]?process)
exten => s,n,Gotoif($["${attempt}" < "3"]?start)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => s,n,Hangup()
exten => s,n(process),Playback(wait-moment)
exten => s,n,System(echo "New order details below. \n\nPhone Number: ${CALLERID(num)} \nAmount: ${amount} \nTime: ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)}" | mail -s "New vaccine order ${UNIQUEID}" [email protected])
;Optional, in case the email failed, you still record the order in a log file
exten => s,n,System(echo "\n\nNew order \nPhone Number: ${CALLERID(num)} \nAmount: ${amount} \nTime: ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)}" >> /var/log/orders.txt)
exten => s,n,Playback(custom/c19_order_success)
exten => s,n,Hangup()
Take this dialplan and drop it into /etc/asterisk/extensions_custom.conf
Step 3.
Sending calls to the custom dialplan.
Under Administration > Custom Destinations, create a new object, set the target to covid-19-vaccination,s,1 and name it whatever you want.
Step 4.
Sending calls to the custom destination
Finally, either point an inbound route or an IVR option to the Custom Destination.
Step 5.
Reload config
Apply config and test…
Disclaimer, I did not test this… If it fails, please post a log.