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 +++++++++++++++++------ 1 file changed, 73 insertions(+), 27 deletions(-) (limited to 'orkaudio/audiocaptureplugins/voip/RtpSession.cpp') 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); } } -- cgit v1.2.3