Module: sems Branch: master Commit: 677e31237d0fd2354c55fa0fb25fa24940d4ede3 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=677e31237d0fd2354c55fa0fb25fa24940d4ede3
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Thu Jan 20 16:05:17 2011 +0100 sbc: make next_hop_for_replies dynamic --- apps/sbc/SBC.cpp | 13 ++++++++++++- apps/sbc/SBCCallProfile.cpp | 8 ++++---- apps/sbc/SBCCallProfile.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp index de21edc..6ad83d5 100644 --- a/apps/sbc/SBC.cpp +++ b/apps/sbc/SBC.cpp @@ -538,6 +538,12 @@ void SBCDialog::onInvite(const AmSipRequest& req) } call_profile.next_hop_port_i = nh_port_i; DBG("set next hop port to '%u'\n", call_profile.next_hop_port_i); + + if (!call_profile.next_hop_for_replies.empty()) { + call_profile.next_hop_for_replies = + replaceParameters(call_profile.next_hop_for_replies, "next_hop_for_replies", + REPLACE_VALS); + } } } @@ -961,7 +967,12 @@ void SBCDialog::createCalleeSession() callee_dlg.next_hop_ip = call_profile.next_hop_ip; callee_dlg.next_hop_port = call_profile.next_hop_port.empty() ? 5060 : call_profile.next_hop_port_i; - callee_dlg.next_hop_for_replies = call_profile.next_hop_for_replies; + + if (!call_profile.next_hop_for_replies.empty()) { + callee_dlg.next_hop_for_replies = + (call_profile.next_hop_for_replies == "yes" || + call_profile.next_hop_for_replies == "1"); + } } other_id = AmSession::getNewId(); diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp index 6032cd3..c794be3 100644 --- a/apps/sbc/SBCCallProfile.cpp +++ b/apps/sbc/SBCCallProfile.cpp @@ -52,7 +52,7 @@ bool SBCCallProfile::readFromConfiguration(const string& name, next_hop_ip = cfg.getParameter("next_hop_ip"); next_hop_port = cfg.getParameter("next_hop_port"); - next_hop_for_replies = cfg.getParameter("next_hop_for_replies") == "yes"; + next_hop_for_replies = cfg.getParameter("next_hop_for_replies"); string hf_type = cfg.getParameter("header_filter", "transparent"); if (hf_type=="transparent") @@ -196,8 +196,8 @@ bool SBCCallProfile::readFromConfiguration(const string& name, INFO("SBC: next hop = %s%s\n", next_hop_ip.c_str(), next_hop_port.empty()? "" : (":"+next_hop_port).c_str()); - if (next_hop_for_replies) { - INFO("SBC: next hop used for replies\n"); + if (!next_hop_for_replies.empty()) { + INFO("SBC: next hop used for replies: '%s'\n", next_hop_for_replies.c_str()); } } @@ -307,7 +307,7 @@ string SBCCallProfile::print() const { res += "next_hop_ip: " + next_hop_ip + "\n"; res += "next_hop_port: " + next_hop_port + "\n"; res += "next_hop_port_i: " + int2str(next_hop_port_i) + "\n"; - res += "next_hop_for_replies: " + string(next_hop_for_replies?"true":"false") + "\n"; + res += "next_hop_for_replies: " + next_hop_for_replies + "\n"; res += "headerfilter: " + string(FilterType2String(headerfilter)) + "\n"; res += "headerfilter_list: " + stringset_print(headerfilter_list) + "\n"; res += "messagefilter: " + string(FilterType2String(messagefilter)) + "\n"; diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h index 6ad4d47..2519214 100644 --- a/apps/sbc/SBCCallProfile.h +++ b/apps/sbc/SBCCallProfile.h @@ -56,7 +56,7 @@ struct SBCCallProfile { string next_hop_ip; string next_hop_port; unsigned short next_hop_port_i; - bool next_hop_for_replies; + string next_hop_for_replies; FilterType headerfilter; set<string> headerfilter_list; _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
