From c059289a05edf37e4e01a1736a4f78a456b19879 Mon Sep 17 00:00:00 2001 From: Gerald Begumisa Date: Tue, 8 Sep 2009 16:25:39 +0000 Subject: Modified the skinny code so that when CallInfo is received for a call which has been forwarded, we use the endpoint extension as the local party, and set the local entry point to the local party which would have been extracted from the CallInfo for an ordinary (non-forwarded) call. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@640 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 100 +++++++++++++++++------ orkaudio/audiocaptureplugins/voip/RtpSession.h | 2 + orkaudio/audiocaptureplugins/voip/VoIp.cpp | 8 +- 3 files changed, 79 insertions(+), 31 deletions(-) diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index d60223c..b9bc898 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -1627,20 +1627,57 @@ void RtpSessions::ReportSipBye(SipByeInfoRef& bye) } } +void RtpSessions::UpdateEndpointWithCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruct* ipHeader) +{ + CStdString extension; + + switch(callInfo->callType) + { + case SKINNY_CALL_TYPE_INBOUND: + { + extension = callInfo->calledParty; + SetEndpointExtension(extension, &ipHeader->ip_dest); + break; + } + case SKINNY_CALL_TYPE_OUTBOUND: + { + extension = callInfo->callingParty; + SetEndpointExtension(extension, &ipHeader->ip_dest); + break; + } + } +} + void RtpSessions::UpdateSessionWithCallInfo(SkCallInfoStruct* callInfo, RtpSessionRef& session) { session->m_skinnyLineInstance = callInfo->lineInstance; CStdString lp; + CStdString logMsg; + char szEndPointIp[16]; + + EndpointInfoRef endpoint = GetEndpointInfo(session->m_endPointIp); + ACE_OS::inet_ntop(AF_INET, (void*)&session->m_endPointIp, szEndPointIp, sizeof(szEndPointIp)); switch(callInfo->callType) { case SKINNY_CALL_TYPE_INBOUND: - case SKINNY_CALL_TYPE_FORWARD: lp = callInfo->calledParty; session->m_localParty = GetLocalPartyMap(lp); session->m_remoteParty = callInfo->callingParty; session->m_direction = CaptureEvent::DirIn; break; + case SKINNY_CALL_TYPE_FORWARD: + lp = callInfo->calledParty; + if(endpoint.get() && ((endpoint->m_extension).size() > 0)) + { + session->m_localParty = GetLocalPartyMap(endpoint->m_extension); + session->m_localEntryPoint = lp; + logMsg.Format("[%s] callType is FORWARD: set localparty:%s (obtained from endpoint:%s)", session->m_trackingId, session->m_localParty, szEndPointIp); + LOG4CXX_DEBUG(m_log, logMsg); + } + session->m_remoteParty = callInfo->callingParty; + session->m_direction = CaptureEvent::DirIn; + break; case SKINNY_CALL_TYPE_OUTBOUND: lp = callInfo->callingParty; session->m_localParty = GetLocalPartyMap(lp); @@ -1654,12 +1691,13 @@ void RtpSessions::UpdateSessionWithCallInfo(SkCallInfoStruct* callInfo, RtpSessi } } - void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruct* ipHeader) { CStdString callId = GenerateSkinnyCallId(ipHeader->ip_dest, callInfo->callId); CStdString logMsg; + UpdateEndpointWithCallInfo(callInfo, ipHeader); + std::map::iterator pair; pair = m_byCallId.find(callId); @@ -2233,36 +2271,44 @@ void RtpSessions::ReportSkinnyStopMediaTransmission(SkStopMediaTransmissionStruc } } +void RtpSessions::SetEndpointExtension(CStdString& extension, struct in_addr* endpointIp) +{ + std::map::iterator pair; + EndpointInfoRef endpoint; + + pair = m_endpoints.find((unsigned int)(endpointIp->s_addr)); + if(pair != m_endpoints.end()) + { + // Update the existing endpoint info + endpoint = pair->second; + endpoint->m_extension = extension; + } + else + { + // Create endpoint info for the new endpoint + endpoint.reset(new EndpointInfo()); + endpoint->m_extension = extension; + m_endpoints.insert(std::make_pair((unsigned int)(endpointIp->s_addr), endpoint)); + } + if(endpoint.get()) + { + CStdString logMsg; + char szEndpointIp[16]; + ACE_OS::inet_ntop(AF_INET, (void*)endpointIp, szEndpointIp, sizeof(szEndpointIp)); + + logMsg.Format("Extension:%s is on endpoint:%s", endpoint->m_extension, szEndpointIp); + LOG4CXX_INFO(m_log, logMsg); + } +} + void RtpSessions::ReportSkinnyLineStat(SkLineStatStruct* lineStat, IpHeaderStruct* ipHeader) { if(strlen(lineStat->lineDirNumber) > 1) { - EndpointInfoRef endpoint; - std::map::iterator pair; - pair = m_endpoints.find((unsigned int)(ipHeader->ip_dest.s_addr)); - if(pair != m_endpoints.end()) - { - // Update the existing endpoint info - endpoint = pair->second; - endpoint->m_extension = lineStat->lineDirNumber; + CStdString extension; - } - else - { - // Create endpoint info for the new endpoint - endpoint.reset(new EndpointInfo()); - endpoint->m_extension = lineStat->lineDirNumber; - m_endpoints.insert(std::make_pair((unsigned int)(ipHeader->ip_dest.s_addr), endpoint)); - } - if(endpoint.get()) - { - CStdString logMsg; - char szEndpointIp[16]; - ACE_OS::inet_ntop(AF_INET, (void*)&ipHeader->ip_dest, szEndpointIp, sizeof(szEndpointIp)); - - logMsg.Format("Extension:%s is on endpoint:%s", endpoint->m_extension, szEndpointIp); - LOG4CXX_INFO(m_log, logMsg); - } + extension = lineStat->lineDirNumber; + SetEndpointExtension(extension, &ipHeader->ip_dest); } } diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h index 0d88d77..a205e63 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.h +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h @@ -264,6 +264,7 @@ public: void ReportSkinnyStartMediaTransmission(SkStartMediaTransmissionStruct*, IpHeaderStruct* ipHeader); void ReportSkinnyStopMediaTransmission(SkStopMediaTransmissionStruct*, IpHeaderStruct* ipHeader); void ReportSkinnyOpenReceiveChannelAck(SkOpenReceiveChannelAckStruct*); + void SetEndpointExtension(CStdString& extension, struct in_addr* endpointIp); void ReportSkinnyLineStat(SkLineStatStruct*, IpHeaderStruct* ipHeader); void ReportSkinnySoftKeyHold(SkSoftKeyEventMessageStruct* skEvent, IpHeaderStruct* ipHeader); void ReportSkinnySoftKeyResume(SkSoftKeyEventMessageStruct* skEvent, IpHeaderStruct* ipHeader); @@ -297,6 +298,7 @@ private: void SetMediaAddress(RtpSessionRef& session, struct in_addr mediaIp, unsigned short mediaPort); void MapOtherMediaAddress(RtpSessionRef& session, CStdString& ipAndPort); CStdString GenerateSkinnyCallId(struct in_addr endpointIp, unsigned int callId); + void UpdateEndpointWithCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruct* ipHeader); void UpdateSessionWithCallInfo(SkCallInfoStruct*, RtpSessionRef&); std::map m_byIpAndPort; diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index c88dda7..84d52d3 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -2570,9 +2570,9 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea { if(s_skinnyPacketLog->isInfoEnabled()) { - logMsg.Format(" CallId:%u calling:%s called:%s callingname:%s calledname:%s line:%d", + logMsg.Format(" CallId:%u calling:%s called:%s callingname:%s calledname:%s line:%d callType:%d", callInfo->callId, callInfo->callingParty, callInfo->calledParty, - callInfo->callingPartyName, callInfo->calledPartyName, callInfo->lineInstance); + callInfo->callingPartyName, callInfo->calledPartyName, callInfo->lineInstance, callInfo->callType); } RtpSessionsSingleton::instance()->ReportSkinnyCallInfo(callInfo, ipHeader); } @@ -2683,8 +2683,8 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea if(s_skinnyPacketLog->isInfoEnabled()) { - logMsg.Format(" CallId:%u calling:%s called:%s callingname:%s calledname:%s", callInfo.callId, - callInfo.callingParty, callInfo.calledParty, callInfo.callingPartyName, callInfo.calledPartyName); + logMsg.Format(" CallId:%u calling:%s called:%s callingname:%s calledname:%s callType:%d", callInfo.callId, + callInfo.callingParty, callInfo.calledParty, callInfo.callingPartyName, callInfo.calledPartyName, callInfo.callType); } RtpSessionsSingleton::instance()->ReportSkinnyCallInfo(&callInfo, ipHeader); } -- cgit v1.2.3