Module: sems
Branch: master
Commit: 51a41371553c6ccebbd8af1ae6dddabe4d5b809b
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=51a41371553c6ccebbd8af1ae6dddabe4d5b809b

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Thu May 19 18:03:23 2011 +0200

adds next_hop core config option

---

 core/AmConfig.cpp         |   15 +++++++++++++++
 core/AmConfig.h           |    6 ++++++
 core/AmSipDialog.cpp      |    4 +++-
 core/etc/sems.conf.sample |   21 +++++++++++++++++++--
 4 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp
index 1b7c474..a4d2a5d 100644
--- a/core/AmConfig.cpp
+++ b/core/AmConfig.cpp
@@ -72,6 +72,9 @@ int          AmConfig::MediaProcessorThreads   = 
NUM_MEDIA_PROCESSORS;
 int          AmConfig::SIPServerThreads        = NUM_SIP_SERVERS;
 string       AmConfig::OutboundProxy           = "";
 bool         AmConfig::ForceOutboundProxy      = false;
+string       AmConfig::NextHopIP               = "";
+unsigned int AmConfig::NextHopPort             = 0;
+bool         AmConfig::NextHopForReplies       = false;
 bool         AmConfig::ProxyStickyAuth         = false;
 bool         AmConfig::DisableDNSSRV           = false;
 string       AmConfig::Signature               = "";
@@ -287,6 +290,18 @@ int AmConfig::readConfiguration()
     ForceOutboundProxy = (cfg.getParameter("force_outbound_proxy") == "yes");
   }
 
+  if(cfg.hasParameter("next_hop_ip")) {
+    NextHopIP = cfg.getParameter("next_hop_ip");
+  }
+
+  if(cfg.hasParameter("next_hop_port")) {
+    NextHopPort = cfg.getParameterInt("next_hop_port", 0);
+  }
+
+  if(cfg.hasParameter("next_hop_for_replies")) {
+    NextHopForReplies = (cfg.getParameter("next_hop_for_replies") == "yes");
+  }
+
   if(cfg.hasParameter("proxy_sticky_auth")) {
     ProxyStickyAuth = (cfg.getParameter("proxy_sticky_auth") == "yes");
   }
diff --git a/core/AmConfig.h b/core/AmConfig.h
index b0b6997..89c2f7e 100644
--- a/core/AmConfig.h
+++ b/core/AmConfig.h
@@ -126,6 +126,12 @@ struct AmConfig
   static string OutboundProxy;
   /** force Outbound Proxy to be used for in dialog requests */
   static bool ForceOutboundProxy;
+  /** force next hop IP */
+  static string NextHopIP;
+  /** force next hop port */
+  static unsigned int NextHopPort;
+  /** force next hop for replies, too */
+  static bool NextHopForReplies;
   /** update ruri-host to previously resolved IP:port on SIP auth */
   static bool ProxyStickyAuth;
   /** skip DNS SRV lookup for resolving destination address*/
diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index 3b1f728..04ed18a 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -49,7 +49,9 @@ AmSipDialog::AmSipDialog(AmSipDialogEventHandler* h)
     force_outbound_proxy(AmConfig::ForceOutboundProxy),
     reliable_1xx(AmConfig::rel100),
     rseq(0), rseq_1st(0), rseq_confirmed(false),
-    next_hop_port(0), next_hop_for_replies(false),
+    next_hop_port(AmConfig::NextHopPort),
+    next_hop_ip(AmConfig::NextHopIP),
+    next_hop_for_replies(AmConfig::NextHopForReplies),
     outbound_interface(-1), out_intf_for_replies(false)
 {
 }
diff --git a/core/etc/sems.conf.sample b/core/etc/sems.conf.sample
index e194e5c..c0652c2 100644
--- a/core/etc/sems.conf.sample
+++ b/core/etc/sems.conf.sample
@@ -86,14 +86,31 @@ sip_port=5080
 # optional parameter: force_outbound_proxy={yes|no}
 #
 # - forces SEMS to send any request to the outbound proxy in any
-#   situation. This option will only have an effect if the 
-#   outbound_proxy option has been set.
+#   situation, by adding an extra first Route to the outbound_proxy.
+#   This option will only have an effect if the outbound_proxy
+#   option has been set, and it will break 3261 compatibility
+#   in some cases; better use next_hop_ip/next_hop_port.
 #
 #   default: no
 #
 # Example:
 #   force_outbound_proxy=yes
 
+# optional parameter: next_hop_ip
+# - if this is set, all outgoing requests will be sent to
+#   this IP, regardless of R-URI etc.
+#
+#next_hop_ip=192.168.5.106
+
+# optional parameter: next_hop_port
+# defaults to 5060
+#next_hop_port=5060
+
+# optional parameter:next_hop_for_replies
+# - use next_hop for replies, too?
+#
+#next_hop_for_replies=yes
+
 # optional parameter: rtp_low_port=<port>
 #
 # - sets lowest for RTP used port

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to