Module: sems Branch: master Commit: 0b3205844bac2da4d26738151ca861cfdcace43f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=0b3205844bac2da4d26738151ca861cfdcace43f
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Fri Feb 24 17:27:34 2012 +0100 sbc: support for rcvd interface replacements $Rf $Rn $RI $Rf - local/received interface id (0=default) $Rn - local/received interface name ('default', 'intern', ... as set in sems.conf) $RI - local/received interface public IP (as set in sems.conf) --- apps/sbc/ParamReplacer.cpp | 14 ++++++++++++-- doc/Readme.sbc.txt | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/sbc/ParamReplacer.cpp b/apps/sbc/ParamReplacer.cpp index 783fbae..63488ef 100644 --- a/apps/sbc/ParamReplacer.cpp +++ b/apps/sbc/ParamReplacer.cpp @@ -186,12 +186,22 @@ string replaceParameters(const string& s, break; } - if (s[p+1] == 'i') { // $si source IP address + if (s[p+1] == 'i') { // $Ri received IP address res += req.local_ip.c_str(); break; - } else if (s[p+1] == 'p') { // $sp source port + } else if (s[p+1] == 'p') { // $Rp received port res += int2str(req.local_port); break; + } else if (s[p+1] == 'f') { // $Rf received interface id + res += int2str(req.local_if); + } else if (s[p+1] == 'n') { // $Rn received interface name + if ((req.local_if >= 0) && req.local_if < AmConfig::Ifs.size()) { + res += AmConfig::Ifs[req.local_if].name; + } + } else if (s[p+1] == 'I') { // $RI received interface public IP + if ((req.local_if >= 0) && req.local_if < AmConfig::Ifs.size()) { + res += AmConfig::Ifs[req.local_if].PublicIP; + } } WARN("unknown replacement $R%c\n", s[p+1]); }; break; diff --git a/doc/Readme.sbc.txt b/doc/Readme.sbc.txt index b062230..8288bf1 100644 --- a/doc/Readme.sbc.txt +++ b/doc/Readme.sbc.txt @@ -156,6 +156,9 @@ The patterns which can be used are the following: $Ri - destination (local/received) IP address $Rp - destination (local/received) port + $Rf - local/received interface id (0=default) + $Rn - local/received interface name ('default', 'intern', ... as set in sems.conf) + $RI - local/received interface public IP (as set in sems.conf) $P(paramname) - paramname from P-App-Param Example: _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
