diff options
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 66 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/RtpSession.h | 1 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp | 1 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIpConfig.h | 1 |
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; }; //======================================== |