How to create a callback to Mail option?

The issue may have been asked before, but it’s not yet clear to me how to implement it,
I mean a callback that is semi-automatic, meaning when a person calls and there is no answer (e.g. in Queues or extension) it will send him to a menu where he can dial 1 to get back to the number he called, or press 2 to back to another number when he types it and then Press 1 to confirm or 2 to edit the number, (and again to confirmation…)
After confirming the number, an email will be sent to a specific address with the caption: Please return to this number.

Does anyone have a code snippet I can apply and learn from?
Maybe in extensions_custom?
Thank you! :slightly_smiling_face:

Today’s good deed

[send-callback-email]
exten => s,1,Noop(Entering custom dialplan in extensions_custom.conf to send an email)
exten => s,n,Read(method,custom/callback-email-options,1,,2,5)
exten => s,n,Gotoif($["${method}"  = "2"]?changenum)
exten => s,n(send),System(echo "Hello, \n\nNumber to callback: ${IF($["${method}"  = "2"]?${newnum}:${CALLERID(num)})}" | mail -s "Request for callback ${UNIQUEID}" -r "My PBX <[email protected]>" [email protected])
exten => s,n,Playback(custom/thank-you-goodbye)
exten => s,n,Hangup()
exten => s,n(changenum),Read(newnum,custom/pls-enter-10-digit,10,,2,5)
exten => s,n,Playbck(you-entered)
exten => s,n,SayDigits(${newnum})
exten => s,n,Read(correct,custom/if-this-is-correct,1,,2,5)
exten => s,n,Gotoif($["${correct}" = "1"]?send:changenum)

Record the following filenames and upload it to System Recordings:

callback-email-options = To receive a callback on the number you are calling from, press 1. To receive a callback on a different number, press 2.
thank-you-goodbye = Thanks, your request has been recorded. You should receive a callback within…
pls-enter-10-digit = Please enter a 10 digit phone number where you would like to receive a callback on.
if-this-is-correct = If this is the correct number, press 1. To change it press 2.

Then create a custom destination that targets: send-callback-email,s,1

I did not test this, but this should be a good start

3 Likes

perfect!! Thank you so much for the help I really appreciate

I recorded everything by name and it seems to work partially
It says hello and thank you and does not send the email
When I press 2 I enter the number and then it hangs up

Please provide the output of:

asterisk -x"dialplan show send-callback-email"

Also, please provide a call trace via pastebin: Providing Great Debug - Support Services - Documentation

I recorded everything by name and it seems to work partially
It says hello and thank you and does not send the email
When I press 2 I enter the number and then it hangs up

Sent you a PM

I checked and it works wonderfully
Only instead
exten => s, n, Playbck (you-entered)
Switch to
exten => s, n, Playback (you-entered)

I fixed it in the code and it works

[send-callback-email]
exten => s,1,Noop(Entering custom dialplan in extensions_custom.conf to send an email)
exten => s,n,Read(method,custom/callback-email-options,1,2,5)
exten => s,n,Gotoif($["${method}" = “2”]?changenum)
exten => s,n(send),System(echo “Hello, \n\nNumber to callback: ${IF($[”${method}" = “2”]?${newnum}:${CALLERID(num)})}" | mail -s “Request for callback ${UNIQUEID}” [email protected])
exten => s,n,Playback(custom/thank-you-goodbye)
exten => s,n,Hangup()
exten => s,n(changenum),Read(newnum,custom/pls-enter-10-digit,10,2,5)
exten => s,n,Playback(you-entered)
exten => s,n,SayDigits(${newnum})
exten => s,n,Read(correct,custom/if-this-is-correct,1,2,5)
exten => s,n,Gotoif($["${correct}" = “1”]?send:changenum)

Thank You !
PitzKey
:grinning:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.