diff options
author | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-08-10 09:04:31 +0000 |
---|---|---|
committer | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-08-10 09:04:31 +0000 |
commit | 526cb3fffa3fc1e8091af575b224c081eb798f16 (patch) | |
tree | f3e4db3d62b34092438fe722823cf641ac6f89eb /orkaudio/audiocaptureplugins/voip/VoIp.cpp | |
parent | f514b2da9713da1dc3fd5fca983bdcfaeeefed3d (diff) |
Changed the method of logging failed calls so that the failed calls are associated with a session
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@463 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins/voip/VoIp.cpp')
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIp.cpp | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index 9b357b1..b4ecff7 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -68,7 +68,6 @@ static unsigned int s_numPacketsPerSecond; static unsigned int s_minPacketsPerSecond; static unsigned int s_maxPacketsPerSecond; static std::list<SipTcpStreamRef> s_SipTcpStreams; -static std::list<SipInviteInfoRef> s_SipInvites; VoIpConfigTopObjectRef g_VoIpConfigTopObjectRef; #define DLLCONFIG g_VoIpConfigTopObjectRef.get()->m_config @@ -1092,13 +1091,11 @@ bool TryLogFailedSip(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHea int sipLength = ntohs(udpHeader->len) - sizeof(UdpHeaderStruct); char* sipEnd = (char*)udpPayload + sipLength; - CStdString callId, errorCode, logMsg; - std::list<SipInviteInfoRef> toErase; - bool result = false; + CStdString callId, errorCode, logMsg, errorString; if(sipLength < 9 || sipEnd > (char*)packetEnd) { - return false; + return false; } if((memcmp("SIP/2.0 4", (void*)udpPayload, 9) == 0) || @@ -1117,46 +1114,40 @@ bool TryLogFailedSip(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHea if((memcmp("CANCEL ", (void*)udpPayload, 7) == 0)) { errorCode.Format("CANCEL"); + errorString.Format("User Agent CANCEL"); } else { if(eCode) { - GrabLine(eCode, sipEnd, errorCode); + GrabTokenSkipLeadingWhitespaces(eCode, sipEnd, errorCode); + GrabLine((eCode+errorCode.size()+1), sipEnd, errorString); } } } - if(callId.size() && errorCode.size()) + if(!(callId.size() && errorCode.size())) { - result = true; + return false; } - int found = 0; + SipFailureMessageInfoRef info(new SipFailureMessageInfo()); + info->m_senderIp = ipHeader->ip_src; + info->m_receiverIp = ipHeader->ip_dest; + memcpy(info->m_senderMac, ethernetHeader->sourceMac, sizeof(info->m_senderMac)); + memcpy(info->m_receiverMac, ethernetHeader->destinationMac, sizeof(info->m_receiverMac)); + info->m_callId = callId; + info->m_errorCode = errorCode; + info->m_errorString = errorString; - for(std::list<SipInviteInfoRef>::iterator it = s_SipInvites.begin(); it != s_SipInvites.end(); it++) - { - SipInviteInfoRef inviteInfo = *it; + CStdString sipError; - if(callId.size() && (inviteInfo->m_callId.CompareNoCase(callId) == 0) && !found) { - found = 1; - logMsg.Format("SIP INVITE (call-id:%s) failed (\"%s\")", - inviteInfo->m_callId, errorCode); - LOG4CXX_INFO(s_sipPacketLog, logMsg); - toErase.push_back(inviteInfo); - } else { - if((time(NULL) - inviteInfo->m_recvTime) >= 60) - toErase.push_back(inviteInfo); - } - } + info->ToString(sipError); + LOG4CXX_INFO(s_sipPacketLog, "SIP Error packet: " + sipError); - for(std::list<SipInviteInfoRef>::iterator it2 = toErase.begin(); it2 != toErase.end(); it2++) - { - SipInviteInfoRef inviteInfo = *it2; - s_SipInvites.remove(inviteInfo); - } + RtpSessionsSingleton::instance()->ReportSipErrorPacket(info); - return result; + return true; } static bool SipByeTcpToUdp(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader,TcpHeaderStruct* tcpHeader, u_char *pBuffer, int bLength) @@ -1479,7 +1470,6 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader if(drop == false && info->m_fromRtpPort.size() && info->m_from.size() && info->m_to.size() && info->m_callId.size()) { RtpSessionsSingleton::instance()->ReportSipInvite(info); - s_SipInvites.push_back(info); } } return result; |