Module: sip-router
Branch: master
Commit: cf593d2fd64bcc6a04526beaa228b028e065d304
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cf593d2…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Sep 24 18:20:54 2009 +0200
mi_rpc: doc update
- async mi commands supported
- added the list of the various rpc mi commands versions (mi,
mi_dg, mi_xmlrpc and mi_fifo).
---
modules/mi_rpc/README | 73 ++++++++++++++++++++++++-----------
modules/mi_rpc/doc/mi_rpc_admin.xml | 37 ++++++++++++++---
2 files changed, 80 insertions(+), 30 deletions(-)
diff --git a/modules/mi_rpc/README b/modules/mi_rpc/README
index d2d0fff..5739c28 100644
--- a/modules/mi_rpc/README
+++ b/modules/mi_rpc/README
@@ -18,55 +18,84 @@ Daniel-Constantin Mierla
1. Admin Guide
- 1.1. Overview
- 1.2. Dependencies
+ 1. Overview
+ 2. Dependencies
- 1.2.1. Kamailio Modules
- 1.2.2. External Libraries or Applications
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
- 1.3. Exported Parameters
- 1.4. Exported Functions
- 1.5. Exported RPC commands
+ 3. Exported Parameters
+ 4. Exported Functions
+ 5. Exported RPC commands
- 1.5.1. mi
+ 5.1. mi mi_dg mi_fifo mi_xmlrpc
Chapter 1. Admin Guide
-1.1. Overview
+ Table of Contents
+
+ 1. Overview
+ 2. Dependencies
+
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
+
+ 3. Exported Parameters
+ 4. Exported Functions
+ 5. Exported RPC commands
+
+ 5.1. mi mi_dg mi_fifo mi_xmlrpc
+
+1. Overview
The module exports a RPC command to execute MI commands.
The other way around not implemented (MI command to execute RPC) -- to
- be investigated if worth the effort. Also, execution of asynchronous MI
- command is not yet supported.
+ be investigated if worth the effort.
+
+2. Dependencies
-1.2. Dependencies
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
-1.2.1. Kamailio Modules
+2.1. Kamailio Modules
The following modules must be loaded before this module:
* No dependencies on other Kamailio modules.
-1.2.2. External Libraries or Applications
+2.2. External Libraries or Applications
The following libraries or applications must be installed before
running Kamailio with this module loaded:
* None.
-1.3. Exported Parameters
+3. Exported Parameters
none
-1.4. Exported Functions
+4. Exported Functions
none
-1.5. Exported RPC commands
+5. Exported RPC commands
+
+ 5.1. mi mi_dg mi_fifo mi_xmlrpc
-1.5.1. mi
+5.1. mi mi_dg mi_fifo mi_xmlrpc
Execute a MI command.
+ Depending on the version (e.g. mi, mi_dg) it formats the output in a
+ similar way to the corresponding kamailio mi module:
+ * mi - uses a special, "pretty" format which generates nicer (more
+ readable) output when used with sercmd.
+ * mi_dg - uses an output format similar to the kamailio mi_datagram
+ module.
+ * mi_fifo - uses an output format similar to the kamailio mi_fifo
+ module.
+ * mi_xmlrpc - uses an output format similar to the kamailio mi_xmlrpc
+ module.
+
Name: mi
Parameters:
@@ -77,8 +106,6 @@ Chapter 1. Admin Guide
Example using 'sercmd':
sercmd> mi uptime
-200 OK
-
-+ Now:: Sun Jun 28 12:45:37 2009
-+ Up since:: Sun Jun 28 12:24:27 2009
-+ Up time:: 1270 [sec]
+Now:: Thu Sep 24 18:17:15 2009
+Up since:: Thu Sep 24 17:35:45 2009
+Up time:: 2490 [sec]
diff --git a/modules/mi_rpc/doc/mi_rpc_admin.xml b/modules/mi_rpc/doc/mi_rpc_admin.xml
index 98b7987..514ddd6 100644
--- a/modules/mi_rpc/doc/mi_rpc_admin.xml
+++ b/modules/mi_rpc/doc/mi_rpc_admin.xml
@@ -20,8 +20,7 @@
</para>
<para>
The other way around not implemented (MI command to execute RPC)
- -- to be investigated if worth the effort. Also, execution of
- asynchronous MI command is not yet supported.
+ -- to be investigated if worth the effort.
</para>
</section>
@@ -69,11 +68,37 @@
<section>
<title>
<function moreinfo="none">mi</function>
+ <function moreinfo="none">mi_dg</function>
+ <function moreinfo="none">mi_fifo</function>
+ <function moreinfo="none">mi_xmlrpc</function>
</title>
<para>
Execute a MI command.
</para>
<para>
+ Depending on the version (e.g. mi, mi_dg) it formats the output in a
+ similar way to the corresponding kamailio mi module:
+ <itemizedlist>
+ <listitem>
+ <function>mi</function> - uses a special, "pretty" format
+ which generates nicer (more readable) output when used with
+ sercmd.
+ </listitem>
+ <listitem>
+ <function>mi_dg</function> - uses an output format similar to
+ the kamailio mi_datagram module.
+ </listitem>
+ <listitem>
+ <function>mi_fifo</function> - uses an output format similar
+ to the kamailio mi_fifo module.
+ </listitem>
+ <listitem>
+ <function>mi_xmlrpc</function> - uses an output format similar
+ to the kamailio mi_xmlrpc module.
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
Name: <emphasis>mi</emphasis>
</para>
<para>Parameters:</para>
@@ -90,11 +115,9 @@
</para>
<programlisting format="linespecific">
sercmd> mi uptime
-200 OK
-
-+ Now:: Sun Jun 28 12:45:37 2009
-+ Up since:: Sun Jun 28 12:24:27 2009
-+ Up time:: 1270 [sec]
+Now:: Thu Sep 24 18:17:15 2009
+Up since:: Thu Sep 24 17:35:45 2009
+Up time:: 2490 [sec]
</programlisting>
</section>
</section>
Hello,
I am not sure if everybody is aware of that, but the sip-router core
has inherited a standalone configuration file parser from SER. The
parser lives in files cfg_parser.[ch] and can be used to parse
configuration files of form:
# comment...
[section]
name1 = value1
name2 = value2
...
The format of section identifiers as well as the format of
configuration values are extensible it can be anything from booleans,
integers, strings, and even more complicated compound formats of your
own.
Two SER modules currently use the parser. The tls module uses it to
parse standalone configuration files with TLS related configuration.
The ldap SER module uses the parser to parse a configuration file that
maps LDAP objects to tables and columns for the database API.
Here is an example of a non-trivial configuration file the parse can parse:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob_plain;f=mo…
Some documentation can be found in file sip_router/cfg_parser.c.
For examples how to use it have a look at the following files:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules_…http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules/…
Jan.
with latest additions that andrei made to s xmlrpc module, i now managed
to get click-to-dial to work using tm.t_uac_wait.
however, one new issue appeared. each time i call t_uac_wait over
xmlrpc, i get to syslog:
Sep 23 18:06:37 localhost /usr/sbin/sip-proxy[18399]: INFO: Handling XMLRPC POST
from <127.0.0.1>
Sep 23 18:06:37 localhost /usr/sbin/sip-proxy[18399]: WARNING: <core> [tcp_read.
c:969]: WARNING: tcp_receive: handle_io: F_TCPCONN connection marked as bad: 0xb
3399dc8 id 51 refcnt 1
it does not seem to have any effect in operation of t_uac_wait. any
idea why that comes and how to get rid of it?
my xmlrpc_requests route looks like this:
route [xmlrpc_requests] { # Handle XMLRPC requests
xlog("L_INFO", "Handling XMLRPC $rm from <$si>\n");
set_reply_no_connect(); # optional
set_reply_close();
dispatch_rpc();
return;
}
-- juha
here is my current list of open problems:
- this warning needs to go away:
Sep 2 21:00:18 localhost sip-router: WARNING: tm [tm.c:502]: WARNING:
on_sl_reply("stateless_reply"): empty/non existing route
when onreply_route [stateless_reply] exist.
- tm.t_uac_wait over xmlrpc generates warning:
Sep 23 18:06:37 localhost /usr/sbin/sip-proxy[18399]: WARNING: <core> [tcp_read.
c:969]: WARNING: tcp_receive: handle_io: F_TCPCONN connection marked as bad: 0xb
3399dc8 id 51 refcnt 1
- not all processes die on sr restart (waiting it to happen again to get
more info).
-- juha
ps. i hope that i'm not the only user currently testing sr, because i
haven't seen many problems reports from other people? if i am, i need a
plan b.
in k or openser there used to be a local_route block that was executed
for locally generated requests, such as those triggered by t_uac_dlg
mi command.
the question is, what is the equivalent in sr? when issuing, for
example, invite using tm.t_uac_wait, i need to be able to set invite
timeout using t_set_fr() call.
there exists onsend_route, but according to wiki, it does not apply:
This route is executed only when forwarding requests - it is not
executed for replies, retransmissions, or locally generated messages
(e.g. via fifo uac).
-- juha
Module: sip-router
Branch: master
Commit: 07599b8befbc37f37372c64b83e84bbc1164e1cd
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=07599b8…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Sep 23 16:19:11 2009 +0200
xmlrpc(s): doc updated
- escape_cr and double_lf_to_crlf documented
---
modules_s/xmlrpc/README | 45 ++++++++++++++++++++++++++++++++++-
modules_s/xmlrpc/doc/params.xml | 49 +++++++++++++++++++++++++++++++++++++++
modules_s/xmlrpc/doc/xmlrpc.xml | 10 ++++++++
3 files changed, 102 insertions(+), 2 deletions(-)
diff --git a/modules_s/xmlrpc/README b/modules_s/xmlrpc/README
index d1abb54..fed4a70 100644
--- a/modules_s/xmlrpc/README
+++ b/modules_s/xmlrpc/README
@@ -22,6 +22,8 @@ Jan Janak
1.5.1. route (string)
1.5.2. autoconversion (string)
+ 1.5.3. escape_cr (integer)
+ 1.5.4. double_lf_to_crlf (integer)
1.6. Functions
@@ -473,6 +475,14 @@ route[XMLRPC]{
dispatch_rpc();
}
+ Another common problem is CRLF handling. According to the xml spec CR
+ ('\r') must be escaped (to 
) or they will be "normalized" when
+ parsing the xml document. However some xmlrpc clients do not follow
+ this rule (e.g. clients based on the python or php xmlrpclib) and send
+ CRLF unescaped. A possible workaround is to enable automatic LFLF to
+ CRLF conversion (using the double_lf_to_crlf modules parameter) and
+ replace CRLF with LFLF in the client queries.
+
1.4. Client Examples
* examples/xmlrpc_test.pl (basic perl application that builds and
@@ -524,6 +534,37 @@ modparam("xmlrpc", "route", "route_for_xmlrpcs")
Example 3. Set the autoconversion parameter
modparam("xmlrpc", "autoconversion", 1)
+1.5.3. escape_cr (integer)
+
+ Enable CR ('\r') escaping in replies. If enabled each '\r' in the
+ xmlrpc reply will be replaced with "
", according to the xml spec.
+
+ It should be turned off only if you suspect interoperability problems
+ with older clients.
+
+ Default: on.
+
+ Example 4. Set the escape_cr parameter
+modparam("xmlrpc", "escape_cr", 1)
+
+1.5.4. double_lf_to_crlf (integer)
+
+ When enabled double LFs ('\n\n') in the input xmlrpc strings will be
+ replaced with CR LF ('\r\n'). This makes LF LF behave like an escape
+ character for CR LF and is needed for compatibility with kamailio tools
+ and to work around buggy xmlrpc clients that don't escape the CR in CR
+ LF ('\r' should be escaped to "
" otherwise according to the xml
+ spec "\r\n" will be transformed to '\n'), but need to send CR LF in the
+ strings (e.g. they use tm.t_uac_wait).
+
+ Note: when this option is turned on, there is no way to send a double
+ LF ('\n\n'), it will always be transformed in CR LF ('\r\n').
+
+ Default: off.
+
+ Example 5. Set the double_lf_to_crlf parameter
+modparam("xmlrpc", "double_lf_to_crlf", 1)
+
1.6. Functions
Revision History
@@ -545,7 +586,7 @@ modparam("xmlrpc", "autoconversion", 1)
function with matching name. If such a function is found then
dispatch_rpc() will pass control to the function to handle the request.
- Example 4. dispatch_rpc usage
+ Example 6. dispatch_rpc usage
#...
modparam("xmlrpc", "route", "XMLRPC");
#...
@@ -561,7 +602,7 @@ route[XMLRPC]{
This function can be called from the config script to directly generate
an XML-RPC reply.
- Example 5. xmlrpc_reply usage
+ Example 7. xmlrpc_reply usage
#...
modparam("xmlrpc", "route", "XMLRPC");
#...
diff --git a/modules_s/xmlrpc/doc/params.xml b/modules_s/xmlrpc/doc/params.xml
index be7fd63..f200b55 100644
--- a/modules_s/xmlrpc/doc/params.xml
+++ b/modules_s/xmlrpc/doc/params.xml
@@ -67,6 +67,55 @@ modparam("xmlrpc", "autoconversion", 1)
</example>
</section>
+ <section id="escape_cr">
+ <title><varname>escape_cr</varname> (integer)</title>
+ <para>
+ Enable CR ('\r') escaping in replies. If enabled each '\r' in the
+ xmlrpc reply will be replaced with "&#xD;", according to the
+ xml spec.
+ </para>
+ <para>
+ It should be turned off only if you suspect interoperability problems
+ with older clients.
+ </para>
+ <para>
+ Default: on.
+ </para>
+ <example>
+ <title>Set the <varname>escape_cr</varname> parameter</title>
+ <programlisting>
+modparam("xmlrpc", "escape_cr", 1)
+ </programlisting>
+ </example>
+ </section>
+
+ <section id="double_lf_to_crlf">
+ <title><varname>double_lf_to_crlf</varname> (integer)</title>
+ <para>
+ When enabled double LFs ('\n\n') in the input xmlrpc strings
+ will be replaced with CR LF ('\r\n'). This makes LF LF behave like
+ an escape character for CR LF and is needed for compatibility with
+ kamailio tools and to work around buggy xmlrpc clients that don't
+ escape the CR in CR LF ('\r' should be escaped to "&#xD;"
+ otherwise according to the xml spec "\r\n" will be transformed to
+ '\n'), but need to send CR LF in the strings (e.g. they use
+ <function>tm.t_uac_wait</function>).
+ </para>
+ <para>
+ Note: when this option is turned on, there is no way to send a double
+ LF ('\n\n'), it will always be transformed in CR LF ('\r\n').
+ </para>
+ <para>
+ Default: off.
+ </para>
+ <example>
+ <title>Set the <varname>double_lf_to_crlf</varname> parameter</title>
+ <programlisting>
+modparam("xmlrpc", "double_lf_to_crlf", 1)
+ </programlisting>
+ </example>
+ </section>
+
<!--
Obsolete (hardwired on in the rpc core functions, cannot be turned off)
-andrei
diff --git a/modules_s/xmlrpc/doc/xmlrpc.xml b/modules_s/xmlrpc/doc/xmlrpc.xml
index 2cdf422..81cf02a 100644
--- a/modules_s/xmlrpc/doc/xmlrpc.xml
+++ b/modules_s/xmlrpc/doc/xmlrpc.xml
@@ -699,6 +699,16 @@ route[XMLRPC]{
</programlisting>
</example>
</para>
+ <para>
+ Another common problem is CRLF handling. According to the xml spec
+ CR ('\r') must be escaped (to &#xD;) or they will be "normalized"
+ when parsing the xml document. However some xmlrpc clients do not
+ follow this rule (e.g. clients based on the python or php xmlrpclib)
+ and send CRLF unescaped. A possible workaround is to enable
+ automatic LFLF to CRLF conversion (using the
+ <varname>double_lf_to_crlf</varname> modules parameter) and replace
+ CRLF with LFLF in the client queries.
+ </para>
</section>
</section>