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: