summaryrefslogtreecommitdiff
path: root/orkaudio
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2005-10-24 21:10:39 +0000
committerHenri Herscher <henri@oreka.org>2005-10-24 21:10:39 +0000
commit5229923253c34704218f9f38051c216d24023e16 (patch)
treefab9d9480765864daaa0f52679c88a8df6eae14e /orkaudio
parentea9085bcc941a5ea566432be42943f0a323a5b63 (diff)
VoIP plugin now tries to associate a SIP call to a capture port that is made of the actual local SIP agent (phone) IP address and TCP port. Before that, a capture port could be made of a gateway or external IP address and TCP port.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@11 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio')
-rw-r--r--orkaudio/audiocaptureplugins/voip/SipSession.cpp28
-rw-r--r--orkaudio/audiocaptureplugins/voip/SipSession.h2
-rw-r--r--orkaudio/config-template.xml2
3 files changed, 21 insertions, 11 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/SipSession.cpp b/orkaudio/audiocaptureplugins/voip/SipSession.cpp
index e62a612..2139a28 100644
--- a/orkaudio/audiocaptureplugins/voip/SipSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/SipSession.cpp
@@ -33,27 +33,29 @@ SipSession::SipSession()
m_lastUpdated = time(NULL);
m_log = Logger::getLogger("sipsession");
m_invitorIp.s_addr = 0;
+ m_invitorTcpPort = 0;
m_inviteeIp.s_addr = 0;
+ m_inviteeTcpPort = 0;
m_direction = CaptureEvent::DirUnkn;
}
void SipSession::Stop()
{
- LOG4CXX_DEBUG(m_log, m_ipAndPort + " SIP Session stop");
+ LOG4CXX_DEBUG(m_log, m_capturePort + " SIP Session stop");
CaptureEventRef stopEvent(new CaptureEvent);
stopEvent->m_type = CaptureEvent::EtStop;
stopEvent->m_timestamp = time(NULL);
- g_captureEventCallBack(stopEvent, m_ipAndPort);
+ g_captureEventCallBack(stopEvent, m_capturePort);
}
void SipSession::Start()
{
- LOG4CXX_DEBUG(m_log, m_ipAndPort + " SIP Session start");
- m_rtpRingBuffer.SetCapturePort(m_ipAndPort);
+ LOG4CXX_DEBUG(m_log, m_capturePort + " SIP Session start");
+ m_rtpRingBuffer.SetCapturePort(m_capturePort);
CaptureEventRef startEvent(new CaptureEvent);
startEvent->m_type = CaptureEvent::EtStart;
startEvent->m_timestamp = time(NULL);
- g_captureEventCallBack(startEvent, m_ipAndPort);
+ g_captureEventCallBack(startEvent, m_capturePort);
}
void SipSession::ProcessMetadataIncoming()
@@ -61,6 +63,7 @@ void SipSession::ProcessMetadataIncoming()
m_remoteParty = m_invite->m_from;
m_localParty = m_invite->m_to;
m_direction = CaptureEvent::DirIn;
+ m_capturePort.Format("%s,%d", ACE_OS::inet_ntoa(m_inviteeIp), m_inviteeTcpPort);
}
void SipSession::ProcessMetadataOutgoing()
@@ -68,6 +71,7 @@ void SipSession::ProcessMetadataOutgoing()
m_remoteParty = m_invite->m_to;
m_localParty = m_invite->m_from;
m_direction = CaptureEvent::DirOut;
+ m_capturePort.Format("%s,%d", ACE_OS::inet_ntoa(m_invitorIp), m_invitorTcpPort);
}
void SipSession::ProcessMetadata(RtpPacketInfoRef& rtpPacket)
@@ -78,10 +82,14 @@ void SipSession::ProcessMetadata(RtpPacketInfoRef& rtpPacket)
if(rtpPacket->m_sourceIp.s_addr == m_invitorIp.s_addr)
{
m_inviteeIp = rtpPacket->m_destIp;
+ m_inviteeTcpPort = rtpPacket->m_destPort;
+ m_invitorTcpPort = rtpPacket->m_sourcePort;
}
else if(rtpPacket->m_destIp.s_addr == m_invitorIp.s_addr)
{
m_inviteeIp = rtpPacket->m_sourceIp;
+ m_inviteeTcpPort = rtpPacket->m_sourcePort;
+ m_invitorTcpPort = rtpPacket->m_destPort;
}
else
{
@@ -121,7 +129,6 @@ void SipSession::ProcessMetadata(RtpPacketInfoRef& rtpPacket)
ProcessMetadataOutgoing();
}
}
- ReportMetadata();
}
void SipSession::ReportMetadata()
@@ -130,19 +137,19 @@ void SipSession::ReportMetadata()
CaptureEventRef event(new CaptureEvent());
event->m_type = CaptureEvent::EtLocalParty;
event->m_value = m_localParty;
- g_captureEventCallBack(event, m_ipAndPort);
+ g_captureEventCallBack(event, m_capturePort);
// Report remote party
event.reset(new CaptureEvent());
event->m_type = CaptureEvent::EtRemoteParty;
event->m_value = m_remoteParty;
- g_captureEventCallBack(event, m_ipAndPort);
+ g_captureEventCallBack(event, m_capturePort);
// report direction
event.reset(new CaptureEvent());
event->m_type = CaptureEvent::EtDirection;
event->m_value = CaptureEvent::DirectionToString(m_direction);
- g_captureEventCallBack(event, m_ipAndPort);
+ g_captureEventCallBack(event, m_capturePort);
}
@@ -151,8 +158,9 @@ void SipSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket)
// if first RTP packet, start session
if(m_lastRtpPacket.get() == NULL)
{
- Start();
ProcessMetadata(rtpPacket);
+ Start();
+ ReportMetadata();
}
m_lastRtpPacket = rtpPacket;
diff --git a/orkaudio/audiocaptureplugins/voip/SipSession.h b/orkaudio/audiocaptureplugins/voip/SipSession.h
index 4702bac..c1aa379 100644
--- a/orkaudio/audiocaptureplugins/voip/SipSession.h
+++ b/orkaudio/audiocaptureplugins/voip/SipSession.h
@@ -58,7 +58,9 @@ private:
RtpPacketInfoRef m_lastRtpPacket;
RtpRingBuffer m_rtpRingBuffer;
struct in_addr m_invitorIp;
+ int m_invitorTcpPort;
struct in_addr m_inviteeIp;
+ int m_inviteeTcpPort;
LoggerPtr m_log;
CStdString m_capturePort;
CStdString m_localParty;
diff --git a/orkaudio/config-template.xml b/orkaudio/config-template.xml
index a6f2092..abefe19 100644
--- a/orkaudio/config-template.xml
+++ b/orkaudio/config-template.xml
@@ -1,7 +1,7 @@
<!-- This is an example configuration file for the Oreka orkaudio capture service -->
<!-- Copy this to config.xml and modify according to taste -->
<config>
- <TrackerHostname>hostname</TrackerHostname>
+ <TrackerHostname>localhost</TrackerHostname>
<EnableReporting>true</EnableReporting>
<ClientTimeout>1000</ClientTimeout>
<CapturePluginPath>audiocaptureplugins/</CapturePluginPath>