Skip to main content
Skip table of contents

CPA on Freeswitch


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.




  • Native to Freeswitch, uses "Rayo" protocol.

  • Deemed unnecessary for use.

  • Complicated to set up with little to no guide on 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:

    1. Clone repo and move mod_amd folder under /usr/src/

    2. Run command 'export PKG_CONFIG_PATH=/usr/lib/pkgconfig/'

    3. Edit /usr/src/mod_amd/Makefile and comment out 'MODCFLAGS = -Wall -Werror'

    4. Run command 'make'.

    5. Moved the generated file to /usr/lib/freeswitch/mod/.

    6. Create amd.conf.xml in /etc/freeswitch/autoload_configs/ and copy the given text in the section:

    7. 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.




  • 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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.