summaryrefslogtreecommitdiff
path: root/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
diff options
context:
space:
mode:
authorGerald Begumisa <ben_g@users.sourceforge.net>2008-05-09 18:12:30 +0000
committerGerald Begumisa <ben_g@users.sourceforge.net>2008-05-09 18:12:30 +0000
commitaaad6163c79cdab20f6dfe5255887287306608af (patch)
tree9b88d93cb24fcd436d71e8643bff4e864481fcab /orkaudio/audiocaptureplugins/voip/RtpSession.cpp
parente17262676d77711ca5c1c455f51c0b3a96ac7dae (diff)
Added new configuration parameter SipDirectionRefenceIpAddresses. This should be configured with a comma-delimited list of IP addresses under the VoIpPlugin section of config.xml. So if the IP address of the sender of the SIP INVITE message matches any of the IPs in this list, the direction of the session is set to "in"
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@538 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins/voip/RtpSession.cpp')
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp66
1 files changed, 49 insertions, 17 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
index 27f4da7..4db436f 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
@@ -333,6 +333,24 @@ void RtpSession::UpdateMetadataSip(RtpPacketInfoRef& rtpPacket, bool sourceRtpAd
}
}
+bool RtpSession::MatchesReferenceAddresses(struct in_addr inAddr)
+{
+ char szInAddr[16];
+
+ ACE_OS::inet_ntop(AF_INET, (void*)&inAddr, szInAddr, sizeof(szInAddr));
+ for(std::list<CStdString>::iterator it = DLLCONFIG.m_sipDirectionRefenceIpAddresses.begin(); it != DLLCONFIG.m_sipDirectionRefenceIpAddresses.end(); it++)
+ {
+ CStdString element = *it;
+
+ if(element.CompareNoCase(szInAddr) == 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void RtpSession::ProcessMetadataSip(RtpPacketInfoRef& rtpPacket)
{
// work out invitee media IP address
@@ -359,27 +377,41 @@ void RtpSession::ProcessMetadataSip(RtpPacketInfoRef& rtpPacket)
LOG4CXX_WARN(m_log, "[" + m_trackingId + "] " + m_ipAndPort + " alien RTP packet");
}
- // work out capture port and direction
- if(MatchesSipDomain(m_invite->m_fromDomain) && MatchesSipDomain(m_invite->m_toDomain))
- {
- // Both match at least one entry
- ProcessMetadataSipOutgoing();
- }
- else if(MatchesSipDomain(m_invite->m_fromDomain))
+ if(DLLCONFIG.m_sipDirectionRefenceIpAddresses.size())
{
- // Only from domain matches
- ProcessMetadataSipOutgoing();
- }
- else if(MatchesSipDomain(m_invite->m_toDomain))
- {
- // Only to domain matches
- ProcessMetadataSipIncoming();
+ if(MatchesReferenceAddresses(m_invite->m_senderIp))
+ {
+ ProcessMetadataSipIncoming();
+ }
+ else
+ {
+ ProcessMetadataSipOutgoing();
+ }
}
else
{
- // Default to outgoing whereby m_from is the local party and m_to is
- // the remote party - neither from nor to domains match
- ProcessMetadataSipOutgoing();
+ // work out capture port and direction
+ if(MatchesSipDomain(m_invite->m_fromDomain) && MatchesSipDomain(m_invite->m_toDomain))
+ {
+ // Both match at least one entry
+ ProcessMetadataSipOutgoing();
+ }
+ else if(MatchesSipDomain(m_invite->m_fromDomain))
+ {
+ // Only from domain matches
+ ProcessMetadataSipOutgoing();
+ }
+ else if(MatchesSipDomain(m_invite->m_toDomain))
+ {
+ // Only to domain matches
+ ProcessMetadataSipIncoming();
+ }
+ else
+ {
+ // Default to outgoing whereby m_from is the local party and m_to is
+ // the remote party - neither from nor to domains match
+ ProcessMetadataSipOutgoing();
+ }
}
}