summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2009-01-06 21:56:25 +0000
committerHenri Herscher <henri@oreka.org>2009-01-06 21:56:25 +0000
commit9aba6883c5955c0a1348fca9fc209780504ac782 (patch)
treefaa40b59b45db35b5912ae1ff2c707c9851781bd
parent3f5c1d9c9358eb6d7a1f2c75b49446303157fcd4 (diff)
Added RtpBlockedIpRanges configuration parameter so that it is possible to disregard certain IP ranges for RTP traffic without impacting signalling detection.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@588 09dcff7a-b715-0410-9601-b79a96267cd0
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp68
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp2
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.h2
3 files changed, 46 insertions, 26 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index 812e872..25cda38 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -1309,35 +1309,51 @@ bool TryRtp(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader, UdpH
// pt=34 is H263
// pt=97 is IAX2 iLBC payload
// pt > 98 is telephone-event in SIP
- { // pt=13 is CN (Comfort Noise)
- result = true;
- u_char* payload = (u_char *)rtpHeader + sizeof(RtpHeaderStruct);
- u_char* packetEnd = (u_char *)ipHeader + ntohs(ipHeader->ip_len);
- u_int payloadLength = packetEnd - payload;
-
- RtpPacketInfoRef rtpInfo(new RtpPacketInfo());
- rtpInfo->m_sourceIp = ipHeader->ip_src;
- rtpInfo->m_destIp = ipHeader->ip_dest;
- rtpInfo->m_sourcePort = ntohs(udpHeader->source);
- rtpInfo->m_destPort = ntohs(udpHeader->dest);
- rtpInfo->m_payloadSize = payloadLength;
- rtpInfo->m_payloadType = rtpHeader->pt;
- rtpInfo->m_seqNum = ntohs(rtpHeader->seq);
- rtpInfo->m_timestamp = ntohl(rtpHeader->ts);
- rtpInfo->m_payload = payload;
- rtpInfo->m_arrivalTimestamp = time(NULL);
- memcpy(rtpInfo->m_sourceMac, ethernetHeader->sourceMac, sizeof(rtpInfo->m_sourceMac));
- memcpy(rtpInfo->m_destMac, ethernetHeader->destinationMac, sizeof(rtpInfo->m_destMac));
-
- if(s_rtpPacketLog->isDebugEnabled())
+ {
+ if(DLLCONFIG.m_rtpBlockedIpRanges.Matches(ipHeader->ip_src) || DLLCONFIG.m_rtpBlockedIpRanges.Matches(ipHeader->ip_dest))
{
- CStdString logMsg;
- rtpInfo->ToString(logMsg);
- LOG4CXX_DEBUG(s_rtpPacketLog, logMsg);
+ if(s_rtpPacketLog->isDebugEnabled())
+ {
+ CStdString logMsg;
+ char sourceIp[16];
+ ACE_OS::inet_ntop(AF_INET, (void*)&ipHeader->ip_src, sourceIp, sizeof(sourceIp));
+ char destIp[16];
+ ACE_OS::inet_ntop(AF_INET, (void*)&ipHeader->ip_dest, destIp, sizeof(destIp));
+ logMsg.Format("RTP packet filtered by rtpBlockedIpRanges: src:%s dst:%s", sourceIp, destIp);
+ LOG4CXX_DEBUG(s_rtpPacketLog, logMsg);
+ }
}
- if(payloadLength < 900) // sanity check, speech RTP payload should always be smaller
+ else
{
- RtpSessionsSingleton::instance()->ReportRtpPacket(rtpInfo);
+ result = true;
+ u_char* payload = (u_char *)rtpHeader + sizeof(RtpHeaderStruct);
+ u_char* packetEnd = (u_char *)ipHeader + ntohs(ipHeader->ip_len);
+ u_int payloadLength = packetEnd - payload;
+
+ RtpPacketInfoRef rtpInfo(new RtpPacketInfo());
+ rtpInfo->m_sourceIp = ipHeader->ip_src;
+ rtpInfo->m_destIp = ipHeader->ip_dest;
+ rtpInfo->m_sourcePort = ntohs(udpHeader->source);
+ rtpInfo->m_destPort = ntohs(udpHeader->dest);
+ rtpInfo->m_payloadSize = payloadLength;
+ rtpInfo->m_payloadType = rtpHeader->pt;
+ rtpInfo->m_seqNum = ntohs(rtpHeader->seq);
+ rtpInfo->m_timestamp = ntohl(rtpHeader->ts);
+ rtpInfo->m_payload = payload;
+ rtpInfo->m_arrivalTimestamp = time(NULL);
+ memcpy(rtpInfo->m_sourceMac, ethernetHeader->sourceMac, sizeof(rtpInfo->m_sourceMac));
+ memcpy(rtpInfo->m_destMac, ethernetHeader->destinationMac, sizeof(rtpInfo->m_destMac));
+
+ if(s_rtpPacketLog->isDebugEnabled())
+ {
+ CStdString logMsg;
+ rtpInfo->ToString(logMsg);
+ LOG4CXX_DEBUG(s_rtpPacketLog, logMsg);
+ }
+ if(payloadLength < 900) // sanity check, speech RTP payload should always be smaller
+ {
+ RtpSessionsSingleton::instance()->ReportRtpPacket(rtpInfo);
+ }
}
}
else
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
index 22a5746..bd7013e 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
@@ -98,6 +98,8 @@ void VoIpConfig::Define(Serializer* s)
s->IntValue("RtpSessionWithSignallingInitialTimeoutSec", m_rtpSessionWithSignallingInitialTimeoutSec);
s->IntValue("RtpSessionOnHoldTimeOutSec", m_rtpSessionOnHoldTimeOutSec);
s->BoolValue("RtpReportDtmf", m_rtpReportDtmf);
+ s->IpRangesValue("RtpBlockedIpRanges", m_rtpBlockedIpRanges);
+
s->BoolValue("PcapTest", m_pcapTest);
s->StringValue("PcapFilter", m_pcapFilter);
s->BoolValue("RtpDiscontinuityDetect", m_rtpDiscontinuityDetect);
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
index 0e1a2c7..fb7ca1d 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
@@ -73,6 +73,8 @@ public:
int m_rtpDiscontinuityMinSeqDelta;
bool m_rtpDetectOnOddPorts;
bool m_rtpReportDtmf;
+ IpRanges m_rtpBlockedIpRanges;
+
bool m_iax2Support;
bool m_sipOverTcpSupport;
bool m_sipLogFailedCalls;