[Freeswitch-users] Serving sofia.conf via lua

Antony Stone Antony.Stone at freeswitch.open.source.it
Tue Nov 30 09:34:41 UTC 2021


Hi.

I am trying to get Freeswitch to get its sofia configuation from lua instead of 
static XML files.

https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_curl tells me for 
example that "Section: configuration - This is used to send back configuration 
files such as sofia.conf."

So, I'm pretty sure what I want to do should be possible, but nowhere have I 
so far been able to find a fully working example telling me how to do it.

My understanding so far is that:

1. I need to create a lua script which generates the *complete* XML as would 
be served from /etc/freeswitch/autoload_configs/sofia.conf.xml and all its 
included sub-directories/files

2. This XML as output from the script should be enclosed within tags:

  <document type="freeswitch/xml">
    <section name="configuration">
      ... XML goes here ...
    </section>
  </document>

3. I should place this lua script in freeswitch's scripting directory, which 
on my (Debian) machine is /usr/share/freeswitch/scripts

4. I need to enable this script to be run by including in 
/etc/freeswitch/autoload_configs/lua.conf.xml:

    <param name="xml-handler-script" value="sofia.conf.lua"/>
    <param name="xml-handler-bindings" value="configuration"/>


The first thing which is not clear to me is what I should do about 
/etc/freeswitch/autoload_configs/sofia.conf.xml

 - if I leave it as it is, it appears to be used in the normal way, and my lua 
script is ignored
 - if I delete it (or rename it to sofia.conf.xml.noload for example) then sofia 
doesn't get loaded *at all* and when I go into fs_cli I do not even have a 
"sofia" command
 - if I "touch" the filename so that 
/etc/reeswitch/autoload_configs/sofia.conf.xml exists but is empty, I get the 
same result egain - the "sofia" command does not even exist in the cli


So, can anyone point me at how to join these things up correctly so that I can 
serve sofia configuration settings from a lua script?


I've been told here that:

On Friday 05 November 2021 at 12:28:55, David Villasmil wrote:

> In FS there’s the embedded lua. You can do almost anything with it.

I'm struggling to find the documentation telling me how, though :(


Thanks in advance,


Antony.

-- 
"It would appear we have reached the limits of what it is possible to achieve 
with computer technology, although one should be careful with such statements; 
they tend to sound pretty silly in five years."

 - John von Neumann (1949)

                                                   Please reply to the list;
                                                         please *don't* CC me.



More information about the FreeSWITCH-users mailing list