Skip to content

Commit

Permalink
xmlrpc: docs for event_callback parameter
Browse files Browse the repository at this point in the history
- GH #1736

(cherry picked from commit d74d679)
  • Loading branch information
surendratiwari3 authored and miconda committed Nov 27, 2018
1 parent 260ac29 commit 0387df5
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion src/modules/xmlrpc/doc/xmlrpc_admin.xml
Expand Up @@ -60,7 +60,7 @@ modparam("xmlrpc", "route", "route_for_xmlrpcs")
<section id="autoconversion">
<title><varname>autoconversion</varname> (string)</title>
<para>
Enable or disable automatic parameter type conversion globally,
Enable or disable automatic parameter type conversion globally,
for all the methods parameters.
If on, a type mismatch in a method parameter
will not cause a fault if it is possible to automatically
Expand Down Expand Up @@ -192,6 +192,45 @@ modparam("xmlrpc", "url_match", "^/RPC2")
</programlisting>
</example>
</section>
<section id="event_callback">
<title><varname>event_callback</varname> (string)</title>
<para>
The name of the function in the kemi configuration file (embedded
scripting language such as Lua, Python, ...) to be executed instead
of route blocks defined by route parameter for xmlrpc request.
</para>
<para>
This route will be called only for HTTP messages whose method is
either GET or POST. The message visible inside the route
will be a HTTP request converted to SIP (the uri will be fixed and
a fake via will be added).
</para>
<para>
The route should perform additional security checks to
ensure the client is authorized to execute management/RPC functions
and then it should call the <function>dispatch_rpc()</function>.
</para>
<example>
<title>Set <varname>event_callback</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("xmlrpc", "event_callback", "ksr_xmlrpc_event")
...
-- event callback function implemented in Lua
function ksr_xmlrpc_event(evname)
KSR.info("===== xmlrpc triggered event: " .. evname .. "\n");
local rpc_method = KSR.pv.get("$rm") or ""
if ((rpc_method == "POST" or rpc_method == "GET")) then
if (KSR.xmlrpc.dispatch_rpc() &lt; 0) then
KSR.err("error while executing xmlrpc event")
end
end
return 1;
end
...
</programlisting>
</example>
</section>
</section>
<section>

Expand Down

0 comments on commit 0387df5

Please sign in to comment.