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

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Thu Feb 17 17:02:45 2011 +0100

support for setting the outbound_interface.

---

 apps/sbc/SBC.cpp            |    3 +++
 apps/sbc/SBCCallProfile.cpp |   20 +++++++++++++++++++-
 apps/sbc/SBCCallProfile.h   |    5 ++++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index cb474a8..3ae62f5 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -1017,6 +1017,9 @@ void SBCDialog::createCalleeSession()
     }
   }
 
+  if(call_profile.outbound_interface >= 0)
+    callee_dlg.outbound_interface = call_profile.outbound_interface;
+
   other_id = AmSession::getNewId();
   
   callee_dlg.local_tag    = other_id;
diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp
index 8c939c9..29df83b 100644
--- a/apps/sbc/SBCCallProfile.cpp
+++ b/apps/sbc/SBCCallProfile.cpp
@@ -30,7 +30,7 @@
 #include "log.h"
 #include "AmUtils.h"
 #include "AmPlugIn.h"
-
+#include "AmConfig.h"
 
 bool SBCCallProfile::readFromConfiguration(const string& name,
                                           const string profile_file_name) {
@@ -177,6 +177,24 @@ bool SBCCallProfile::readFromConfiguration(const string& 
name,
   force_symmetric_rtp = cfg.getParameter("rtprelay_force_symmetric_rtp");
   msgflags_symmetric_rtp = cfg.getParameter("rtprelay_msgflags_symmetric_rtp") 
== "yes";
 
+  string out_if_str = cfg.getParameter("outbound_interface");
+  if(!out_if_str.empty()) {
+    if(out_if_str == "default")
+      outbound_interface = 0;
+    else {
+      map<string,unsigned short>::iterator name_it = 
AmConfig::If_names.find(out_if_str);
+      if(name_it != AmConfig::If_names.end()) {
+       outbound_interface = name_it->second;
+      }
+      else {
+       ERROR("%s: '%s' does not exist as an interface. "
+             "Please check the 'additional_interfaces' "
+             "parameter in the main configuration file.",
+             name.c_str(),out_if_str.c_str());
+      }
+    }
+  }
+
   md5hash = "<unknown>";
   if (!cfg.getMD5(profile_file_name, md5hash)){
     ERROR("calculating MD5 of file %s\n", profile_file_name.c_str());
diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h
index c983ab2..a6902c2 100644
--- a/apps/sbc/SBCCallProfile.h
+++ b/apps/sbc/SBCCallProfile.h
@@ -92,6 +92,8 @@ struct SBCCallProfile {
   string force_symmetric_rtp;
   bool msgflags_symmetric_rtp;
 
+  int outbound_interface;
+
   // todo: RTP transcoding mode
 
   SBCCallProfile()
@@ -103,7 +105,8 @@ struct SBCCallProfile {
     auth_enabled(false),
     call_timer_enabled(false),
     prepaid_enabled(false),
-    rtprelay_enabled(false)
+    rtprelay_enabled(false),
+    outbound_interface(-1)
 
   { }
 

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

Reply via email to