Module: sems Branch: master Commit: 19b43ec341bc4b3088cbe1b2901201964457994c URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=19b43ec341bc4b3088cbe1b2901201964457994c
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Mon Nov 15 21:00:41 2010 +0100 sbc: make call-id of second leg configurable; $ci --- apps/sbc/ParamReplacer.cpp | 8 ++++++++ apps/sbc/SBC.cpp | 12 +++++++++++- apps/sbc/SBC.h | 3 +++ apps/sbc/etc/transparent.sbcprofile.conf | 3 +++ doc/Readme.sbc.txt | 20 ++++++++++++++++++-- 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/apps/sbc/ParamReplacer.cpp b/apps/sbc/ParamReplacer.cpp index 777835a..3ca137d 100644 --- a/apps/sbc/ParamReplacer.cpp +++ b/apps/sbc/ParamReplacer.cpp @@ -127,6 +127,14 @@ string replaceParameters(const string& s, replaceParsedParam(s, p, ruri_parser, res); }; break; + case 'c': { // call-id + if ((s.length() == p+1) || (s[p+1] == 'i')) { + res += req.callid; + break; + } + WARN("unknown replacement $c%c\n", s[p+1]); + } + #define case_HDR(pv_char, pv_name, hdr_name) \ case pv_char: { \ AmUriParser uri_parser; \ diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp index 588ffe2..3fad5a4 100644 --- a/apps/sbc/SBC.cpp +++ b/apps/sbc/SBC.cpp @@ -75,6 +75,8 @@ bool SBCCallProfile::readFromConfiguration(const string& name, from = cfg.getParameter("From"); to = cfg.getParameter("To"); + callid = cfg.getParameter("Call-ID"); + force_outbound_proxy = cfg.getParameter("force_outbound_proxy") == "yes"; outbound_proxy = cfg.getParameter("outbound_proxy"); @@ -200,6 +202,10 @@ 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 (!callid.empty()) { + INFO("SBC: Call-ID = '%s'\n", callid.c_str()); + } + INFO("SBC: force outbound proxy: %s\n", force_outbound_proxy?"yes":"no"); INFO("SBC: outbound proxy = '%s'\n", outbound_proxy.c_str()); if (!next_hop_ip.empty()) { @@ -371,6 +377,9 @@ void SBCDialog::onInvite(const AmSipRequest& req) to = call_profile.to.empty() ? req.to : replaceParameters(call_profile.to, "To", REPLACE_VALS); + callid = call_profile.callid.empty() ? + "" : replaceParameters(call_profile.callid, "Call-ID", REPLACE_VALS); + if (!call_profile.outbound_proxy.empty()) { call_profile.outbound_proxy = replaceParameters(call_profile.outbound_proxy, "outbound_proxy", REPLACE_VALS); @@ -817,7 +826,8 @@ void SBCDialog::createCalleeSession() other_id = AmSession::getNewId(); callee_dlg.local_tag = other_id; - callee_dlg.callid = AmSession::getNewId() + "@" + AmConfig::LocalIP; + callee_dlg.callid = callid.empty() ? + AmSession::getNewId() + "@" + AmConfig::LocalIP : callid; // this will be overwritten by ConnectLeg event callee_dlg.remote_party = to; diff --git a/apps/sbc/SBC.h b/apps/sbc/SBC.h index 54b7d2a..960c4ab 100644 --- a/apps/sbc/SBC.h +++ b/apps/sbc/SBC.h @@ -48,6 +48,8 @@ struct SBCCallProfile { string from; /* updated if set */ string to; /* updated if set */ + string callid; + string outbound_proxy; bool force_outbound_proxy; @@ -134,6 +136,7 @@ class SBCDialog : public AmB2BCallerSession string ruri; string from; string to; + string callid; unsigned int call_timer; AmDynInvoke* m_user_timer; diff --git a/apps/sbc/etc/transparent.sbcprofile.conf b/apps/sbc/etc/transparent.sbcprofile.conf index 3d96b7f..e3f00e4 100644 --- a/apps/sbc/etc/transparent.sbcprofile.conf +++ b/apps/sbc/etc/transparent.sbcprofile.conf @@ -7,6 +7,9 @@ #From=$f #To=$t +#Call-ID +#Call-ID=$ci_leg2 + ## routing # outbound proxy: #outbound_proxy=sip:192.168.5.106:5060 diff --git a/doc/Readme.sbc.txt b/doc/Readme.sbc.txt index 925ce31..0728e11 100644 --- a/doc/Readme.sbc.txt +++ b/doc/Readme.sbc.txt @@ -14,7 +14,7 @@ Features -------- o B2BUA o flexible call profile based configuration - o From, To, RURI update + o From, To, RURI, Call-ID update o Header and message filter o reply code translation o SIP authentication @@ -38,7 +38,7 @@ active_profile configuration option By using the latter two options, the SBC profile for the call can be selected in the proxy. -RURI, From, To - Replacement patterns +RURI, From, To, etc - Replacement patterns ------------------------------------- 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 @@ -85,6 +85,8 @@ The patterns which can be used are the following: ... + $ci - Call-ID + $P(paramname) - paramname from P-App-Param Example: P-App-Param: u=myuser;p=mypwd;d=mydomain @@ -127,6 +129,20 @@ If a space is contained, use quotation at the beginning and end. Example: To="\"someone\" <[email protected]>" +Setting Call-ID +--------------- +For debugging purposes, the call-id of the outgoing leg can be set to depend on +the call-id the first leg, by setting the Call-ID parameter. + +Example: + Call-ID=$ci_leg2 + + If the incoming call leg had "Call-ID: 3c2d4b9a6b6f-hb22s7k9n0iv", the outgoing + leg will have "Call-ID: 3c2d4b9a6b6f-hb22s7k9n0iv_leg2". + +If Call-ID is not set, a standard unique ID is generated by SEMS, of the form +u...@host-ip. + Outbound proxy and next hop --------------------------- _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
