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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Thu Apr 17 02:14:02 2014 +0200

sbc: make rtprelay_enabled controllable via msg/hdrs/replacement

---

 apps/sbc/SBCCallLeg.cpp             |    4 ++--
 apps/sbc/SBCCallProfile.cpp         |   14 ++++++++------
 apps/sbc/SBCCallProfile.h           |    5 +++--
 apps/sbc/call_control/ctl/CCCtl.cpp |    2 +-
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/apps/sbc/SBCCallLeg.cpp b/apps/sbc/SBCCallLeg.cpp
index e308c8a..4a9d83b 100644
--- a/apps/sbc/SBCCallLeg.cpp
+++ b/apps/sbc/SBCCallLeg.cpp
@@ -227,7 +227,7 @@ void SBCCallLeg::applyAProfile()
   // apply A leg configuration (but most of the configuration is applied in
   // SBCFactory::onInvite)
 
-  if (call_profile.rtprelay_enabled || call_profile.transcoder.isActive()) {
+  if (call_profile.rtprelay_enabled_value || 
call_profile.transcoder.isActive()) {
     DBG("Enabling RTP relay mode for SBC call\n");
 
     setRtpRelayForceSymmetricRtp(call_profile.aleg_force_symmetric_rtp_value);
@@ -371,7 +371,7 @@ void SBCCallLeg::applyBProfile()
     dlg->setOutboundInterface(call_profile.outbound_interface_value);
 
   // was read from caller but reading directly from profile now
-  if (call_profile.rtprelay_enabled || call_profile.transcoder.isActive()) {
+  if (call_profile.rtprelay_enabled_value || 
call_profile.transcoder.isActive()) {
 
     if (call_profile.rtprelay_interface_value >= 0)
       setRtpInterface(call_profile.rtprelay_interface_value);
diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp
index 28a88d4..a6eb06b 100644
--- a/apps/sbc/SBCCallProfile.cpp
+++ b/apps/sbc/SBCCallProfile.cpp
@@ -354,7 +354,7 @@ bool SBCCallProfile::readFromConfiguration(const string& 
name,
 
   refuse_with = cfg.getParameter("refuse_with");
 
-  rtprelay_enabled = cfg.getParameter("enable_rtprelay") == "yes";
+  rtprelay_enabled = cfg.getParameter("enable_rtprelay");
   aleg_force_symmetric_rtp = cfg.getParameter("rtprelay_force_symmetric_rtp");
   force_symmetric_rtp = aleg_force_symmetric_rtp;
   msgflags_symmetric_rtp = cfg.getParameter("rtprelay_msgflags_symmetric_rtp") 
== "yes";
@@ -476,8 +476,9 @@ bool SBCCallProfile::readFromConfiguration(const string& 
name,
     INFO("SBC:      fixing Replaces in INVITE: '%s'\n", 
fix_replaces_inv.c_str());
     INFO("SBC:      fixing Replaces in REFER: '%s'\n", 
fix_replaces_ref.c_str());
 
-    INFO("SBC:      RTP relay %sabled\n", rtprelay_enabled?"en":"dis");
-    if (rtprelay_enabled) {
+
+    INFO("SBC:      RTP relay enabled: '%s'\n", rtprelay_enabled.c_str());
+    if (!rtprelay_enabled.empty() && rtprelay_enabled != "no") {
       if (!force_symmetric_rtp.empty()) {
        INFO("SBC:      RTP force symmetric RTP: %s\n",
             force_symmetric_rtp.c_str());
@@ -674,7 +675,7 @@ string SBCCallProfile::print() const {
   res += "auth_aleg_enabled:    " + string(auth_aleg_enabled?"true":"false") + 
"\n";
   res += "auth_aleg_user:       " + auth_aleg_credentials.user+"\n";
   res += "auth_aleg_pwd:        " + auth_aleg_credentials.pwd+"\n";
-  res += "rtprelay_enabled:     " + string(rtprelay_enabled?"true":"false") + 
"\n";
+  res += "rtprelay_enabled:     " + rtprelay_enabled + "\n";
   res += "force_symmetric_rtp:  " + force_symmetric_rtp;
   res += "msgflags_symmetric_rtp: " + 
string(msgflags_symmetric_rtp?"true":"false") + "\n";
   
@@ -771,9 +772,10 @@ bool SBCCallProfile::evaluate(ParamReplacerCtx& ctx,
 
   if (!transcoder.evaluate(ctx,req)) return false;
 
-  if (rtprelay_enabled || transcoder.isActive()) {
+  REPLACE_BOOL(rtprelay_enabled, rtprelay_enabled_value);
+
+  if (rtprelay_enabled_value || transcoder.isActive()) {
     // evaluate other RTP relay related params only if enabled
-    // FIXME: really not evaluate rtprelay_enabled itself?
     REPLACE_BOOL(force_symmetric_rtp, force_symmetric_rtp_value);
     REPLACE_BOOL(aleg_force_symmetric_rtp, aleg_force_symmetric_rtp_value);
 
diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h
index 483de92..ae854f9 100644
--- a/apps/sbc/SBCCallProfile.h
+++ b/apps/sbc/SBCCallProfile.h
@@ -187,7 +187,8 @@ struct SBCCallProfile
 
   string refuse_with;
 
-  bool rtprelay_enabled;
+  string rtprelay_enabled;
+  bool rtprelay_enabled_value;
   string force_symmetric_rtp;
   string aleg_force_symmetric_rtp;
   bool force_symmetric_rtp_value;
@@ -344,7 +345,7 @@ struct SBCCallProfile
     dlg_nat_handling(false),
     keep_vias(false),bleg_keep_vias(false),
     sst_enabled_value(false),
-    rtprelay_enabled(false),
+    rtprelay_enabled_value(false),
     force_symmetric_rtp_value(false),
     aleg_force_symmetric_rtp_value(false),
     rtprelay_transparent_seqno(true),
diff --git a/apps/sbc/call_control/ctl/CCCtl.cpp 
b/apps/sbc/call_control/ctl/CCCtl.cpp
index 680cd50..d8670c6 100644
--- a/apps/sbc/call_control/ctl/CCCtl.cpp
+++ b/apps/sbc/call_control/ctl/CCCtl.cpp
@@ -164,7 +164,7 @@ void CCCtl::start(const string& cc_name, const string& ltag,
   if (call_profile->append_headers.size() > 2)
       assertEndCRLF(call_profile->append_headers);
 
-  ENABLE_IN_CALL_PROFILE("rtprelay_enabled", rtprelay_enabled);
+  SET_TO_CALL_PROFILE("rtprelay_enabled", rtprelay_enabled);
   SET_TO_CALL_PROFILE("rtprelay_interface", rtprelay_interface);
   SET_TO_CALL_PROFILE("aleg_rtprelay_interface", aleg_rtprelay_interface);
 

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

Reply via email to