[Freeswitch-users] Serving sofia.conf via lua (updated)

Seven Du dujinfang at gmail.com
Sun Dec 5 00:56:11 UTC 2021


https://github.com/seven1240/xui it is outdated and stopped updating. but
the lua scripts should still work.

On Tue, Nov 30, 2021 at 10:08 PM Antony Stone <
Antony.Stone at freeswitch.open.source.it> wrote:

> Hi.
>
> Sending again with a bit of clarification - my original message hasn't hit
> the
> list yet, so I'm hoping people can reply to just this one...
>
>
> 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."  Yes, I know that that page refers to
> mod_xml_curl
> and not mod_xml_lua but I'm pretty certain that the principle is the same,
> and
>
> https://freeswitch.org/confluence/display/FREESWITCH/Serving+Configuration+with+Lua
> seems to confirm this, although is it much thinner on examples.  I do not
> that
> this page also says "there is no Lua page yet, and Lua-related docs are
> scattered all over the place..." :(
>
> So, anyway, 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.
>
> _________________________________________________________________________
>
> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN
> services.
> Build your next product on our scalable cloud platform.
>
> Join our online community to chat in real time
> https://signalwire.community
>
> Professional FreeSWITCH Services
> sales at freeswitch.com
> https://freeswitch.com
>
> Official FreeSWITCH Sites
> https://freeswitch.com/oss
> https://freeswitch.org/confluence
> https://cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> https://freeswitch.com



-- 
About: http://about.me/dujinfang
Blog: http://www.dujinfang.com
Proj:  http://www.freeswitch.org.cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20211205/4e182c07/attachment.html>


More information about the FreeSWITCH-users mailing list