Module: sip-router
Branch: master
Commit: 9556f8a37575c8f9a3a212f07e9fa9632116e06e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9556f8a…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Charles Chance <charles.chance(a)sipcentric.com>
Date: Wed Sep 10 00:41:48 2014 +0100
dmq: update documentation with new functions dmq_t_replicate() and dmq_is_from_node()
---
modules/dmq/README | 50 +++++++++++++++++++++++++++++++++
modules/dmq/doc/dmq_admin.xml | 61 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 111 insertions(+), 0 deletions(-)
diff --git a/modules/dmq/README b/modules/dmq/README
index 7f3fb6b..8bc19e4 100644
--- a/modules/dmq/README
+++ b/modules/dmq/README
@@ -41,6 +41,8 @@ Charles Chance
4.1. dmq_handle_message()
4.2. dmq_send_message(peer, node, body, content_type)
4.3. dmq_bcast_message(peer, body, content_type)
+ 4.4. dmq_t_replicate([skip_loop_test])
+ 4.5. dmq_is_from_node()
2. Developer Guide
@@ -63,6 +65,8 @@ Charles Chance
1.5. dmq_handle_message usage
1.6. dmq_send_message usage
1.7. dmq_bcast_message usage
+ 1.8. dmq_t_replicate usage
+ 1.9. dmq_is_from_node usage
2.1. dmq_api_t structure
2.2. register_dmq_peer usage
2.3. bcast_message usage
@@ -90,6 +94,8 @@ Chapter 1. Admin Guide
4.1. dmq_handle_message()
4.2. dmq_send_message(peer, node, body, content_type)
4.3. dmq_bcast_message(peer, body, content_type)
+ 4.4. dmq_t_replicate([skip_loop_test])
+ 4.5. dmq_is_from_node()
1. Overview
@@ -183,6 +189,8 @@ modparam("dmq", "ping_interval", 90)
4.1. dmq_handle_message()
4.2. dmq_send_message(peer, node, body, content_type)
4.3. dmq_bcast_message(peer, body, content_type)
+ 4.4. dmq_t_replicate([skip_loop_test])
+ 4.5. dmq_is_from_node()
4.1. dmq_handle_message()
@@ -234,6 +242,48 @@ text/plain");
dmq_bcast_message("peer_name", "Message body...",
"text/plain");
...
+4.4. dmq_t_replicate([skip_loop_test])
+
+ Replicates the current SIP message to all active nodes (except self).
+ Useful for replicating REGISTER, PUBLISH etc. in a clustered
+ environment.
+
+ Meaning of parameters:
+ * skip_loop_test - by default, DMQ checks the source IP of the
+ message prior to replication, to ensure it has not been sent by
+ another DMQ node (to avoid infinite loops). If this optional
+ parameter is set to "1", the loop test is not performed. This makes
+ sense, from a performance perspective, if you have already
+ performed the necessary checks in the config script (see
+ dmq_is_from_node()).
+
+ This function can be used from REQUEST_ROUTE only.
+
+ Example 1.8. dmq_t_replicate usage
+...
+ dmq_t_replicate();
+...
+
+4.5. dmq_is_from_node()
+
+ Checks whether the current message has been sent by another DMQ node in
+ the cluster.
+
+ This function can be used from REQUEST_ROUTE only.
+
+ Example 1.9. dmq_is_from_node usage
+...
+ # Example REGISTER block
+ if (dmq_is_from_node()) {
+ # Already authenticated, just save contact...
+ } else {
+ # Authenticate, save contact etc.
+ # Assuming all successful...
+ dmq_t_replicate("1"); # Already checked source, don't
perform lo
+op test again
+ }
+...
+
Chapter 2. Developer Guide
Table of Contents
diff --git a/modules/dmq/doc/dmq_admin.xml b/modules/dmq/doc/dmq_admin.xml
index 0192a21..7eabc1a 100644
--- a/modules/dmq/doc/dmq_admin.xml
+++ b/modules/dmq/doc/dmq_admin.xml
@@ -244,6 +244,67 @@ modparam("dmq", "ping_interval", 90)
</programlisting>
</example>
</section>
+ <section id="dmq.f.dmq_t_replicate">
+ <title>
+ <function
moreinfo="none">dmq_t_replicate([skip_loop_test])</function>
+ </title>
+ <para>
+ Replicates the current SIP message to all active nodes (except self). Useful for
replicating
+ REGISTER, PUBLISH etc. in a clustered environment.
+ </para>
+ <para>Meaning of parameters:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>skip_loop_test</emphasis> - by default, DMQ checks the source
IP of the
+ message prior to replication, to ensure it has not been sent by another DMQ node
+ (to avoid infinite loops). If this optional parameter is set to "1", the
loop test
+ is not performed. This makes sense, from a performance perspective, if you have
+ already performed the necessary checks in the config script (see
dmq_is_from_node()).
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ This function can be used from REQUEST_ROUTE only.
+ </para>
+
+ <example>
+ <title><function>dmq_t_replicate</function>
usage</title>
+ <programlisting format="linespecific">
+...
+ dmq_t_replicate();
+...
+ </programlisting>
+ </example>
+ </section>
+ <section id="dmq.f.dmq_is_from_node">
+ <title>
+ <function
moreinfo="none">dmq_is_from_node()</function>
+ </title>
+ <para>
+ Checks whether the current message has been sent by another DMQ node in
the cluster.
+ </para>
+ <para>
+ This function can be used from REQUEST_ROUTE only.
+ </para>
+
+ <example>
+ <title><function>dmq_is_from_node</function>
usage</title>
+ <programlisting format="linespecific">
+...
+ # Example REGISTER block
+ if (dmq_is_from_node()) {
+ # Already authenticated, just save contact...
+ } else {
+ # Authenticate, save contact etc.
+ # Assuming all successful...
+ dmq_t_replicate("1"); # Already checked source, don't perform loop test
again
+ }
+...
+ </programlisting>
+ </example>
+ </section>
+
</section>
</chapter>