<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello All,</p>
<p>Apologies if this appears to be a duplicate, I don't think my
first message made it to the list.<br>
</p>
<p><br>
Can anyone clarify the process of delivering FreeSWITCH
configuration using mod_python3?<br>
<br>
In autoload_configs/python.conf.xml I have:<br>
<br>
<configuration name="python.conf" description="PYTHON
Configuration"><br>
<settings><br>
<param name="xml-handler-script" value="ahf1"/><br>
<param name="xml-handler-bindings"
value="configuration,dialplan,directory"/><br>
</settings><br>
</configuration><br>
<br>
<br>
But although the script ahf1.py gets called several times on
FreeSWITCH start up and on fs_cli reloadxml the script appears to
have no way of knowing what configuration is being asked for.<br>
<br>
If I look at the freeswitch /src/mod/languages directory on
github in mod_lua.cpp I can see that variables are set for
"section, "tag_name", "key_name", and "key_value", and a global:
XML_REQUEST is set. But in mod_python.c these variables do not
seem to be made available to the python script, there is just a
freeswitch Event that is NULL most of the time.<br>
<br>
So at the moment it seems impossible to deliver more that one
binding in a python script? Can anyone advise?<br>
<br>
In ahf1.py I have:<br>
<br>
# BIND TO AN XML LOOKUP<br>
#<br>
# default name for binding to an XML lookup is "xml_fetch" it can
be overridden with <modname>::<function><br>
# params a switch_event with all the relevant data about what is
being searched for in the XML registry.<br>
#<br>
def xml_fetch(*args):<br>
<br>
xml = '''<br>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><br>
<document type="freeswitch/xml"><br>
<section name="result"><br>
<result status="not found" /><br>
</section><br>
</document><br>
'''<br>
<br>
consoleLog("info", 'ahf: ' + str(args) + '\n')<br>
<br>
if isinstance(args[0], Event):<br>
consoleLog("info", 'ahf: Got an fs event\n')<br>
consoleLog("info", 'ahfp1: ' + str(args[0].serialize()) +
'\n')<br>
<br>
<br>
return xml<br>
<br>
Many thanks and kind regards,<br>
<br>
Adrian Fretwell</p>
<p><br>
</p>
<small><small><small>
</small></small></small>
</body>
</html>