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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Wed Oct 30 18:36:17 2013 +0100

sbc: profile function to evaluate RTP relay interfaces

---

 apps/sbc/SBCCallProfile.cpp |   52 +++++++++++++++++++++++++++---------------
 apps/sbc/SBCCallProfile.h   |    3 ++
 2 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp
index b8b5872..01ee735 100644
--- a/apps/sbc/SBCCallProfile.cpp
+++ b/apps/sbc/SBCCallProfile.cpp
@@ -87,25 +87,29 @@ static string payload2str(const SdpPayload &p);
     }                                                          \
   } while(0)
 
-#define REPLACE_IFACE_RTP(what, iface) do {            \
-    if (!what.empty()) {                           \
-      what = ctx.replaceParameters(what, #what, req);  \
-      DBG("set " #what " to '%s'\n", what.c_str());    \
-      if (!what.empty()) {                             \
-       if (what == "default") iface = 0;               \
-       else {                                                          \
-         map<string,unsigned short>::iterator name_it =                \
-           AmConfig::RTP_If_names.find(what);                          \
-         if (name_it != AmConfig::RTP_If_names.end()) \
-           iface = name_it->second;                                    \
-         else {                                                        \
-           ERROR("selected " #what " '%s' does not exist as a media interface. 
" \
-                 "Please check the 'additional_interfaces' "           \
-                 "parameter in the main configuration file.",          \
-                 what.c_str());                                        \
-           return false;                                               \
-         }                                                             \
-       }                                                               \
+#define REPLACE_IFACE_RTP(what, iface) do {                            \
+    if (!what.empty()) {                                               \
+      what = ctx.replaceParameters(what, #what, req);                  \
+      DBG("set " #what " to '%s'\n", what.c_str());                    \
+      if (!what.empty()) {                                             \
+       EVALUATE_IFACE_RTP(what, iface);                                \
+      }                                                                        
\
+    }                                                                  \
+  } while(0)
+
+#define EVALUATE_IFACE_RTP(what, iface) do {                           \
+    if (what == "default") iface = 0;                                  \
+    else {                                                             \
+      map<string,unsigned short>::iterator name_it =                   \
+       AmConfig::RTP_If_names.find(what);                              \
+      if (name_it != AmConfig::RTP_If_names.end())                     \
+       iface = name_it->second;                                        \
+      else {                                                           \
+       ERROR("selected " #what " '%s' does not exist as a media interface. " \
+             "Please check the 'additional_interfaces' "               \
+             "parameter in the main configuration file.",              \
+             what.c_str());                                            \
+       return false;                                                   \
       }                                                                        
\
     }                                                                  \
   } while(0)
@@ -816,6 +820,16 @@ bool SBCCallProfile::evaluate(ParamReplacerCtx& ctx,
   return true;
 }
 
+bool SBCCallProfile::evaluateRTPRelayInterface() {
+  EVALUATE_IFACE_RTP(rtprelay_interface, rtprelay_interface_value);
+  return true;
+}
+
+bool SBCCallProfile::evaluateRTPRelayAlegInterface() {
+  EVALUATE_IFACE_RTP(aleg_rtprelay_interface, aleg_rtprelay_interface_value);
+  return true;
+}
+
 static int apply_outbound_interface(const string& oi, AmBasicSipDialog& dlg)
 {
   if (oi == "default")
diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h
index 4275a60..9d784ef 100644
--- a/apps/sbc/SBCCallProfile.h
+++ b/apps/sbc/SBCCallProfile.h
@@ -343,6 +343,9 @@ struct SBCCallProfile
   bool evaluate(ParamReplacerCtx& ctx,
                const AmSipRequest& req);
 
+  bool evaluateRTPRelayInterface();
+  bool evaluateRTPRelayAlegInterface();
+
   void eval_sst_config(ParamReplacerCtx& ctx,
                       const AmSipRequest& req,
                       AmConfigReader& sst_cfg);

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

Reply via email to