Test in FreePBX Distro 10.13.66-64bit
This code will let you record what the callers pressed in your ivr.
You can either modify existing IVRs, or create some net new ones.
Anyway, its free…easy to test, and very easy to backout of if you have a problem.
I suggest just test with 1 IVR to get an idea of how it would work, and see if it works for you.
Were basically copying small portions of the IVR code that FreePBX generates every time you press SUBMIT into an override file which allows us to modify without GUI changes in future of other parts of the PBX automatically overwriting our custom updates.
DESCRIPTION
This records the IVR selections and save them into a file called ivrlog.txt int /tmp folder.
The comma delimited file contain each IVR selection broken up in this manner:
Example output: (DATE, CallerID, UniqueID, FreepbxIVRid,Selection)
07092017-22:35:03,Jane Doe <5551238811>,1504834501.1207,ivr-7,custom/question1,1
DATE=DDMMYYY-HH:MM:SS
CallerID= The callers CLID if available “Jane Doe <5551238811>”
UniqueID= This is the unique value for each call. This will help you sort indvidual calls that are in this file.
FreepbxIVRid= Each IVR you create is assigned an IVR#. FreePBX doesn’t store the descriptive name, this is here to help you know which one is which. This is if you have multiple IVRs that you want to do this mod to.
Selection= This is the DTMF value they pick for their answer.
INSTALLATION
1> open up the file: /etc/asterisk/extensions_additional.conf
2> Find the IVR in question that you want to record the prompts to. They are relatively easy to find, the start with a heading [ivr-X]
3> Copy the IVR’s entire sub-section into /etc/asterisk/extensions_override_freepbx.conf
EXAMPLE: Below is a snippet of an IVR that I tested with called IVR-7 in the FreePBX dialplan
[ivr-7] ; ivr1
include => ivr-7-custom
include => from-ivr-directory-Disabled
…
exten => s,1,Set(TIMEOUT_LOOPCOUNT=0)
exten => hang,1,Playback(vm-goodbye)
exten => hang,n,Hangup
;–== end of [ivr-7] ==–;
copy everything from
[ivr-X] through to ;-== end of [ivr-X] ==–;
4> Now that you have it pasted in the overrides section, you want to modify it.
You’ll see the following entries in your IVR. My IVR had 2 entries, you will just repeat the process for the number of choices you have.
EXAMPLE: Your IVR will have something very similar to below.
[ivr-Xs]
…
exten => 1,1(ivrsel-1),Goto(ivr-8,s,1)
exten => 2,1(ivrsel-2),Goto(ivr-8,s,1)
The modification is easy. For each selection your particular IVR would have, you add the “system” command and alter the exten numeric order.
Make the entire in you ivr that looks like this:
exten => 1,1(ivrsel-1),Goto(ivr-8,s,1)
exten => 2,1(ivrsel-2),Goto(ivr-8,s,1)
turn into this:
exten => 1,1,system(echo “${STRFTIME(${EPOCH},%d%m%Y-%H:%M:%S)},${CALLERID(all)},${UNIQUEID},${IVR_CONTEXT},${EXTEN}” >> /tmp/ivrlog.txt)
exten => 1,2(ivrsel-1),Goto(ivr-8,s,1)
exten => 2,1,system(echo “${STRFTIME(${EPOCH},%d%m%Y-%H:%M:%S)},${CALLERID(all)},${UNIQUEID},${IVR_CONTEXT},${EXTEN}” >> /tmp/ivrlog.txt)
exten => 2,2(ivrsel-2),Goto(ivr-8,s,1)
You’ll need to repeat this entry for each entry you have in the IVRS.
5> Save your changes
6> in the CLI type
core reload
This will load these entries into your PBX.
7> Make a call to the IVR and test the functionality.
8> Look in /tmp/ivrlog.txt, there should be entries like:
07092017-22:35:03,Jane Doe <8862>,1504834501.4403,ivr-7,1
07092017-22:35:03,Jane Doe <8862>,1504834501.4403,ivr-5,2
07092017-22:35:03,Jane Doe <8862>,1504834501.1207,ivr-7,1
07092017-22:35:03,Jane Doe <8862>,1504834501.1207,ivr-5,2
The system will keep appending to this file.