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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Fri Oct 29 12:58:16 2010 +0200

sbc: outbound_proxy and force_outbound_proxy

---

 apps/sbc/SBC.cpp                         |   26 ++++++++++++++++++++++----
 apps/sbc/SBC.h                           |    3 +++
 apps/sbc/etc/auth_b2b.sbcprofile.conf    |    5 +++++
 apps/sbc/etc/call_timer.sbcprofile.conf  |    5 +++++
 apps/sbc/etc/sst_b2b.sbcprofile.conf     |    5 +++++
 apps/sbc/etc/transparent.sbcprofile.conf |    5 +++++
 doc/Readme.sbc.txt                       |    8 ++++++++
 7 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index fe112df..da086cb 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -63,7 +63,8 @@ AmSessionEventHandlerFactory* SBCFactory::session_timer_fact 
= NULL;
 EXPORT_SESSION_FACTORY(SBCFactory,MOD_NAME);
 
 
-bool SBCCallProfile::readFromConfiguration(const string& name, const string 
profile_file_name) {
+bool SBCCallProfile::readFromConfiguration(const string& name,
+                                          const string profile_file_name) {
   if (cfg.loadFile(profile_file_name)) {
     ERROR("reading SBC call profile from '%s'\n", profile_file_name.c_str());
     return false;
@@ -73,6 +74,9 @@ bool SBCCallProfile::readFromConfiguration(const string& 
name, const string prof
   from = cfg.getParameter("From");
   to = cfg.getParameter("To");
 
+  force_outbound_proxy = cfg.getParameter("force_outbound_proxy") == "yes";
+  outbound_proxy = cfg.getParameter("outbound_proxy");
+
   string hf_type = cfg.getParameter("header_filter", "transparent");
   if (hf_type=="transparent")
     headerfilter = Transparent;
@@ -120,6 +124,8 @@ bool SBCCallProfile::readFromConfiguration(const string& 
name, const string prof
   INFO("SBC:      RURI = '%s'\n", ruri.c_str());
   INFO("SBC:      From = '%s'\n", from.c_str());
   INFO("SBC:      To   = '%s'\n", to.c_str());
+  INFO("SBC:      force outbound proxy: %s\n", 
force_outbound_proxy?"yes":"no");
+  INFO("SBC:      outbound proxy = '%s'\n", outbound_proxy.c_str());
   INFO("SBC:      header filter  is %s, %zd items in list\n",
        FilterType2String(headerfilter), headerfilter_list.size());
   INFO("SBC:      message filter is %s, %zd items in list\n",
@@ -432,6 +438,13 @@ void SBCDialog::onInvite(const AmSipRequest& req)
     req.to : replaceParameters("To", call_profile.to, req, app_param,
                                  ruri_parser, from_parser, to_parser);
 
+  if (!call_profile.outbound_proxy.empty()) {
+      call_profile.outbound_proxy =
+      replaceParameters("outbound_proxy", call_profile.outbound_proxy, req, 
app_param,
+                                 ruri_parser, from_parser, to_parser);
+    DBG("set outbound proxy to '%s'\n", dlg.outbound_proxy.c_str());
+  }
+
   m_state = BB_Dialing;
 
   invite_req = req;
@@ -483,9 +496,9 @@ void SBCDialog::onInvite(const AmSipRequest& req)
     }
   }
 
-  DBG("SBC: connecting to <%s>\n",ruri.c_str());
-  DBG("     From:  <%s>\n",from.c_str());
-  DBG("     To:  <%s>\n",to.c_str());
+  DBG("SBC: connecting to '%s'\n",ruri.c_str());
+  DBG("     From:  '%s'\n",from.c_str());
+  DBG("     To:  '%s'\n",to.c_str());
   connectCallee(to, ruri, true);
 }
 
@@ -678,6 +691,11 @@ void SBCDialog::createCalleeSession()
   }
 
   AmSipDialog& callee_dlg = callee_session->dlg;
+
+  callee_dlg.force_outbound_proxy = call_profile.force_outbound_proxy;
+  if (!call_profile.outbound_proxy.empty()) {
+    callee_dlg.outbound_proxy = call_profile.outbound_proxy;
+  }
   
   other_id = AmSession::getNewId();
   
diff --git a/apps/sbc/SBC.h b/apps/sbc/SBC.h
index f884f8f..59b542f 100644
--- a/apps/sbc/SBC.h
+++ b/apps/sbc/SBC.h
@@ -47,6 +47,9 @@ struct SBCCallProfile {
   string from;       /* updated if set */
   string to;         /* updated if set */
 
+  string outbound_proxy;
+  bool force_outbound_proxy;
+
   FilterType headerfilter;
   set<string> headerfilter_list;
 
diff --git a/apps/sbc/etc/auth_b2b.sbcprofile.conf 
b/apps/sbc/etc/auth_b2b.sbcprofile.conf
index 34fcfa4..196552c 100644
--- a/apps/sbc/etc/auth_b2b.sbcprofile.conf
+++ b/apps/sbc/etc/auth_b2b.sbcprofile.conf
@@ -18,6 +18,11 @@ RURI=sip:$...@$p(d)
 From="\"$P(u)\" <sip:$P(u)@$P(d)>"
 To="\"$rU\" <sip:$...@$p(d)>"
 
+## outbound proxy
+#outbound_proxy=sip:192.168.5.106:5060
+# force outbound proxy (in-dialog requests)?
+#force_outbound_proxy=yes
+
 enable_auth=yes
 auth_user=$P(u)
 auth_pwd=$P(p)
diff --git a/apps/sbc/etc/call_timer.sbcprofile.conf 
b/apps/sbc/etc/call_timer.sbcprofile.conf
index dd8da9e..7eeee74 100644
--- a/apps/sbc/etc/call_timer.sbcprofile.conf
+++ b/apps/sbc/etc/call_timer.sbcprofile.conf
@@ -13,6 +13,11 @@
 #From=$f
 #To=$t
 
+## outbound proxy
+#outbound_proxy=sip:192.168.5.106:5060
+# force outbound proxy (in-dialog requests)?
+#force_outbound_proxy=yes
+
 ## filters: 
 #header_filter=blacklist
 #header_list=P-App-Param,P-App-Name
diff --git a/apps/sbc/etc/sst_b2b.sbcprofile.conf 
b/apps/sbc/etc/sst_b2b.sbcprofile.conf
index a712453..ef1fb50 100644
--- a/apps/sbc/etc/sst_b2b.sbcprofile.conf
+++ b/apps/sbc/etc/sst_b2b.sbcprofile.conf
@@ -9,6 +9,11 @@
 #From=$f
 #To=$t
 
+## outbound proxy
+#outbound_proxy=sip:192.168.5.106:5060
+# force outbound proxy (in-dialog requests)?
+#force_outbound_proxy=yes
+
 ## filters: 
 #header_filter=blacklist
 #header_list=P-App-Param,P-App-Name
diff --git a/apps/sbc/etc/transparent.sbcprofile.conf 
b/apps/sbc/etc/transparent.sbcprofile.conf
index 7fc1ec6..b9838b4 100644
--- a/apps/sbc/etc/transparent.sbcprofile.conf
+++ b/apps/sbc/etc/transparent.sbcprofile.conf
@@ -7,6 +7,11 @@
 #From=$f
 #To=$t
 
+## outbound proxy
+#outbound_proxy=sip:192.168.5.106:5060
+# force outbound proxy (in-dialog requests)?
+#force_outbound_proxy=yes
+
 ## filters: 
 #header_filter=blacklist
 #header_list=P-App-Param,P-App-Name
diff --git a/doc/Readme.sbc.txt b/doc/Readme.sbc.txt
index 749700f..27284c1 100644
--- a/doc/Readme.sbc.txt
+++ b/doc/Readme.sbc.txt
@@ -103,6 +103,14 @@ If a space is contained, use quotation at the beginning 
and end.
  Example:
    To="\"someone\" <[email protected]>"
 
+Outbound proxy
+--------------
+
+An outbound proxy may be set with the outbound_proxy option. If this is
+not set, the outbound_proxy option of sems.conf is used, if set.
+
+force_outbound_proxy forces the outbound proxy also for in-dialog requests.
+
 Filters
 -------
 Headers and messages may be filtered. A filter can be set to 

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

Reply via email to