Module: sip-router
Branch: tmp/tm_async_reply_support
Commit: 8885e218ef4c187b22183bf67adfb7c60407c478
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8885e21…
Author: Richard Good <richard.good(a)smilecoms.com>
Committer: Richard Good <richard.good(a)smilecoms.com>
Date: Tue Jul 16 16:05:32 2013 +0200
modules/tm/doc: Updated documentation for TM with merged methods
---
modules/tm/doc/api.xml | 124 +-----------------------------------------------
1 files changed, 1 insertions(+), 123 deletions(-)
diff --git a/modules/tm/doc/api.xml b/modules/tm/doc/api.xml
index 7aeea5d..0a3c751 100644
--- a/modules/tm/doc/api.xml
+++ b/modules/tm/doc/api.xml
@@ -157,7 +157,7 @@ end of body
This function together with t_continue() can be used to
implement asynchronous actions: t_suspend() saves the transaction,
returns its identifiers, and t_continue() continues the
- SIP request processing. (The request processing does not continue
+ SIP request/response processing. (The request/response processing does not continue
from the same point in the script, a separate route block defined
by the parameter of t_continue() is executed instead. The reply lock
is held during the route block execution.)
@@ -262,127 +262,5 @@ end of body
</itemizedlist>
<para>Return value: 0 - success, <0 - error.</para>
</section>
-
- <section id="t_suspend_reply">
- <title>
- <function>int t_suspend_reply(struct sip_msg *msg,
- unsigned int *hash_index, unsigned int *label)</function>
- </title>
- <para>
- For programmatic use only.
- This function is the equivalent of t_continue, but used to
- suspend on SIP responses.
- This function together with t_continue_reply() can be used to
- implement asynchronous actions on responses: t_suspend() saves
- the transaction, returns its identifiers, and t_continue() continues the
- SIP response processing. (The response processing does not continue
- from the same point in the script, a separate route block defined
- by the parameter of t_continue_reply() is executed instead. The reply lock
- is held during the route block execution.)
- FR timer is ticking while the transaction is suspended, and the
- transaction's failure route is executed if t_continue() is not
- called in time.
- </para>
- <para>Meaning of the parameters is as follows:</para>
- <itemizedlist>
- <listitem>
- <para><emphasis>msg</emphasis> - SIP message pointer.
- </para>
- </listitem>
- <listitem>
- <para><emphasis>hash_index</emphasis> - transaction identifier.
- </para>
- </listitem>
- <listitem>
- <para><emphasis>label</emphasis> - transaction identifier.
- </para>
- </listitem>
- </itemizedlist>
- <para>Return value: 0 - success, <0 - error.</para>
- <para>
- Usage: Allocate a memory block for storing the transaction identifiers
- (hash_index and label), and for storing also any variable related to
- the async query. Before calling t_suspend(), register for the following
- callbacks, and pass the pointer to the allocated shared memory as
- a parameter: TMCB_ON_FAILURE, TMCB_DESTROY, and TMCB_E2ECANCEL_IN
- (in case of INVITE transaction). The async operation can be
- cancelled, if it is still pending, when TMCB_ON_FAILURE or
- TMCB_E2ECANCEL_IN is called. TMCB_DESTROY is suitable to free
- the shared memory allocated for the async and SIP transaction identifiers.
- Once the async query result is available call t_continue(), see below.
- The SIP transaction must exist before calling t_suspend(), and the module
- function calling t_suspend() should return 0 to make sure that the script
- processing does not continue.
- </para>
- </section>
-
- <section id="t_continue_reply">
- <title>
- <function>int t_continue_reply(unsigned int hash_index, unsigned int label,
- struct action *route, int branch)</function>
- </title>
- <para>
- For programmatic use only.
- This function is the equivalent of t_continue but used to
- suspend on SIP responses.
- This function is the pair of t_suspend_reply(), and is supposed
- to be called when the asynchronous query result is available.
- The function executes a route block with the saved SIP message.
- The calling application passes in the branch of the suspended
- reply when wanting to continue.
- </para>
- <para>Meaning of the parameters is as follows:</para>
- <itemizedlist>
- <listitem>
- <para><emphasis>hash_index</emphasis> - transaction identifier.
- </para>
- </listitem>
- <listitem>
- <para><emphasis>label</emphasis> - transaction identifier.
- </para>
- </listitem>
- <listitem>
- <para><emphasis>route</emphasis> - route block to execute.
- </para>
- </listitem>
- <listitem>
- <para><emphasis>branch</emphasis> - reply branch to resume.
- </para>
- </listitem>
- </itemizedlist>
- <para>Return value: 0 - success, <0 - error.</para>
- </section>
-
- <section id="t_cancel_suspend_reply">
- <title>
- <function>int t_cancel_suspend_reply(unsigned int hash_index, unsigned int label, branch)</function>
- </title>
- <para>
- For programmatic use only.
- This function is the equivalent of t_cancel_suspend but for SIP
- responses.
- This function is for revoking t_suspend_reply() from the
- same process as it was executed before. t_cancel_suspend_reply() can be
- used when something fails after t_suspend_reply() has already been executed
- and it turns out that the transcation should not have been
- suspended. The function cancels the FR timer of the transacation.
- </para>
- <para>Meaning of the parameters is as follows:</para>
- <itemizedlist>
- <listitem>
- <para><emphasis>hash_index</emphasis> - transaction identifier.
- </para>
- </listitem>
- <listitem>
- <para><emphasis>label</emphasis> - transaction identifier.
- </para>
- </listitem>
- <listitem>
- <para><emphasis>branch</emphasis> - reply branch that was suspended.
- </para>
- </listitem>
- </itemizedlist>
- <para>Return value: 0 - success, <0 - error.</para>
- </section>
</section>
</section>
Module: sip-router
Branch: master
Commit: b4c3b811d33846dd0900922bbe5a3d9472839663
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b4c3b81…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Jul 15 23:45:33 2013 +0200
ipops: documented dns_query()
---
modules/ipops/README | 36 +++++++++++++++++++-
modules/ipops/doc/ipops_admin.xml | 66 +++++++++++++++++++++++++++++++++---
2 files changed, 94 insertions(+), 8 deletions(-)
diff --git a/modules/ipops/README b/modules/ipops/README
index cd6118e..982db00 100644
--- a/modules/ipops/README
+++ b/modules/ipops/README
@@ -38,6 +38,7 @@ I
4.10. is_in_subnet (ip, subnet)
4.11. dns_sys_match_ip(hostname, ipaddr)
4.12. dns_int_match_ip(hostname, ipaddr)
+ 4.13. dns_query(hostname, pvid)
List of Examples
@@ -53,6 +54,7 @@ I
1.10. is_in_subnet usage
1.11. dns_sys_match_ip usage
1.12. dns_int_match_ip usage
+ 1.13. dns_query usage
Chapter 1. Admin Guide
@@ -79,6 +81,7 @@ Chapter 1. Admin Guide
4.10. is_in_subnet (ip, subnet)
4.11. dns_sys_match_ip(hostname, ipaddr)
4.12. dns_int_match_ip(hostname, ipaddr)
+ 4.13. dns_query(hostname, pvid)
1. Overview
@@ -132,6 +135,7 @@ Chapter 1. Admin Guide
4.10. is_in_subnet (ip, subnet)
4.11. dns_sys_match_ip(hostname, ipaddr)
4.12. dns_int_match_ip(hostname, ipaddr)
+ 4.13. dns_query(hostname, pvid)
4.1. is_ip (ip)
@@ -348,9 +352,9 @@ if (is_in_subnet("10.0.123.123", "10.0.123.1/24")) {
providing load balancing through DNS).
Parameters:
- * ipaddr - string or pseudo-variable containing the ip address.
* hostname - string or pseudo-variable containing the hostname. The
resulting IP addresses from DNS query are compared with ipaddr.
+ * ipaddr - string or pseudo-variable containing the ip address.
This function can be used from ANY_ROUTE.
@@ -372,9 +376,9 @@ if (!dns_sys_match_ip("myhost.com", "1.2.3.4")) {
in different address famililies (IPv4/6).
Parameters:
- * ipaddr - string or pseudo-variable containing the ip address.
* hostname - string or pseudo-variable containing the hostname. The
resulting IP addresses from DNS query are compared with ipaddr.
+ * ipaddr - string or pseudo-variable containing the ip address.
This function can be used from ANY_ROUTE.
@@ -384,3 +388,31 @@ if (!dns_int_match_ip("myhost.com", "1.2.3.4")) {
xdbg("ip address not associated with hostname\n");
}
...
+
+4.13. dns_query(hostname, pvid)
+
+ Store the IP addresses and their type that correspond to hostname in a
+ config variable $dns(pvid=>key).
+
+ Parameters:
+ * hostname - string or pseudo-variable containing the hostname. The
+ resulting IP addresses from DNS query are compared with ipaddr.
+ * pvid - container id for script variable.
+
+ This function can be used from ANY_ROUTE.
+
+ Example 1.13. dns_query usage
+...
+if(dns_query("test.com", "xyz"))
+{
+ xlog(" number of addresses: $dns(xyz=>count)\n");
+ xlog(" ipv4 address found: $dns(xyz=>ipv4)\n");
+ xlog(" ipv6 address found: $dns(xyz=>ipv6)\n");
+ $var(i) = 0;
+ while($var(i)<$dns(xyz=>count)) {
+ xlog(" #[$var(i)] type ($dns(xyz=>type[$var(i)]))"
+ " addr [$dns(xyz=>addr[$var(i)])]\n");
+ $var(i) = $var(i) + 1;
+ }
+}
+...
diff --git a/modules/ipops/doc/ipops_admin.xml b/modules/ipops/doc/ipops_admin.xml
index 9f3528d..bbf68cf 100644
--- a/modules/ipops/doc/ipops_admin.xml
+++ b/modules/ipops/doc/ipops_admin.xml
@@ -547,13 +547,13 @@ if (is_in_subnet("10.0.123.123", "10.0.123.1/24")) {
<itemizedlist>
<listitem>
<para>
- <emphasis>ipaddr</emphasis> - string or pseudo-variable containing the ip address.
+ <emphasis>hostname</emphasis> - string or pseudo-variable containing the hostname.
+ The resulting IP addresses from DNS query are compared with ipaddr.
</para>
</listitem>
<listitem>
<para>
- <emphasis>hostname</emphasis> - string or pseudo-variable containing the hostname.
- The resulting IP addresses from DNS query are compared with ipaddr.
+ <emphasis>ipaddr</emphasis> - string or pseudo-variable containing the ip address.
</para>
</listitem>
</itemizedlist>
@@ -596,13 +596,13 @@ if (!dns_sys_match_ip("myhost.com", "1.2.3.4")) {
<itemizedlist>
<listitem>
<para>
- <emphasis>ipaddr</emphasis> - string or pseudo-variable containing the ip address.
+ <emphasis>hostname</emphasis> - string or pseudo-variable containing the hostname.
+ The resulting IP addresses from DNS query are compared with ipaddr.
</para>
</listitem>
<listitem>
<para>
- <emphasis>hostname</emphasis> - string or pseudo-variable containing the hostname.
- The resulting IP addresses from DNS query are compared with ipaddr.
+ <emphasis>ipaddr</emphasis> - string or pseudo-variable containing the ip address.
</para>
</listitem>
</itemizedlist>
@@ -626,6 +626,60 @@ if (!dns_int_match_ip("myhost.com", "1.2.3.4")) {
</section>
+ <section id="ipops.f.dns_query">
+ <title>
+ <function moreinfo="none">dns_query(hostname, pvid)</function>
+ </title>
+
+ <para>
+ Store the IP addresses and their type that correspond to hostname
+ in a config variable $dns(pvid=>key).
+ </para>
+
+ <para>Parameters:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>hostname</emphasis> - string or pseudo-variable containing the hostname.
+ The resulting IP addresses from DNS query are compared with ipaddr.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>pvid</emphasis> - container id for script variable.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+
+ <example>
+ <title>
+ <function>dns_query</function> usage
+ </title>
+ <programlisting format="linespecific">
+...
+if(dns_query("test.com", "xyz"))
+{
+ xlog(" number of addresses: $dns(xyz=>count)\n");
+ xlog(" ipv4 address found: $dns(xyz=>ipv4)\n");
+ xlog(" ipv6 address found: $dns(xyz=>ipv6)\n");
+ $var(i) = 0;
+ while($var(i)<$dns(xyz=>count)) {
+ xlog(" #[$var(i)] type ($dns(xyz=>type[$var(i)]))"
+ " addr [$dns(xyz=>addr[$var(i)])]\n");
+ $var(i) = $var(i) + 1;
+ }
+}
+...
+ </programlisting>
+ </example>
+
+ </section>
+
</section>
</chapter>
Module: sip-router
Branch: master
Commit: 20f3846d6d39e8fd599464d1e5ce48bfec326586
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=20f3846…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Jul 15 23:32:33 2013 +0200
ipops: new function dns_query(hostname, pvid)
- store the result of dns query in a variable $dns(pvid=>key)
- dns query is using getaddrinfo()
- $dns(pvid=>key) - new pv allowing to navigate through the result of a dns query
- key can be:
- count - number of addresses
- ipv4 - set to 1 if at least one ipv4 address (otherwise 0)
- ipv6 - set to 1 if at least one ipv6 address (otherwise 0)
- addr[index] - the address as string from position index in the list (0 based indexing)
- type[index] - the type of address from position index in the list (0 based indexing), the value is 4 for ipv4 and 6 for ipv6
- example:
if(dns_query("test.com", "xyz"))
{
xlog("===== number of addresses: $dns(xyz=>count)\n");
xlog("===== ipv4 address found: $dns(xyz=>ipv4)\n");
xlog("===== ipv6 address found: $dns(xyz=>ipv6)\n");
$var(i) = 0;
while($var(i)<$dns(xyz=>count)) {
xlog("===== #[$var(i)] type ($dns(xyz=>addr[$var(i)])) addr [$dns(xyz=>addr[$var(i)])]\n");
$var(i) = $var(i) + 1;
}
}
---
modules/ipops/ipops_mod.c | 42 +++++-
modules/ipops/ipops_pv.c | 428 +++++++++++++++++++++++++++++++++++++++++++++
modules/ipops/ipops_pv.h | 39 ++++
3 files changed, 508 insertions(+), 1 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=20f…