Skip to main content

Perl

About

In FreeSWITCH, there are many ways to use Perl, not all of which require the mod_perl module or the CPAN Perl modules. You can use Perl in the following ways with FreeSWITCH:

  • Executing Perl scripts via curl, etc. to return XML configuration (only requires the curl module)
  • Socket control / event socket interaction (send and receive events, execute commands, and IVR over socket interaction) through Perl ESL; this does not require mod_perl, only the Perl ESL module.
  • Application action / standard execution to carry out a dialplan (requires mod_perl)
  • Native XML generation (requires mod_perl)

If you want or need the advanced control that mod_perl provides please see the mod_perl page for the full documentation on it.

Click here to expand Table of Contents

Build/Install

There is no one way to install Perl support. As outlined above you can use Perl many different ways, each having different requirements. See the mod_perl page for building mod_perl.

Execution of a script

DEPRECATED

You can run scripts directly from the console with:

perlrun /path/to/your/script.pl

If you just want to run a perl script (or any normal application) from a dialplan, invoke the system app:

<action application="system" data="/path/to/app.pl"/>

Note: FreeSWITCH™ has a "scripts" directory which can be determined from the console via the command:

eval $${script_dir}

You must specify either

$${script_dir}/my_script.pl

or the full absolute path to your script when you invoke it from the dialplan.

Example Scripts

  • mod_perl examples on mod_perl page.
  • Github — search the freeswitch-contrib tree of the repository for *.pl for numerous examples of perl scripts running against FreeSWITCH