Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

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


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
Antony.Stone at freesw...
Guest





PostPosted: Tue Nov 30, 2021 9:12 am    Post subject: [Freeswitch-users] Serving sofia.conf via lua (updated, part Reply with quote

On Tuesday 30 November 2021 at 11:20:02, Antony Stone wrote:

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

I've worked out what the problem was, even before my question/s appear to have
reached the list!?

It turns out that I needed to move:

<load module="mod_lua"/>

much higher up in /etc/freeswitch/autoload_configs/modules.conf.xml so that it
got loaded before:

<load module="mod_sofia"/>

After that, my lua script's configuration does get used to configure sofia :)

(This seems like either missing documentation, or even an inappropriate
default setting to me - after all, in what circumstance would it be better to
load lua after nearly everything else, given that it can be used to actually
configure everything else and is then needed first?)


Anyway, I now have another problem.

If I take my (static, nothing fancy yet) and monolithic sofia configuration file
and put it into /etc/freeswitch/autoload_configs/sofia.conf.xml (and disable
lua) then it does what I expect and all works.

If I take the same file and put it into my lua script (correctly enclosed
within the extra <document> and <section> tags), then it does get loaded, but
it produces errors relating to some of the variables pre-defined in vars.xml.

So, for example, one of my SIP profiles contains:

<param name="rtp-ip" value="$${local_ip_v4}"/>
<param name="sip-ip" value="$${local_ip_v4}"/>

This produces (when sofia gets loaded) the error messages:

--------
tport.c:1844 tport_server_addrinfo() tport_server_addrinfo(0x56318f75ee20):
su_getaddrinfo($${local_ip_v4}, 5080) for *: Name or service not known

nta.c:2276 nta_agent_add_tport() nta:
bind($${local_ip_v4}:5080;transport=*;maddr=$${local_ip_v4}): No such file or
directory

nua_stack.c:195 nua_stack_init() nua: initializing SIP stack failed
--------

Inside the console fs_cli I can do:

eval $${local_ip_v4}

and it gives me the correct answer.


If I replace $${local_ip_v4} in the xml configuration delivered by lua with the
numeric IP address, then sofia loads and works as it did with the plain XML file
in /etc/freeswitch/autoload_configs/sofia.conf.xml

However, I see that some other variables, also defined in vars.xml, are being
correctly interpreted and used from the XML provided by lua, so this isn't a
consistent "you can't reference variables" problem.


Does anyone have a clue what I need to do to fix this?


Thanks,


Antony.

--
I bought a book about anti-gravity. The reviews say you can't put it down.

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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Tue Nov 30, 2021 10:44 am    Post subject: [Freeswitch-users] Serving sofia.conf via lua (updated, part Reply with quote

On Tuesday 30 November 2021 at 14:17:47, Antony Stone wrote:

Quote:
If I take my (static, nothing fancy yet) and monolithic sofia configuration
file and put it into /etc/freeswitch/autoload_configs/sofia.conf.xml (and
disable lua) then it does what I expect and all works.

If I take the same file and put it into my lua script (correctly enclosed
within the extra <document> and <section> tags), then it does get loaded,
but it produces errors relating to some of the variables pre-defined in
vars.xml.

<...snip...>

Quote:
However, I see that some other variables, also defined in vars.xml, are
being correctly interpreted and used from the XML provided by lua, so this
isn't a consistent "you can't reference variables" problem.

I'm no longer so sure about *any* of the variables working correctly.

I've now converted the static XML being served by lua into something which
does the database lookups which I needed lua for in the first place, and that
is working very nicely, however any variables included in the XML output are
not being interpreted when the configuration is actually used by Freeswitch.

Does that mean that variables (for example, defined in vars.xml) simply cannot
be used in XML when that XML comes from lua instead of being in a standard
file?

What's the way round this, so that I can use the values variables as normal in
a configuration file, when the configuration is being generated by lua?


Thanks,


Antony.

--
Pavlov is in the pub enjoying a pint.
The barman rings for last orders, and Pavlov jumps up exclaiming "Damn! I
forgot to feed the dog!"

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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
Antony.Stone at freesw...
Guest





PostPosted: Wed Dec 01, 2021 10:22 am    Post subject: [Freeswitch-users] Serving sofia.conf via lua (updated, part Reply with quote

On Tuesday 30 November 2021 at 15:55:11, Antony Stone wrote:

Quote:
I've now converted the static XML being served by lua into something which
does the database lookups which I needed lua for in the first place, and
that is working very nicely, however any variables included in the XML
output are not being interpreted when the configuration is actually used
by Freeswitch.

Does that mean that variables (for example, defined in vars.xml) simply
cannot be used in XML when that XML comes from lua instead of being in a
standard file?

I found http://lists.freeswitch.org/pipermail/freeswitch-users/2011-
October/077171.html which explains how to do this, and I couldn't find this
clue anywhere in the documentation at https://freeswitch.org/confluence/


Antony.

--
Warum können Seeräuber nicht den Umfang eines Kreises berechnen?
Weil sie Piraten...


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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services