FreePBX | Register | Issues | Wiki | Portal | Support

FPBX/Asterisk option to replace Avaya IPO "Campaigns"


#1

Good morning, all.

We’re in the process of replacing an older Avaya IPO install with FPBX, and we’ve run across a little snag.

There are several modules built in the existing voicemail system that ask a series of questions, and record the answers from the caller, then email a single sound file (with all the answers appended to the one file). I see no way of doing this within the GUI at this time, nor do I see any Commercial Modules that offer such a thing.

Does anyone have any thoughts on how to achieve this?

Essentially the workflow is:
Answer and play greeting.wav
play refill1.wav
record for 8 seconds
play refill2.wav
record for 10 seconds
play refill3.wav
record for 5 seconds
play refill4.wav
record for 8 seconds
Then email to: < TARGET ADDRESS > with Subject: < SUBJECT VARIES >
BODY: < CALLER NAME > < CALLER NUMBER >
ATTACHMENT: < COMPILED RECORDING >
Delete file.


IVR recording and then sending to voicemail
Outbound Call Automation Help Please
(Dickson) #2

Don’t suppose you’d be ok with hearing the questions by chance in the final recording?
Do you want any interaction from the caller through the keypad? (press 1 to hear the question again, # to start over etc?)


(M. Shokuienia) #3

Hi,

Question is how it could be done through GUI or more generally, how it could be done? BTW, are you looking a dialout campaign module with above scenario?

BR


#4

I’d prefer the compiled sound file to only have the answers, and no they don’t need to interact with it at all, only answer the questions as they’re asked by the system.


#5

I don’t think it can be fully made through the GUI, so I’m assuming I’ll have to build some custom dialplan what-nots, then use the GUI to call them (Custom Destinations, etc.). No dial-out, this is just inbound calls to that “module”


(Dave Burgess) #6

I think you can actually do most of this through the GUI.

Set up a series of IVRs to do the questions. Have the timeouts set to the maximum duration of your answer sessions, but also make it so that the next response is the follow on.

On the other hand, that’s going through a lot of clicking through screens.

Setting this up as a custom context would be a lot simpler and give you the chance to manage it.

A third option would be to build a application that modifies a special context file with the options and files you are going to be using. @jfinstrom has a series of links that you could use to build an application that could be called from extensions_custom.conf…


(Dickson) #7

This isn’t really that hard. Not really doable through the GUI, but a little custom dial plan can do it. I’ll code something up and post shortly.


#8

Thank you so much @dickson I have a client that is interested in a survey system as well. Looking forward to your post.


(Dickson) #9

Here is the BETA release 2 of the code.
(added a delete of the recording after its emailed)

I’ve tested this in the FreePBX Distro using 13.0.190.11 worked ok as a beta test. It may need alteration for your own environments, however I am using commands that have been around a long time so should be compatible with most versions.
Code from strangers should never be tested in a production environment.

What this code does.
The system will ask 2 questions, after each it will record the caller for a maximum of 15 seconds (you can change this of course) or until the users presses # key, whichever comes first.

In this example, after the 2nd answer is given, the system will play back both recordings together so you can hear it.

If caller press # the call will stop recording and continue to next questions

If caller either doesn’t say anything for 3 seconds, the system continues to next question (changeable of course)

Again this is just beta code to see if you think it will do what you want and identify tweaks you might like.

A note on email.
Email is a tricky thing with asterisk, linux and email world in general. My code works for our email system, but it might not necessarily work for yours due to security of your email servers or configurations. It took me longer to get through the email nuances than it did to write the code.

INSTALLATION
To make the code simpler, for those not versed in asterisk dialplan, any line starting with a ; semicolon is a remark line and can be safely removed for ease of viewing. Lines with ; are there to either leave a comment, or to have the system not execute that line of code.

STEP 1
ADMIN->CONFIG EDIT
open up "extensions_custom.conf"
Copy the code below between the ------ lines into the bottom of extensions_custom.conf and then save the file.

   START OF DIALPLAN CODE
   ---------------------------------------------------------------------------

[macro-questionanswer]
;Version .2 BETA

exten => s,1,answer()

;system asks a question. ‘question1’ reflects the name of the file that you record or upload to the system.
exten => s,n,playback(/var/lib/asterisk/sounds/en/custom/question1)

;uniqueID is an asterisk value to ensure that multiple recordings dont fall all over each other. in this example.
;3=amount of silence in seconds before system auto stops recording.
;15=max length of recording
;a=append, which means each subsequent recorded question should append to the previous one if any.

exten => s,n,Record(${UNIQUEID}.wav,3,15,a)

;to add questions to your surveys, just copy/paste the next two lines underneath the next.
;increment the “questions2” to “question3” “question4” etc.
;I’ve included a couple of extra questions with a semicolon comment to bypass them for speed of testing
exten => s,n,playback(/var/lib/asterisk/sounds/en/custom/question2)
exten => s,n,Record(${UNIQUEID}.wav,3,15,a)

;exten => s,n,playback(/var/lib/asterisk/sounds/en/custom/question3)
;exten => s,n,Record(${UNIQUEID}.wav,3,15,a)

;exten => s,n,playback(/var/lib/asterisk/sounds/en/custom/question4)
;exten => s,n,Record(${UNIQUEID}.wav,3,15,a)

;comment/remove these 3 lines to remove playback of the recording. This was put in for testing purposes
exten => s,n,wait(1)
exten => s,n,Playback(${UNIQUEID})
exten => s,n,wait(1)

;this plays a generic “THANKYOU”. Comment/delete the line below to remove that feature.
exten => s,n(endcall),playback(thank-you-for-calling)

;system sends the email with the attachment recording.
;change YOURSUBJECT and DESTINATION@DOMAIN.COM to reflect the needs of your system
exten => s,n,system(mail -s YOURSUBJECT -a /var/lib/asterisk/sounds/${UNIQUEID}.wav DESTINATION@DOMAIN.COM < /tmp/email.txt)

;delete sound file.
exten => s,n,system(rm /var/lib/asterisk/sounds/${UNIQUEID}.wav)
exten => s,n,hangup()

  -----------------------------------------------------------------------------
  END OF DIALPLAN CODE

Click on “SAVE”

STEP 2
ADMIN->CUSTOM DESTINATIONS
Create a new custom destination "questionanswer"
Set the target as
macro-questionanswer,s,1
Save those changes

STEP 3
Create a way to trigger the application to run from dialplan.
For example, create a IVR, and set one of the numeric values a caller can enter to Custom Destination -> “questionanswer”"

STEP 4
Save your changes AND apply the configuration.

STEP 5
Create your question files.

Use system recordings, and either record them over your phone, or through a 3rd party sound recording application. If recording with another app, they must be saved as 8000khz MONO 16bit WAV PCM.

The recordings you make, set their name to “recording1” “recording2” “recording3

STEP 6
in /tmp/ create a file called "email.txt"
In that file put in something like
SUBJECT: NEW RECORDING
Here is a new recording to review.

Save changes.

TESTING IT OUT

Call your PBX script in whatever way you have set up to activate this recording. You SHOULD hear your recording ask you a questions, then there will be “Beep” record your answer. After 3 seconds of silence, you’ll hear the second question followed by a beep. After 3 seconds of recording, the system will playback Answer1 and Answer2 and then hangup the call.


#10

@dickson I think that a great feature alternative to the timed answer response would be to simply allow the person press the # key or something to indicate completion.


(Dickson) #11

@frankb
Done! That is the default recording feature I forgot to mention that. I made slight alteration and notes to code. I posted above. System stops automatically after 3 seconds, and records for a maximum of 15 seconds. All changeable of course. I wrote this code pretty late last night so i’ll review it again. Although there are some custom dialplan to this, i think i can make it work with some of the existing FreePBX gui to make editing it by mere mortals a little easier! (or leave it as is for people who want some PS dollars :slight_smile: )
So 3 seconds, and 15 seconds, # to stop. All these are changeable by users of course. I’m sure if you review the dialplan i’ve posed you can see how that modification can be done.
With “RECORD” you can also disable the DTFM features, so that # does nothing, or you can have any DTMF tone stops recordign. Its quite flexible.
More to come shortly


(Dickson) #12

@frankb @kristiandg

Beta code updated above. I edited my original post. Give it a try and let me know if it does what you need or if there is any changes I can make for you.

I welcome any suggestions from anyone!

Dickson


#13

Thank you so much. I sure will.


(Ian Plain) #14

Hi

kristiandg we have a system doing on asterisk since about 2008 for a mailorder companies catalog request line taking their name address etc but we then save it in voicemail format making the msgxxxx.txt with recording duration so they can access it via a handset as well as we also then email a mp3 of the recording to the customer This is done by a script on hangup

This recently has been expanded to now use the Google Cloud speech API to transcribe the recording . see http://www.cyber-cottage.eu/?p=1801 for a brief write up of that. The same method also is used to create voicemail with MP3 and transcribed text emailed for user voicemail.

If you want to get in touch I can explain more.

Ian


#15

This is beautiful. It seems to get hung up at the email portion though - I threw a “goodbye” after the email when I noticed it wasn’t hanging up the call, so I could hear where it was stopping.

It says thank you for calling, then attempts to email and halts there.

I don’t know if what I did was correct, but I converted it to the “same” function (and, yes I did use my email address) :wink: :
[macro-questionanswer]
;Version 1.1 BETA

exten => s,1,answer()

;system asks a question. ‘question1’ reflects the name of the file that you record or upload to the system.
same => n,playback(/var/lib/asterisk/sounds/en/custom/question1)

;uniqueID is an asterisk value to ensure that multiple recordings dont fall all over each other. in this example.
;3=amount of silence in seconds before system auto stops recording.
;15=max length of recording
;a=append, which means each subsequent recorded question should append to the previous one if any.

same => n,Record(${UNIQUEID}.wav,3,15,a)

;to add questions to your surveys, just copy/paste the next two lines underneath the next.
;increment the “questions2” to “question3” “question4” etc.
;I’ve included a couple of extra questions with a semicolon comment to bypass them for speed of testing
same => n,playback(/var/lib/asterisk/sounds/en/custom/question2)
same => n,Record(${UNIQUEID}.wav,3,15,a)

;same => n,playback(/var/lib/asterisk/sounds/en/custom/question3)
;same => n,Record(${UNIQUEID}.wav,3,15,a)

;same => n,playback(/var/lib/asterisk/sounds/en/custom/question4)
;same => n,Record(${UNIQUEID}.wav,3,15,a)

;comment/remove these 3 lines to remove playback of the recording. This was put in for testing purposes
same => n,wait(1)
same => n,Playback(${UNIQUEID})
same => n,wait(1)

;this plays a generic “THANKYOU”. Comment/delete the line below to remove that feature.
same => n(endcall),playback(thank-you-for-calling)

;system sends the email with the attachment recording.
;change YOURSUBJECT and DESTINATION@DOMAIN.COM to reflect the needs of your system
same => n,system(mail -s YOURSUBJECT -a /var/lib/asterisk/sounds/${UNIQUEID}.wav DESTINATION@DOMAIN.COM)

;delete sound file.
same => n,system(rm /var/lib/asterisk/sounds/${UNIQUEID}.wav)
same => n,Playback(goodbye)
same => n,hangup()


(Dickson) #16

It sounds like you have everything installed correctly. As I eluded to in the original post…in order for my servers to actually send email through our SMTP relay servers, I had to jump through a few hoops with our IT group to get it working. We have the billions of spam emails sent to thank for a level of security that prevents email from passing at all costs.

I buy the $25 Sysadmin Advanced module to help ease the pain of SMTP configuration. But even then it was still a lot of trial and error to get everything to pass through.

The log file that I looked at constantly is in /varl/log/maillog
That tells you mostly what is going on.
I logged in as root and sent test emails from the command line as:
mail -s testemailsubject myemail@domain.com

And tweaked settings with our group until it worked.

Although I didn’t edit this file directly (the FREEPBX GUI did in the SMTP settings for office365 email) here are some of my settings from the /etc/postfix/mail.rc config file. It might help troubleshooting.

smtp_use_tls = yes
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
relayhost = COMPANY-COM.mail.protection.outlook.com
myhostname = pbx11
mydomain = COMPANY.COM
myorigin = pbx11.COMPANY.COM

I wish i could help more on the SMTP side, but my experience is that I pray it works first try when I setup a new server, and if my phone doesn’t ding when i send a test message, I curse and then call in my email tech support people to help me get it working

EDIT:
If you put a semicolon in front of the bit of code with the email, you can test out the full script minus that bit.

FreePBX has a bunch of helpful advice here as well.
http://wiki.freepbx.org/display/PPS/Setup+Postfix+Manually


#17

Our SMTP works well, as Voicemails and System Alerts send without issue. Besides, if the issue were on the mail transfer side, the script itself wouldn’t get hung up (it would have seen that line as successfully completed, since the internal mail server would have accepted the request).

I did REM that line, which corrected, so I know that line is the hang-up. I think there may be something in the syntax of the mail command that it isn’t able to execute on, but haven’t really gotten a chance to dig into that yet.

I tried the command in system CLI, and it also hung the CLI… Interestingly… I then looked at the mail log, and it had noting in there for the email address I specified. It’s as if the command isn’t actually making it to the email relay agent.


#18

Ah, just found the issue. It seems I need to echo some text to fill the body of the email with. THIS command worked from the command line, so I trust it will work from the dialplan command:

echo “Test mail from postfix” | mail -s “Test Postfix” you@example.com


#19

Tested from within the dialplan with that syntax, and it worked…


(Dickson) #20

Ah great!
Let me know if you need any modifications to the code, happy help!

EDIT:
Ah the message body, good point. It works for me, but I’ve seen that happen. I updated the code to reflect putting some text in the message body. Sorry I missed that bit, hopefully that didn’t mess you up too long.