[Freeswitch-users] Trying to load xml using mod_python3
Adrian Fretwell
adrian at a2es.co.uk
Sat Nov 12 20:50:51 UTC 2022
Hello All,
I have been stuck on this for a few days now and need some help.
I understand that the "params" parameter passed to my xml_fetch(params)
function should contain a switch event but I never get anything else but
params being a NoneType (i.e. not set). The function is being called
but I have no idea of what xml is being requested.
Can anyone give me any leads as to how I can load configuration using
python?
Setup below:
In autoload_configs/python.conf.xml I have:
<configuration name="python.conf" description="PYTHON Configuration">
<settings>
<param name="xml-handler-script" value="ahf1"/>
<param name="xml-handler-bindings"
value="configuration,dialplan,directory"/>
</settings>
</configuration>
In ahf1.py I have:
# BIND TO AN XML LOOKUP
#
# default name for binding to an XML lookup is "xml_fetch" it can be
overridden with <modname>::<function>
# params a switch_event with all the relevant data about what is being
searched for in the XML registry.
#
def xml_fetch(params):
<snip>
if not params:
consoleLog("info", 'ahf: No params\n')
return xml
purpose = Event.getHeader(params, 'purpose')
profile = Event.getHeader(params, 'profile')
key = Event.getHeader(params, 'key')
consoleLog("info", 'ahfp1: ' + purpose + '\n')
consoleLog("info", 'ahfp2: ' + profile + '\n')
consoleLog("info", 'ahfp3: ' + key + '\n')
return xml
Many thanks & kind regards,
Adrian Fretwell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20221112/95fa6d20/attachment.html>
More information about the FreeSWITCH-users
mailing list