summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2008-07-17 13:58:10 +0000
committerHenri Herscher <henri@oreka.org>2008-07-17 13:58:10 +0000
commit51ab6edcab824eca6dcf6b34f207aa99226b862c (patch)
tree5469e55cba07f1a4073c18f2f306f8cd725e2b4f
parent34724e7903c9b9ee2c1ce90addfb571d77049855 (diff)
Added SkinnyCallInfoStopsPrevious config parameter. This allows a new CallInfo to stop the previous session on the same Skinny endpoint and line instance.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@552 09dcff7a-b715-0410-9601-b79a96267cd0
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp45
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.h4
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp4
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp2
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.h1
5 files changed, 50 insertions, 6 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
index fe9ba07..a4ab00e 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
@@ -64,6 +64,7 @@ RtpSession::RtpSession(CStdString& trackingId)
m_currentDtmfVolume = 0;
m_sessionTelephoneEventPtDefined = false;
m_rtpIp.s_addr = 0;
+ m_skinnyLineInstance = 0;
}
void RtpSession::Stop()
@@ -1226,6 +1227,8 @@ void RtpSessions::ReportSipBye(SipByeInfo bye)
void RtpSessions::UpdateSessionWithCallInfo(SkCallInfoStruct* callInfo, RtpSessionRef& session)
{
+ session->m_skinnyLineInstance = callInfo->lineInstance;
+
switch(callInfo->callType)
{
case SKINNY_CALL_TYPE_INBOUND:
@@ -1338,18 +1341,31 @@ void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruc
LOG4CXX_INFO(m_log, logMsg);
}
+ char szEndPointIp[16];
+ szEndPointIp[0] = '\0';
+
if(m_log->isInfoEnabled())
{
CStdString logMsg;
CStdString dir = CaptureEvent::DirectionToString(session->m_direction);
- char szEndPointIp[16];
ACE_OS::inet_ntop(AF_INET, (void*)&session->m_endPointIp, szEndPointIp, sizeof(szEndPointIp));
- logMsg.Format("[%s] Skinny CallInfo callId %s local:%s remote:%s dir:%s endpoint:%s", session->m_trackingId,
- session->m_callId, session->m_localParty, session->m_remoteParty, dir, szEndPointIp);
+ logMsg.Format("[%s] Skinny CallInfo callId %s local:%s remote:%s dir:%s line:%d endpoint:%s", session->m_trackingId,
+ session->m_callId, session->m_localParty, session->m_remoteParty, dir, session->m_skinnyLineInstance, szEndPointIp);
LOG4CXX_INFO(m_log, logMsg);
}
+ if(DLLCONFIG.m_skinnyCallInfoStopsPrevious == true)
+ {
+ RtpSessionRef previousSession = findByEndpointIpAndLineInstance(ipHeader->ip_dest, callInfo->lineInstance);
+ if(previousSession.get())
+ {
+ logMsg.Format("[%s] CallInfo stops [%s] line:%u endpoint:%s", session->m_trackingId, previousSession->m_trackingId, callInfo->lineInstance, szEndPointIp);
+ LOG4CXX_INFO(m_log, logMsg);
+ Stop(previousSession);
+ }
+ }
+
m_byCallId.insert(std::make_pair(session->m_callId, session));
CStdString numSessions = IntToString(m_byIpAndPort.size());
@@ -1404,6 +1420,29 @@ RtpSessionRef RtpSessions::findByEndpointIp(struct in_addr endpointIpAddr, int p
return session;
}
+// Find a session by Skinny endpoint IP address and by Skinny Line ID
+RtpSessionRef RtpSessions::findByEndpointIpAndLineInstance(struct in_addr endpointIpAddr, int lineInstance)
+{
+ RtpSessionRef session;
+ std::map<CStdString, RtpSessionRef>::iterator pair;
+
+ // Scan all sessions and try to find a session on the same IP endpoint
+ for(pair = m_byCallId.begin(); pair != m_byCallId.end(); pair++)
+ {
+ RtpSessionRef tmpSession = pair->second;
+
+ if((unsigned int)tmpSession->m_endPointIp.s_addr == (unsigned int)endpointIpAddr.s_addr)
+ {
+ if(tmpSession->m_skinnyLineInstance == lineInstance)
+ {
+ session = tmpSession;
+ break;
+ }
+ }
+ }
+ return session;
+}
+
RtpSessionRef RtpSessions::findNewestByEndpointIp(struct in_addr endpointIpAddr)
{
RtpSessionRef session;
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h
index ce4b96c..abf7787 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.h
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h
@@ -148,6 +148,7 @@ public:
struct in_addr m_endPointIp; // only used for Skinny
int m_skinnyPassThruPartyId;
ACE_Time_Value m_skinnyLastCallInfoTime;
+ int m_skinnyLineInstance;
bool m_onHold;
bool m_keep;
bool m_nonLookBackSessionStarted;
@@ -230,9 +231,10 @@ public:
void StartCapture(CStdString& party);
private:
- RtpSessionRef findByEndpointIp(struct in_addr, int passThruPartyId = 0);
+ RtpSessionRef findByEndpointIp(struct in_addr endpointIpAddr, int passThruPartyId = 0);
RtpSessionRef findNewestByEndpointIp(struct in_addr endpointIpAddr);
RtpSessionRef findByEndpointIpUsingIpAndPort(struct in_addr endpointIpAddr);
+ RtpSessionRef findByEndpointIpAndLineInstance(struct in_addr endpointIpAddr, int lineInstance);
bool ChangeCallId(RtpSessionRef& session, unsigned int newId);
void SetMediaAddress(RtpSessionRef& session, struct in_addr mediaIp, unsigned short mediaPort);
CStdString GenerateSkinnyCallId(struct in_addr endpointIp, unsigned int callId);
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index 0af85b5..54b3df8 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -1897,7 +1897,7 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea
{
if(s_skinnyPacketLog->isInfoEnabled())
{
- logMsg.Format(" CallId:%u calling:%s called:%s", callInfo->callId, callInfo->callingParty, callInfo->calledParty);
+ logMsg.Format(" CallId:%u calling:%s called:%s line:%d", callInfo->callId, callInfo->callingParty, callInfo->calledParty, callInfo->lineInstance);
}
RtpSessionsSingleton::instance()->ReportSkinnyCallInfo(callInfo, ipHeader);
}
@@ -2009,7 +2009,7 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea
if(SkinnyValidateSoftKeyEvent(softKeyEvent, packetEnd))
{
useful = true;
- logMsg.Format(" eventString:%s eventNum:%d lineInstance:%lu callId:%lu",
+ logMsg.Format(" eventString:%s eventNum:%d line:%lu callId:%lu",
SoftKeyEvent::SoftKeyEventToString(softKeyEvent->softKeyEvent),
softKeyEvent->softKeyEvent,
softKeyEvent->lineInstance,
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
index cd95e03..f0701df 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
@@ -56,6 +56,7 @@ VoIpConfig::VoIpConfig()
m_skinnyAllowCallInfoUpdate = false;
m_skinnyAllowLateCallInfo = false;
m_skinnyNameAsLocalParty = false;
+ m_skinnyCallInfoStopsPrevious = false;
m_sangomaEnable = false;
m_sangomaRxTcpPortStart = 0;
@@ -118,6 +119,7 @@ void VoIpConfig::Define(Serializer* s)
s->IntValue("SkinnyTcpPort", m_skinnyTcpPort);
s->BoolValue("SkinnyAllowLateCallInfo", m_skinnyAllowLateCallInfo);
s->BoolValue("SkinnyNameAsLocalParty", m_skinnyNameAsLocalParty);
+ s->BoolValue("SkinnyCallInfoStopsPrevious", m_skinnyCallInfoStopsPrevious);
s->CsvValue("SkinnyReportTags", m_skinnyReportTags);
s->IntValue("SangomaRxTcpPortStart", m_sangomaRxTcpPortStart);
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
index 56bab46..d8a4a6d 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
@@ -91,6 +91,7 @@ public:
bool m_skinnyAllowCallInfoUpdate;
bool m_skinnyAllowLateCallInfo;
bool m_skinnyNameAsLocalParty;
+ bool m_skinnyCallInfoStopsPrevious;
std::list<CStdString> m_skinnyReportTags;
std::list<CStdString> m_dnisNumbers;