From be0c1af70f1da0bcd4fd701dbd070164076ed65b Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Thu, 17 Feb 2011 17:02:45 +0100 Subject: [PATCH] support for setting the outbound_interface. --- apps/sbc/SBC.cpp | 3 +++ apps/sbc/SBCCallProfile.cpp | 20 +++++++++++++++++++- apps/sbc/SBCCallProfile.h | 5 ++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp index cb474a84..3ae62f5a 100644 --- a/apps/sbc/SBC.cpp +++ b/apps/sbc/SBC.cpp @@ -1017,6 +1017,9 @@ void SBCDialog::createCalleeSession() } } + if(call_profile.outbound_interface >= 0) + callee_dlg.outbound_interface = call_profile.outbound_interface; + other_id = AmSession::getNewId(); callee_dlg.local_tag = other_id; diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp index 8c939c90..29df83bd 100644 --- a/apps/sbc/SBCCallProfile.cpp +++ b/apps/sbc/SBCCallProfile.cpp @@ -30,7 +30,7 @@ #include "log.h" #include "AmUtils.h" #include "AmPlugIn.h" - +#include "AmConfig.h" bool SBCCallProfile::readFromConfiguration(const string& name, const string profile_file_name) { @@ -177,6 +177,24 @@ 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::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()); + } + } + } + md5hash = ""; if (!cfg.getMD5(profile_file_name, md5hash)){ ERROR("calculating MD5 of file %s\n", profile_file_name.c_str()); diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h index c983ab26..a6902c26 100644 --- a/apps/sbc/SBCCallProfile.h +++ b/apps/sbc/SBCCallProfile.h @@ -92,6 +92,8 @@ struct SBCCallProfile { string force_symmetric_rtp; bool msgflags_symmetric_rtp; + int outbound_interface; + // todo: RTP transcoding mode SBCCallProfile() @@ -103,7 +105,8 @@ struct SBCCallProfile { auth_enabled(false), call_timer_enabled(false), prepaid_enabled(false), - rtprelay_enabled(false) + rtprelay_enabled(false), + outbound_interface(-1) { }