Difference between revisions of "XML Handler"

From FusionPBX
Jump to: navigation, search
(added languages tag)
 
(12 intermediate revisions by 5 users not shown)
Line 4: Line 4:
  
 
==XML not saved to the file system==
 
==XML not saved to the file system==
; Tell FusionPBX not to write XML configuration files for dialplans and extensions
+
Tell FusionPBX not to write XML configuration files for dialplans and extensions
 
: Navigate to '''Advanced''' -> '''Default Settings'''
 
: Navigate to '''Advanced''' -> '''Default Settings'''
: Under '''Switch''', set '''dialplans''' and '''extensions''' to false
+
: Under '''Switch''', set '''dialplans''' and '''extensions''' and '''sip profiles''' to false
  
 
==Remove the XML files==
 
==Remove the XML files==
; Remove the XML files in FreeSWITCH
+
Remove the XML files in FreeSWITCH
: Move or delete all XML files in conf/dialplans and conf/directory
+
: Move or delete all XML files in conf/dialplans, conf/directory, and conf/sip_profiles
: Add an empty file (named empty.xml or such) to conf/dialplans and conf/directory
+
: Add an empty file (named empty.xml or such) to conf/dialplans, conf/directory, and conf/sip_profiles
  
==Lua configured for xml_handler==
+
==Configure Lua to use the xml_handler==
; Tell FreeSWITCH to load the dialplan and directory from lua
+
Tell FreeSWITCH to load the dialplan and directory from lua
 
: In conf/autoload_configs/lua.conf.xml, add:
 
: In conf/autoload_configs/lua.conf.xml, add:
:: <code><param name="xml-handler-script" value="app.lua xml_handler"/>
+
  <code><param name="xml-handler-script" value="app.lua xml_handler"/>
:: <param name="xml-handler-bindings" value="dialplan,directory"/></code>
+
  <param name="xml-handler-bindings" value="configuration,dialplan,directory"/></code>
 +
 
 +
If you wish to tell FreeSWITCH to handle languages (phrases) via lua you will need to also add the language tag as below
 +
: In conf/autoload_configs/lua.conf.xml, change:
 +
  <code><param name="xml-handler-bindings" value="configuration,dialplan,directory"/></code>
 +
: to:
 +
  <code><param name="xml-handler-bindings" value="configuration,dialplan,directory,languages"/></code>
 +
 
 +
on Debian this is located
 +
: In /etc/fusionpbx/switch/conf/autoload_configs/lua.conf.xml
  
 
==Restart FreeSWITCH==
 
==Restart FreeSWITCH==
  
 
Now all dialplan and directory entries will be queried from the database via the lua handler script.
 
Now all dialplan and directory entries will be queried from the database via the lua handler script.
 +
==Debugging==
 +
vim /usr/local/freeswitch/scripts/app/xml_handler/index.lua
 +
 +
On Debian Pkg install the file is located
 +
/var/lib/fusionpbx/scripts/app/xml_handler/index.lua
 +
 +
Turn true|false as required.
 +
<pre>
 +
--set the debug options
 +
        debug["params"] = true;
 +
        debug["sql"] = true;
 +
        debug["xml_request"] = true;
 +
        debug["xml_string"] = true;
 +
        debug["cache"] = true;
 +
</pre>

Latest revision as of 10:10, 24 November 2015

FusionPBX allows for many of the FreeSWITCH XML configuration files can be generated on the fly from the FusionPBX database. Currently, the Dialplan and Directory configuration files can be completely replaced.

To enable this functionality:

XML not saved to the file system

Tell FusionPBX not to write XML configuration files for dialplans and extensions

Navigate to Advanced -> Default Settings
Under Switch, set dialplans and extensions and sip profiles to false

Remove the XML files

Remove the XML files in FreeSWITCH

Move or delete all XML files in conf/dialplans, conf/directory, and conf/sip_profiles
Add an empty file (named empty.xml or such) to conf/dialplans, conf/directory, and conf/sip_profiles

Configure Lua to use the xml_handler

Tell FreeSWITCH to load the dialplan and directory from lua

In conf/autoload_configs/lua.conf.xml, add:
 <param name="xml-handler-script" value="app.lua xml_handler"/>
 <param name="xml-handler-bindings" value="configuration,dialplan,directory"/>

If you wish to tell FreeSWITCH to handle languages (phrases) via lua you will need to also add the language tag as below

In conf/autoload_configs/lua.conf.xml, change:
 <param name="xml-handler-bindings" value="configuration,dialplan,directory"/>
to:
 <param name="xml-handler-bindings" value="configuration,dialplan,directory,languages"/>

on Debian this is located

In /etc/fusionpbx/switch/conf/autoload_configs/lua.conf.xml

Restart FreeSWITCH

Now all dialplan and directory entries will be queried from the database via the lua handler script.

Debugging

vim /usr/local/freeswitch/scripts/app/xml_handler/index.lua

On Debian Pkg install the file is located

/var/lib/fusionpbx/scripts/app/xml_handler/index.lua

Turn true|false as required.

--set the debug options
        debug["params"] = true;
        debug["sql"] = true;
        debug["xml_request"] = true;
        debug["xml_string"] = true;
        debug["cache"] = true;