summaryrefslogtreecommitdiff
path: root/orkaudio/audiocaptureplugins
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2006-12-27 18:26:52 +0000
committerHenri Herscher <henri@oreka.org>2006-12-27 18:26:52 +0000
commit320f2a9dd5fd59b09e1977aa1f9344e219bf3d1a (patch)
tree0fddefd965d6816418a02cc3a25937636cb975fc /orkaudio/audiocaptureplugins
parent4da9cdff7f824859048184371fc524fbe5d326f3 (diff)
1. Subsequent SIP INVITES that could be associated to an existing session now disregarded because they could be disrupting valid sessions. We need to store the new INVITES and only use them when they are validated by a matching RTP stream.
2. New RTP streams are now logged within one session by the VoIP plugin. 3. Added a Debug config boolean that has the trackingId alpha counter reset to 0 (AAA) when enabled. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@380 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins')
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp48
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.h3
2 files changed, 35 insertions, 16 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
index 9bc0e01..a8ca873 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
@@ -10,7 +10,7 @@
* Please refer to http://www.gnu.org/copyleft/gpl.html
*
*/
-
+#pragma warning( disable: 4786 ) // disables truncated symbols in browse-info warning
#define _WINSOCKAPI_ // prevents the inclusion of winsock.h
#include "Utils.h"
@@ -19,6 +19,7 @@
#include "AudioCapturePlugin.h"
#include "AudioCapturePluginCommon.h"
#include <list>
+#include "ConfigManager.h"
#include "VoIpConfig.h"
#include "ace/OS_NS_arpa_inet.h"
@@ -456,6 +457,16 @@ bool RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket)
m_numRtpPackets++;
+ bool hasSourceAddress = m_rtpAddressList.HasAddressOrAdd(rtpPacket->m_sourceIp, rtpPacket->m_sourcePort);
+ bool hasDestAddress = m_rtpAddressList.HasAddressOrAdd(rtpPacket->m_destIp, rtpPacket->m_destPort);
+ if( hasSourceAddress == false || hasDestAddress == false )
+ {
+ rtpPacket->ToString(logMsg);
+ logMsg.Format("[%s] new RTP stream s%d: %s",
+ m_trackingId, channel, logMsg);
+ LOG4CXX_INFO(m_log, logMsg);
+ }
+
if(m_log->isDebugEnabled())
{
CStdString debug;
@@ -542,6 +553,10 @@ CStdString RtpSession::ProtocolToString(int protocolEnum)
RtpSessions::RtpSessions()
{
m_log = Logger::getLogger("rtpsessions");
+ if(CONFIG.m_debug)
+ {
+ m_alphaCounter.Reset();
+ }
}
@@ -552,7 +567,7 @@ void RtpSessions::ReportSipInvite(SipInviteInfoRef& invite)
CStdString ipAndPort = CStdString(szFromRtpIp) + "," + invite->m_fromRtpPort;
std::map<CStdString, RtpSessionRef>::iterator pair;
-
+
pair = m_byIpAndPort.find(ipAndPort);
if (pair != m_byIpAndPort.end())
{
@@ -566,22 +581,25 @@ void RtpSessions::ReportSipInvite(SipInviteInfoRef& invite)
RtpSessionRef session = pair->second;
if(!session->m_ipAndPort.Equals(ipAndPort))
{
- // The session RTP connection address has changed
- // Remove session from IP and Port map
- m_byIpAndPort.erase(session->m_ipAndPort);
- // ... update
- session->m_ipAndPort = ipAndPort;
- session->ReportSipInvite(invite);
- // ... and reinsert
- m_byIpAndPort.insert(std::make_pair(session->m_ipAndPort, session));
-
- LOG4CXX_INFO(m_log, "[" + session->m_trackingId + "] updated with new INVITE data");
+ //===== The following is disabled because it disrupts valid sessions ====
+ //===== We need to make sure that at least one RTP packet has been ====
+ //===== seen that validates any new INVITE associated with the session ====
+ //// The session RTP connection address has changed
+ //// Remove session from IP and Port map
+ //m_byIpAndPort.erase(session->m_ipAndPort);
+ //// ... update
+ //session->m_ipAndPort = ipAndPort;
+ //session->ReportSipInvite(invite);
+ //// ... and reinsert
+ //m_byIpAndPort.insert(std::make_pair(session->m_ipAndPort, session));
+ //
+ //LOG4CXX_INFO(m_log, "[" + session->m_trackingId + "] updated with new INVITE data");
}
return;
}
// create new session and insert into both maps
- CStdString trackingId = alphaCounter.GetNext();
+ CStdString trackingId = m_alphaCounter.GetNext();
RtpSessionRef session(new RtpSession(trackingId));
session->m_ipAndPort = ipAndPort;
session->m_callId = invite->m_callId;
@@ -621,7 +639,7 @@ void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruc
}
// create new session and insert into the callid map
- CStdString trackingId = alphaCounter.GetNext();
+ CStdString trackingId = m_alphaCounter.GetNext();
RtpSessionRef session(new RtpSession(trackingId));
session->m_callId = callId;
session->m_endPointIp = ipHeader->ip_dest; // CallInfo message always goes from CM to endpoint
@@ -1012,7 +1030,7 @@ void RtpSessions::ReportRtpPacket(RtpPacketInfoRef& rtpPacket)
if(numSessionsFound == 0)
{
// create new Raw RTP session and insert into IP+Port map
- CStdString trackingId = alphaCounter.GetNext();
+ CStdString trackingId = m_alphaCounter.GetNext();
RtpSessionRef session(new RtpSession(trackingId));
session->m_protocol = RtpSession::ProtRawRtp;
session->m_ipAndPort = ipAndPort; // (1) In the case of a PSTN Gateway automated answer, This is the destination IP+Port of the first packet which is good, because it is usually the IP+Port of the PSTN Gateway.
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h
index d7f9659..77db42d 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.h
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h
@@ -117,6 +117,7 @@ private:
unsigned int m_highestRtpSeqNumDelta;
double m_minRtpSeqDelta;
double m_minRtpTimestampDelta;
+ TcpAddressList m_rtpAddressList;
};
typedef boost::shared_ptr<RtpSession> RtpSessionRef;
@@ -147,7 +148,7 @@ private:
std::map<CStdString, RtpSessionRef> m_byCallId;
std::map<unsigned int, EndpointInfoRef> m_endpoints;
LoggerPtr m_log;
- AlphaCounter alphaCounter;
+ AlphaCounter m_alphaCounter;
};
typedef ACE_Singleton<RtpSessions, ACE_Thread_Mutex> RtpSessionsSingleton;