Skip to main content

Pylons

About

About text.

Click here to expand Table of Contents

Pylons is a Python based webserver. Together with mod_xml_curl it makes setting up FS reasonably straight forward. The examples on this page are not for a producting server, but should serve as a starting point for "playing" with FS.

  • Installation of Pylons:
Debian: apt-get install pylons

Pylons comes with paster, it is a rather useful program that allows you to setup a pylons project and also acts as a small webserver --- which is ideal for testing.

  • Creation of pylons project:
paster create -t pylons freeswitch

That creates a new project in your current folder. The parts of pylons which will hold the code to interact with FS are called controllers and they are created as follows.

  • Controller creation:
paster controller freeswitchdialplan
paster controller freeswitchdirectory
paster controller freeswitchcdr

These three controllers can be found in:

freeswitch/controllers/

Now get the FS code from svn for the controllers and add replace the ones we have just created:

svn checkout http://svn.freeswitch.org/svn/freeswitch/trunk/scripts/contrib/Phil/pylons/

Pylons is now ready and all you need to do is to start it, go to the main pylons directory that contains development.ini and test.ini, and do:

paster serve --reload development.ini

Now your pylons webserver should be running on port 5000. The --reload flag performs an auto reload anytime you update your controllers.

On to FS. In order to get FS to talk to pylons we need to set a couple of parameters.

When compiling FS make sure you have enabled the following two options in modules.conf:

xml_int/mod_xml_curl
xml_int/mod_xml_cdr

conf/autoload_configs/modules.conf.xml:

<load module="mod_xml_curl"/>
<load module="mod_xml_cdr"/>

conf/autoload_configs/xml_curl.conf.xml:

<configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings>
<binding name="dialplan fetcher">
<param name="gateway-url" value="http://127.0.0.1:5000/freeswitchdialplan/dialplan" bindings="dialplan"/>
</binding>
<binding name="directory">
<param name="gateway-url" value="http://127.0.0.1:5000/freeswitchdirectory/directory" bindings="directory"/>
</binding>
</bindings>
</configuration>

conf/autoload_configs/xml_cdr.conf.xml:

<param name="url" value="http://127.0.0.1:5000/freeswitchcdr/cdr"/>

Now FS should get dialplan, directory and cdr info from pylons. If you got any further questions please find me on irc: phm_it