diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp index 29774031..15e393f2 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 = ""; @@ -285,6 +288,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 6a99c3cc..4e610dce 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 1f7904dd..5bbb4e83 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 b341b782..a574046b 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= # # - sets lowest for RTP used port