Module: sip-router
Branch: master
Commit: d54bcfad39f6b3f79a826cab4df83bb7eea189a9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d54bcfa…
Author: Richard Fuchs <rfuchs(a)sipwise.com>
Committer: Richard Fuchs <rfuchs(a)sipwise.com>
Date: Tue Sep 9 10:30:45 2014 -0400
rtpengine: support arbitrary direction= flags for interface bridging
---
modules/rtpengine/doc/rtpengine_admin.xml | 32 ++++++++++++++++------------
modules/rtpengine/rtpengine.c | 2 +
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml
index 3a82e8b..7907fb5 100644
--- a/modules/rtpengine/doc/rtpengine_admin.xml
+++ b/modules/rtpengine/doc/rtpengine_admin.xml
@@ -334,20 +334,24 @@ rtpengine_offer();
completed.
</para></listitem>
<listitem><para>
- <emphasis>internal, external</emphasis> - these flags specify the direction of
- the &sip; message. These flags only make sense when the &rtp; proxy is running
- in bridge mode. <quote>internal</quote> corresponds to the proxy's first
- interface, <quote>external</quote> corresponds to the &rtp; proxy's
- second interface. You always have to specify two flags to define
- the incoming network and the outgoing network. For example, <quote>internal
- external</quote> should be
- used for &sip; message received from the local interface and sent out on the
- external interface, and <quote>external internal</quote> vice versa. Other
- options are <quote>internal internal</quote> and <quote>external
- external</quote>.
- So, for example if a &sip; requests is processed with <quote>internal
- external</quote> flags, the corresponding
- response must be processed with <quote>internal external</quote> flags.
+ <emphasis>direction=...</emphasis> - this option specifies a logical network
+ interface and should be given exactly twice. It enables &rtp; bridging between
+ different addresses or networks of the same family (e.g. IPv4 to IPv4). The
+ first instance of the option
+ specifies the interface that the originator of this message should be using,
+ while the second instance specifies the interface that the target should be
+ using. For example, if the &sip; message was sent by an endpoint on a private
+ network and will be sent to an endpoint on the public internet, you would use
+ <quote>direction=priv direction=pub</quote> if those two logical network
+ interfaces were called <quote>priv</quote> and <quote>pub</quote> in your
+ &rtp; proxy's configuration respectively. The direction must only be specified
+ in for initial &sdp; offer; answers or subsequent offers can omit this option.
+ </para></listitem>
+ <listitem><para>
+ <emphasis>internal, external</emphasis> - shorthand for
+ <quote>direction=internal</quote> and <quote>direction=external</quote>
+ respectively. Useful for brevity or as legacy option if the &rtp; proxy only
+ supports two network interfaces instead of multiple, arbitrarily named ones.
</para></listitem>
<listitem><para>
<emphasis>auto-bridge</emphasis> - this flag an alternative to the
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index e47c2ea..063e3d1 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -1240,6 +1240,8 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu
ng_flags->transport = 0x103;
goto next;
}
+ else if (str_eq(&key, "direction"))
+ bencode_list_add_str(ng_flags->direction, &val);
break;
case 10:
Module: sip-router
Branch: master
Commit: 4776b44ea9c5546c37fea9f3886148a17c735fe5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4776b44…
Author: Elena-Ramona Modroiu <ramona(a)asipto.com>
Committer: Elena-Ramona Modroiu <ramona(a)asipto.com>
Date: Tue Sep 9 15:24:47 2014 +0200
htable: documentation for iterator functions
---
modules/htable/README | 73 ++++++++++++++++++++++++++++
modules/htable/doc/htable_admin.xml | 91 +++++++++++++++++++++++++++++++++++
2 files changed, 164 insertions(+), 0 deletions(-)
diff --git a/modules/htable/README b/modules/htable/README
index 7a7c3cf..5a27593 100644
--- a/modules/htable/README
+++ b/modules/htable/README
@@ -61,6 +61,9 @@ Ovidiu Sas
4.4. sht_reset(htable)
4.5. sht_lock(htable=>key)
4.6. sht_unlock(htable=>key)
+ 4.7. sht_iterator_start(iname, hname)
+ 4.8. sht_iterator_end(iname)
+ 4.9. sht_iterator_next(iname)
5. Exported pseudo-variables
6. MI Commands
@@ -109,6 +112,9 @@ Ovidiu Sas
1.20. sht_reset usage
1.21. sht_lock usage
1.22. sht_unlock usage
+ 1.23. sht_iterator_start usage
+ 1.24. sht_iterator_end usage
+ 1.25. sht_iterator_next usage
Chapter 1. Admin Guide
@@ -145,6 +151,9 @@ Chapter 1. Admin Guide
4.4. sht_reset(htable)
4.5. sht_lock(htable=>key)
4.6. sht_unlock(htable=>key)
+ 4.7. sht_iterator_start(iname, hname)
+ 4.8. sht_iterator_end(iname)
+ 4.9. sht_iterator_next(iname)
5. Exported pseudo-variables
6. MI Commands
@@ -606,6 +615,9 @@ modparam("htable", "enable_dmq", 1)
4.4. sht_reset(htable)
4.5. sht_lock(htable=>key)
4.6. sht_unlock(htable=>key)
+ 4.7. sht_iterator_start(iname, hname)
+ 4.8. sht_iterator_end(iname)
+ 4.9. sht_iterator_next(iname)
4.1. sht_print()
@@ -682,6 +694,67 @@ $sht(ha=>test) = $sht(ha=>test) + 10;
sht_unlock("ha=>test");
...
+4.7. sht_iterator_start(iname, hname)
+
+ Start an iterator for hash table named by the value of parameter hname.
+ The parameter iname is used to identify the iterator. There can be up
+ to 4 iterators at the same time, with different name.
+
+ Both parameters can be dynamic strings with variables.
+
+ IMPORTANT: the slot of the hash table is left locked when retrieving in
+ item. Therefore be sure you do not update the content of the hash table
+ in between sht_iterator_start() and sht_iterator_end(), because it may
+ end up in dead lock.
+
+ This function can be used from ANY_ROUTE.
+
+ Example 1.23. sht_iterator_start usage
+...
+sht_iterator_start("i1", "h1");
+...
+
+4.8. sht_iterator_end(iname)
+
+ Close the iterator identified by iname parameter and release the hash
+ table slot aquired by the iterator. The iname value must be the same
+ used for sht_iterator_start().
+
+ The parameter can be dynamic string with variables.
+
+ This function can be used from ANY_ROUTE.
+
+ Example 1.24. sht_iterator_end usage
+...
+sht_iterator_end("i1");
+...
+
+4.9. sht_iterator_next(iname)
+
+ Move the iterator to the next item in hash table. It must be called
+ also after sht_iterator_start() to get the first item in the hash
+ table. Items are returned as they are found in the hash table slot,
+ starting with the first slot.
+
+ The return code is false when there is no (more) item in the hash
+ table.
+
+ The item name and value are accessible via variables: $shtitkey(iname)
+ and $shtitval(iname).
+
+ The parameter can be dynamic string with variables.
+
+ This function can be used from ANY_ROUTE.
+
+ Example 1.25. sht_iterator_next usage
+...
+ sht_iterator_start("i1", "h1");
+ while(sht_iterator_next("i1")) {
+ xlog("h1[$shtitkey(i1)] is: $shtitval(i1)\n");
+ }
+ sht_iterator_end("i1");
+...
+
5. Exported pseudo-variables
* $sht(htable=>key)
diff --git a/modules/htable/doc/htable_admin.xml b/modules/htable/doc/htable_admin.xml
index 6427a28..bfba088 100644
--- a/modules/htable/doc/htable_admin.xml
+++ b/modules/htable/doc/htable_admin.xml
@@ -770,6 +770,97 @@ sht_unlock("ha=>test");
</programlisting>
</example>
</section>
+ <section id="htable.f.sht_iterator_start">
+ <title>
+ <function moreinfo="none">sht_iterator_start(iname, hname)</function>
+ </title>
+ <para>
+ Start an iterator for hash table named by the value of parameter
+ hname. The parameter iname is used to identify the iterator. There
+ can be up to 4 iterators at the same time, with different name.
+ </para>
+ <para>
+ Both parameters can be dynamic strings with variables.
+ </para>
+ <para>
+ IMPORTANT: the slot of the hash table is left locked when
+ retrieving in item. Therefore be sure you do not update the
+ content of the hash table in between sht_iterator_start()
+ and sht_iterator_end(), because it may end up in dead lock.
+ </para>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>sht_iterator_start</function> usage</title>
+ <programlisting format="linespecific">
+...
+sht_iterator_start("i1", "h1");
+...
+</programlisting>
+ </example>
+ </section>
+ <section id="htable.f.sht_iterator_end">
+ <title>
+ <function moreinfo="none">sht_iterator_end(iname)</function>
+ </title>
+ <para>
+ Close the iterator identified by iname parameter and release
+ the hash table slot aquired by the iterator. The iname value
+ must be the same used for sht_iterator_start().
+ </para>
+ <para>
+ The parameter can be dynamic string with variables.
+ </para>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>sht_iterator_end</function> usage</title>
+ <programlisting format="linespecific">
+...
+sht_iterator_end("i1");
+...
+</programlisting>
+ </example>
+ </section>
+ <section id="htable.f.sht_iterator_next">
+ <title>
+ <function moreinfo="none">sht_iterator_next(iname)</function>
+ </title>
+ <para>
+ Move the iterator to the next item in hash table. It must
+ be called also after sht_iterator_start() to get the first
+ item in the hash table. Items are returned as they are found
+ in the hash table slot, starting with the first slot.
+ </para>
+ <para>
+ The return code is false when there is no (more) item in the
+ hash table.
+ </para>
+ <para>
+ The item name and value are accessible via variables:
+ $shtitkey(iname) and $shtitval(iname).
+ </para>
+ <para>
+ The parameter can be dynamic string with variables.
+ </para>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>sht_iterator_next</function> usage</title>
+ <programlisting format="linespecific">
+...
+ sht_iterator_start("i1", "h1");
+ while(sht_iterator_next("i1")) {
+ xlog("h1[$shtitkey(i1)] is: $shtitval(i1)\n");
+ }
+ sht_iterator_end("i1");
+...
+</programlisting>
+ </example>
+ </section>
</section>
<section>
<title>Exported pseudo-variables</title>
i made a mistake when i introduced ICE=force_relay flag. for
consistency, the flag should have been ICE=force-relay.
is it too late to fix the name?
-- juha