summaryrefslogtreecommitdiff
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
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
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp66
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.h1
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp1
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.h1
4 files changed, 52 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();
+ }
}
}
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h
index b08dc82..fb2ba4f 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.h
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h
@@ -162,6 +162,7 @@ private:
void HandleRtpEvent(RtpPacketInfoRef& rtpPacket);
void RecordRtpEvent();
bool MatchesSipDomain(CStdString& domain);
+ bool MatchesReferenceAddresses(struct in_addr inAddr);
RtpPacketInfoRef m_lastRtpPacket;
RtpPacketInfoRef m_lastRtpPacketSide1;
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
index b5a376c..9476885 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
@@ -115,6 +115,7 @@ void VoIpConfig::Define(Serializer* s)
s->IntValue("SangomaTxTcpPortStart", m_sangomaTxTcpPortStart);
s->CsvValue("SipDomains", m_sipDomains);
+ s->CsvValue("SipDirectionRefenceIpAddresses", m_sipDirectionRefenceIpAddresses);
}
void VoIpConfig::Validate()
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
index 51e7b16..fcf7823 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
@@ -100,6 +100,7 @@ public:
int m_sangomaTxTcpPortStart;
int m_skinnyTcpPort;
std::list<CStdString> m_sipDomains;
+ std::list<CStdString> m_sipDirectionRefenceIpAddresses;
};
//========================================