From 27add11974dffb1d3a6b48d140e3f8dd689c995d Mon Sep 17 00:00:00 2001 From: Henri Herscher Date: Wed, 23 Jan 2008 15:27:59 +0000 Subject: Added SipIgnoredMediaAddresses config parameter. If a SIP INVITE has an RTP address that matches this csv list of CIDR ranges, it will be ignored. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@521 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 6 +++++ orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp | 31 ++++++++++++------------ orkaudio/audiocaptureplugins/voip/VoIpConfig.h | 2 ++ 3 files changed, 24 insertions(+), 15 deletions(-) (limited to 'orkaudio/audiocaptureplugins') diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index 9ed7360..31517d8 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -908,6 +908,12 @@ void RtpSessions::ReportSipInvite(SipInviteInfoRef& invite) char szFromRtpIp[16]; ACE_OS::inet_ntop(AF_INET, (void*)&invite->m_fromRtpIp, szFromRtpIp, sizeof(szFromRtpIp)); + if(DLLCONFIG.m_sipIgnoredMediaAddresses.Matches(invite->m_fromRtpIp)) + { + LOG4CXX_INFO(m_log, "INVITE disregarded by SipIgnoredMediaAddresses parameter"); + return; + } + CStdString ipAndPort = CStdString(szFromRtpIp) + "," + invite->m_fromRtpPort; std::map::iterator pair; diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp index 4ab8abd..16e5574 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp @@ -95,6 +95,7 @@ void VoIpConfig::Define(Serializer* s) s->BoolValue("SipUse200OkMediaAddress", m_sipUse200OkMediaAddress); s->BoolValue("SipReportFullAddress", m_sipReportFullAddress); s->BoolValue("SipDynamicMediaAddress", m_sipDynamicMediaAddress); + s->IpRangesValue("SipIgnoredMediaAddresses", m_sipIgnoredMediaAddresses); s->BoolValue("UseMacIfNoLocalParty", m_useMacIfNoLocalParty); s->BoolValue("LocalPartyForceLocalIp", m_localPartyForceLocalIp); @@ -122,7 +123,7 @@ void VoIpConfig::Validate() } else { - throw (CStdString("VoIpConfig: invalid IP address in LanMasks:" + *it) + " please fix config.xml"); + throw (CStdString("VoIpConfig: invalid IP address in LanMasks:" + *it)); } } @@ -137,7 +138,7 @@ void VoIpConfig::Validate() } else { - throw (CStdString("VoIpConfig: invalid IP address in MediaGateways:" + *it) + " please fix config.xml"); + throw (CStdString("VoIpConfig: invalid IP address in MediaGateways:" + *it)); } } @@ -152,7 +153,7 @@ void VoIpConfig::Validate() } else { - throw (CStdString("VoIpConfig: invalid IP address in RtpTrackUsingIpAddresses:" + *it) + " please fix config.xml"); + throw (CStdString("VoIpConfig: invalid IP address in RtpTrackUsingIpAddresses:" + *it)); } } @@ -181,7 +182,7 @@ void VoIpConfig::Validate() catch (...) {notAnInt = true;} if(cidrPrefixLength < 1 || cidrPrefixLength > 32 || notAnInt) { - throw (CStdString("VoIpConfig: invalid CIDR prefix length in AllowedIpRanges:" + entry) + " please fix config.xml"); + throw (CStdString("VoIpConfig: invalid CIDR prefix length in AllowedIpRanges:" + entry)); } } else @@ -198,7 +199,7 @@ void VoIpConfig::Validate() } else { - throw (CStdString("VoIpConfig: invalid IP range in AllowedIpRanges:" + entry) + " please fix config.xml"); + throw (CStdString("VoIpConfig: invalid IP range in AllowedIpRanges:" + entry)); } } @@ -228,7 +229,7 @@ void VoIpConfig::Validate() catch (...) {notAnInt = true;} if(cidrPrefixLength < 1 || cidrPrefixLength > 32 || notAnInt) { - throw (CStdString("VoIpConfig: invalid CIDR prefix length in blockedIpRanges:" + entry) + " please fix config.xml"); + throw (CStdString("VoIpConfig: invalid CIDR prefix length in blockedIpRanges:" + entry)); } } else @@ -245,38 +246,38 @@ void VoIpConfig::Validate() } else { - throw (CStdString("VoIpConfig: invalid IP range in BlockedIpRanges:" + entry) + " please fix config.xml"); + throw (CStdString("VoIpConfig: invalid IP range in BlockedIpRanges:" + entry)); } } if(m_pcapSocketBufferSize < 0) { CStdString exception; - exception.Format("VoIpConfig: PcapSocketBufferSize must be a positive number (currently:%d) please fix config.xml", m_pcapSocketBufferSize); + exception.Format("VoIpConfig: PcapSocketBufferSize must be a positive number (currently:%d)", m_pcapSocketBufferSize); throw (exception); } if(m_rtpSessionTimeoutSec < 1) { CStdString exception; - exception.Format("VoIpConfig: RtpSessionTimeoutSec must be > 0 (currently:%d) please fix config.xml", m_rtpSessionTimeoutSec); + exception.Format("VoIpConfig: RtpSessionTimeoutSec must be > 0 (currently:%d)", m_rtpSessionTimeoutSec); throw (exception); } if(m_rtpSessionWithSignallingTimeoutSec < 1) { CStdString exception; - exception.Format("VoIpConfig: RtpSessionWithSignallingTimeoutSec must be > 0 (currently:%d) please fix config.xml", m_rtpSessionWithSignallingTimeoutSec); + exception.Format("VoIpConfig: RtpSessionWithSignallingTimeoutSec must be > 0 (currently:%d)", m_rtpSessionWithSignallingTimeoutSec); throw (exception); } if(m_rtpSessionOnHoldTimeOutSec < 1) { CStdString exception; - exception.Format("VoIpConfig: RtpSessionOnHoldTimeOutSec must be > 0 (currently:%d) please fix config.xml", m_rtpSessionOnHoldTimeOutSec); + exception.Format("VoIpConfig: RtpSessionOnHoldTimeOutSec must be > 0 (currently:%d)", m_rtpSessionOnHoldTimeOutSec); throw (exception); } if(m_rtpSessionWithSignallingInitialTimeoutSec < 1) { CStdString exception; - exception.Format("VoIpConfig: RtpSessionWithSignallingInitialTimeoutSec must be > 0 (currently:%d) please fix config.xml", m_rtpSessionWithSignallingInitialTimeoutSec); + exception.Format("VoIpConfig: RtpSessionWithSignallingInitialTimeoutSec must be > 0 (currently:%d)", m_rtpSessionWithSignallingInitialTimeoutSec); throw (exception); } if(m_sangomaRxTcpPortStart == 0) @@ -285,7 +286,7 @@ void VoIpConfig::Validate() else if(m_sangomaRxTcpPortStart > 65000 || m_sangomaRxTcpPortStart < 2000 || ((m_sangomaRxTcpPortStart%1000) != 0) ) { CStdString exception; - exception.Format("VoIpConfig: SangomaRxTcpPort must be between 2000 and 65000 and be a multiple of 1000 (currently:%d) please fix config.xml", m_sangomaRxTcpPortStart); + exception.Format("VoIpConfig: SangomaRxTcpPort must be between 2000 and 65000 and be a multiple of 1000 (currently:%d)", m_sangomaRxTcpPortStart); throw (exception); } if(m_sangomaTxTcpPortStart == 0) @@ -294,14 +295,14 @@ void VoIpConfig::Validate() else if(m_sangomaTxTcpPortStart > 65000 || m_sangomaTxTcpPortStart < 2000 || ((m_sangomaTxTcpPortStart%1000) != 0) ) { CStdString exception; - exception.Format("VoIpConfig: SangomaTxTcpPort must be between 2000 and 65000 and be a multiple of 1000 (currently:%d) please fix config.xml", m_sangomaTxTcpPortStart); + exception.Format("VoIpConfig: SangomaTxTcpPort must be between 2000 and 65000 and be a multiple of 1000 (currently:%d)", m_sangomaTxTcpPortStart); throw (exception); } if(m_sangomaRxTcpPortStart > m_sangomaTxTcpPortStart) { CStdString exception; - exception.Format("VoIpConfig: SangomaTxTcpPort should always be bigger than SangomaRxTcpPort please fix config.xml"); + exception.Format("VoIpConfig: SangomaTxTcpPort should always be bigger than SangomaRxTcpPort"); throw (exception); } else if(m_sangomaRxTcpPortStart > 0 && m_sangomaTxTcpPortStart>0) diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h index f5e04c7..949736c 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h +++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h @@ -79,6 +79,8 @@ public: bool m_sipUse200OkMediaAddress; bool m_sipReportFullAddress; bool m_sipDynamicMediaAddress; + IpRanges m_sipIgnoredMediaAddresses; + bool m_useMacIfNoLocalParty; bool m_localPartyForceLocalIp; -- cgit v1.2.3