CPA on Freeswitch
Requirement
Call progress analysis is needed in outbound campaign calls to determine whether the answering party is a human or a machine i.e. voicemail, answering machine etc.
Freeswitch Mods
CPA can be achieved via certain mods on Freeswitch.
Mod_rayo
Resources:
Usage:
Native to Freeswitch, uses "Rayo" protocol.
Deemed unnecessary for use.
Complicated to set up with little to no guide on usage.
Mod_amd
Resources:
Usage:
Separate from Freeswitch.
Detects whether human or machine has answered the call.
Detection works by checking if there is a greeting or initial silence and how long it silence lasts, the silence between words, among other parameters, over a period of time.
Can be set up fairly easily via the following steps:
Clone repo https://github.com/seanbright/mod_amd and move mod_amd folder under /usr/src/
Run command 'export PKG_CONFIG_PATH=/usr/lib/pkgconfig/'
Edit /usr/src/mod_amd/Makefile and comment out 'MODCFLAGS = -Wall -Werror'
Run command 'make'.
Moved the generated file mod_amd.so to /usr/lib/freeswitch/mod/.
Create amd.conf.xml in /etc/freeswitch/autoload_configs/ and copy the given text in the section: https://github.com/seanbright/mod_amd#sample-configuration.
Open fs_cli and run command 'load mod_amd'.
Configure parameters in amd.conf.xml to tune according to expected machine/human behaviour.
Run amd application during calls via:
For XML dialplan: <action application="amd" data=""/>
For Lua script: session:execute("amd")
The amd will check for the configured duration whether the answered party is a machine or human.
After the check is done, a channel variable amd_result is set to either HUMAN or MACHINE.
Another channel variable amd_cause is also set, to describe why the answered party was flagged as a machine.
May be CPU intensive.
Requires much testing to configure the parameters for required cases.
Possible Integration:
The dialer originates a call to the customer and runs a script provided with the agent extension as argument.
The mod_amd detection is started once the call hits the gateway.
If the customer does not answer, an automated message will play, which can either be TTS or a recording.
Based on the parameters set in amd.conf.xml, the detection will give results similar to the following:
In either case, the call will be hung up.
If the customer answers the call, then their voice will be detected and according to properly configured parameters, detected as human.
The call will bridged to an agent.
In either scenarios, the amd_result variable will be set to match the detected entity (HUMAN or MACHINE) and the amd_cause will contain the detection reason:
Based on these set channel variables, if a machine answered the call:
The CIM will be notified via the END_CHAT intent to free up the agent.
Call result will be saved as MACHINE_DETECTED.
Mod_avmd
Resources:
Usage:
Native to Freeswitch.
Works by detecting beep at the end of voicemail/answering machine.
Used by calling avmd_start during a call:
XML dialplan: <action application="avmd_start" data="inbound_channel=1,outbound_channel=1"/>
Lua script: session:execute("avmd_start","inbound_channel=1,outbound_channel=1")
If a beep is detected:
A CUSTOM beep event is fired.
A channel variable avmd_detect is created and set to true.
Possible integration:
The dialer originates a call as usual but with an additional parameter: execute_on_answer avmd_script.lua
This script contains the line session:execute("avmd_start","inbound_channel=1,outbound_channel=1") which starts mod_avmd detection
If a voicemail/answering-machine beep is detect the following event is broadcast :
This event can be detected in the dialer.
The dialer will read the call UUID from the channel variables from this event.
The dialer will hangup the call and stop avmd detection with avmd call_uuid stop.
The post-call script will run and and detect that the avmd_detect variable was true.
The CIM will be notified via the END_CHAT intent to free up the agent.
Call result will be saved as MACHINE_DETECTED.