Module: sems Branch: master Commit: c86297391bbcc6eecc5c6b912a743414dd0469d9 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=c86297391bbcc6eecc5c6b912a743414dd0469d9
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Tue Feb 22 16:37:41 2011 +0100 sbc: make outbound_interface dynamic --- apps/sbc/SBC.cpp | 28 ++++++++++++++++++++++++++-- apps/sbc/SBC.h | 2 ++ apps/sbc/SBCCallProfile.cpp | 18 +----------------- apps/sbc/SBCCallProfile.h | 5 ++--- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp index 3ae62f5..75f5a6e 100644 --- a/apps/sbc/SBC.cpp +++ b/apps/sbc/SBC.cpp @@ -616,6 +616,30 @@ void SBCDialog::onInvite(const AmSipRequest& req) replaceParameters(call_profile.auth_credentials.pwd, "auth_pwd", REPLACE_VALS); } + if (!call_profile.outbound_interface.empty()) { + call_profile.outbound_interface = + replaceParameters(call_profile.outbound_interface, "outbound_interface", + REPLACE_VALS); + + if (!call_profile.outbound_interface.empty()) { + if (call_profile.outbound_interface == "default") + outbound_interface = 0; + else { + map<string,unsigned short>::iterator name_it = + AmConfig::If_names.find(call_profile.outbound_interface); + if (name_it != AmConfig::If_names.end()) { + outbound_interface = name_it->second; + } else { + ERROR("selected outbound_interface '%s' does not exist as an interface. " + "Please check the 'additional_interfaces' " + "parameter in the main configuration file.", + call_profile.outbound_interface.c_str()); + throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR); + } + } + } + } + // get timer if (call_profile.call_timer_enabled || call_profile.prepaid_enabled) { if (!timersSupported()) { @@ -1017,8 +1041,8 @@ void SBCDialog::createCalleeSession() } } - if(call_profile.outbound_interface >= 0) - callee_dlg.outbound_interface = call_profile.outbound_interface; + if(outbound_interface >= 0) + callee_dlg.outbound_interface = outbound_interface; other_id = AmSession::getNewId(); diff --git a/apps/sbc/SBC.h b/apps/sbc/SBC.h index 131e6e0..9892758 100644 --- a/apps/sbc/SBC.h +++ b/apps/sbc/SBC.h @@ -106,6 +106,8 @@ class SBCDialog : public AmB2BCallerSession unsigned int call_timer; + int outbound_interface; + // prepaid AmDynInvoke* prepaid_acc; time_t prepaid_starttime; diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp index 29df83b..b727e82 100644 --- a/apps/sbc/SBCCallProfile.cpp +++ b/apps/sbc/SBCCallProfile.cpp @@ -177,23 +177,7 @@ bool SBCCallProfile::readFromConfiguration(const string& name, force_symmetric_rtp = cfg.getParameter("rtprelay_force_symmetric_rtp"); msgflags_symmetric_rtp = cfg.getParameter("rtprelay_msgflags_symmetric_rtp") == "yes"; - string out_if_str = cfg.getParameter("outbound_interface"); - if(!out_if_str.empty()) { - if(out_if_str == "default") - outbound_interface = 0; - else { - map<string,unsigned short>::iterator name_it = AmConfig::If_names.find(out_if_str); - if(name_it != AmConfig::If_names.end()) { - outbound_interface = name_it->second; - } - else { - ERROR("%s: '%s' does not exist as an interface. " - "Please check the 'additional_interfaces' " - "parameter in the main configuration file.", - name.c_str(),out_if_str.c_str()); - } - } - } + outbound_interface = cfg.getParameter("outbound_interface"); md5hash = "<unknown>"; if (!cfg.getMD5(profile_file_name, md5hash)){ diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h index a6902c2..bec361c 100644 --- a/apps/sbc/SBCCallProfile.h +++ b/apps/sbc/SBCCallProfile.h @@ -92,7 +92,7 @@ struct SBCCallProfile { string force_symmetric_rtp; bool msgflags_symmetric_rtp; - int outbound_interface; + string outbound_interface; // todo: RTP transcoding mode @@ -105,8 +105,7 @@ struct SBCCallProfile { auth_enabled(false), call_timer_enabled(false), prepaid_enabled(false), - rtprelay_enabled(false), - outbound_interface(-1) + rtprelay_enabled(false) { } _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
