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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Fri Jun 10 17:30:30 2011 +0200

sbc: configurable Contact option

---

 apps/sbc/SBC.cpp                         |    8 ++++++++
 apps/sbc/SBCCallProfile.cpp              |    6 ++++++
 apps/sbc/SBCCallProfile.h                |    1 +
 apps/sbc/etc/transparent.sbcprofile.conf |    2 ++
 doc/Readme.sbc.txt                       |    6 +++---
 5 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index 1cd4b37..e199fde 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -515,6 +515,11 @@ void SBCDialog::onInvite(const AmSipRequest& req)
   to = call_profile.to.empty() ? 
     req.to : replaceParameters(call_profile.to, "To", REPLACE_VALS);
 
+  if (!call_profile.contact.empty()) {
+    call_profile.contact =
+      replaceParameters(call_profile.contact, "Contact", REPLACE_VALS);
+  }
+
   callid = call_profile.callid.empty() ?
     "" : replaceParameters(call_profile.callid, "Call-ID", REPLACE_VALS);
 
@@ -1096,6 +1101,9 @@ SBCCalleeSession::SBCCalleeSession(const 
AmB2BCallerSession* caller,
     b2b_mode = B2BMode_SDPFilter;
   }
 
+  if (!call_profile.contact.empty()) {
+    dlg.contact_uri = SIP_HDR_COLSP(SIP_HDR_CONTACT) + call_profile.contact + 
CRLF;
+  }
 }
 
 SBCCalleeSession::~SBCCalleeSession() {
diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp
index b727e82..89252ae 100644
--- a/apps/sbc/SBCCallProfile.cpp
+++ b/apps/sbc/SBCCallProfile.cpp
@@ -44,6 +44,7 @@ bool SBCCallProfile::readFromConfiguration(const string& name,
   ruri = cfg.getParameter("RURI");
   from = cfg.getParameter("From");
   to = cfg.getParameter("To");
+  contact = cfg.getParameter("Contact");
 
   callid = cfg.getParameter("Call-ID");
 
@@ -192,6 +193,9 @@ bool SBCCallProfile::readFromConfiguration(const string& 
name,
     INFO("SBC:      RURI = '%s'\n", ruri.c_str());
     INFO("SBC:      From = '%s'\n", from.c_str());
     INFO("SBC:      To   = '%s'\n", to.c_str());
+    if (!contact.empty()) {
+      INFO("SBC:      Contact   = '%s'\n", contact.c_str());
+    }
     if (!callid.empty()) {
       INFO("SBC:      Call-ID   = '%s'\n", callid.c_str());
     }
@@ -260,6 +264,7 @@ bool SBCCallProfile::operator==(const SBCCallProfile& rhs) 
const {
     ruri == rhs.ruri &&
     from == rhs.from &&
     to == rhs.to &&
+    contact == rhs.contact &&
     callid == rhs.callid &&
     outbound_proxy == rhs.outbound_proxy &&
     force_outbound_proxy == rhs.force_outbound_proxy &&
@@ -321,6 +326,7 @@ string SBCCallProfile::print() const {
   res += "ruri:                 " + ruri + "\n";
   res += "from:                 " + from + "\n";
   res += "to:                   " + to + "\n";
+  res += "contact:              " + contact + "\n";
   res += "callid:               " + callid + "\n";
   res += "outbound_proxy:       " + outbound_proxy + "\n";
   res += "force_outbound_proxy: " + 
string(force_outbound_proxy?"true":"false") + "\n";
diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h
index bec361c..ba746f9 100644
--- a/apps/sbc/SBCCallProfile.h
+++ b/apps/sbc/SBCCallProfile.h
@@ -47,6 +47,7 @@ struct SBCCallProfile {
   string ruri;       /* updated if set */
   string from;       /* updated if set */
   string to;         /* updated if set */
+  string contact;
 
   string callid;
 
diff --git a/apps/sbc/etc/transparent.sbcprofile.conf 
b/apps/sbc/etc/transparent.sbcprofile.conf
index 3356b07..42ceed0 100644
--- a/apps/sbc/etc/transparent.sbcprofile.conf
+++ b/apps/sbc/etc/transparent.sbcprofile.conf
@@ -7,6 +7,8 @@
 #From=$f
 #To=$t
 
+#Contact=<sip:$Ri>
+
 #Call-ID
 #Call-ID=$ci_leg2
 
diff --git a/doc/Readme.sbc.txt b/doc/Readme.sbc.txt
index 809fb19..a3a4a4c 100644
--- a/doc/Readme.sbc.txt
+++ b/doc/Readme.sbc.txt
@@ -15,7 +15,7 @@ Features
  o B2BUA
  o flexible call profile based configuration
  o online reload of call profiles
- o From, To, RURI, Call-ID update
+ o From, To, RURI, Contact, Call-ID update
  o RTP bridging
  o Header and message filter
  o adding arbitrary headers
@@ -100,8 +100,8 @@ is loaded. The expected parameters to all functions are in 
a dictionary with
 Return code is [200, "OK", <result dictionary>] on success, or 
 [<error code>, <error reason>] on failure.
 
-Replacement patterns - active_profile, RURI, From, To, etc
-----------------------------------------------------------
+Replacement patterns - active_profile, RURI, From, To, Contact, etc
+-------------------------------------------------------------------
 In SBC profile the appearance of the outgoing INVITE request can be set,
 by setting RURI, From and To parameters. If any of those parameters is not
 set, the corresponding value of the incoming request is used.

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

Reply via email to