summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp83
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.h3
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp61
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp2
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.h1
-rw-r--r--orkbasecxx/AudioTape.cpp5
-rw-r--r--orkbasecxx/Utils.cpp22
-rw-r--r--orkbasecxx/Utils.h2
8 files changed, 177 insertions, 2 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
index ec8073d..92cc1f0 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
@@ -331,6 +331,19 @@ void RtpSession::ProcessMetadataSipIncoming()
{
m_remoteParty = m_invite->m_from;
m_localParty = m_invite->m_to;
+
+ m_remotePartyName = m_invite->m_fromName;
+ m_localPartyName = m_invite->m_toName;
+
+ if(!m_remotePartyName.size())
+ {
+ m_remotePartyName = m_remoteParty;
+ }
+ if(!m_localPartyName.size())
+ {
+ m_localPartyName = m_localParty;
+ }
+
m_direction = CaptureEvent::DirIn;
char szInviteeIp[16];
ACE_OS::inet_ntop(AF_INET, (void*)&m_inviteeIp, szInviteeIp, sizeof(szInviteeIp));
@@ -346,6 +359,19 @@ void RtpSession::ProcessMetadataSipOutgoing()
{
m_remoteParty = m_invite->m_to;
m_localParty = m_invite->m_from;
+
+ m_remotePartyName = m_invite->m_toName;
+ m_localPartyName = m_invite->m_fromName;
+
+ if(!m_remotePartyName.size())
+ {
+ m_remotePartyName = m_remoteParty;
+ }
+ if(!m_localPartyName.size())
+ {
+ m_localPartyName = m_localParty;
+ }
+
m_direction = CaptureEvent::DirOut;
char szInvitorIp[16];
ACE_OS::inet_ntop(AF_INET, (void*)&m_invitorIp, szInvitorIp, sizeof(szInvitorIp));
@@ -420,6 +446,19 @@ void RtpSession::UpdateMetadataSip(RtpPacketInfoRef& rtpPacket, bool sourceRtpAd
// Update session metadata with INVITE info
m_remoteParty = invite->m_from;
m_localParty = invite->m_to;
+
+ m_remotePartyName = m_invite->m_fromName;
+ m_localPartyName = m_invite->m_toName;
+
+ if(!m_remotePartyName.size())
+ {
+ m_remotePartyName = m_remoteParty;
+ }
+ if(!m_localPartyName.size())
+ {
+ m_localPartyName = m_localParty;
+ }
+
m_localIp = invite->m_receiverIp;
memcpy(m_localMac, invite->m_receiverMac, sizeof(m_localMac));
@@ -444,6 +483,27 @@ void RtpSession::UpdateMetadataSip(RtpPacketInfoRef& rtpPacket, bool sourceRtpAd
event->m_value = m_remoteParty;
g_captureEventCallBack(event, m_capturePort);
+ if(DLLCONFIG.m_sipReportNamesAsTags == true)
+ {
+ CStdString key, value;
+
+ key = "localname";
+ value = m_localPartyName;
+ event.reset(new CaptureEvent());
+ event->m_type = CaptureEvent::EtKeyValue;
+ event->m_key = key;
+ event->m_value = value;
+ g_captureEventCallBack(event, m_capturePort);
+
+ key = "remotename";
+ value = m_remotePartyName;
+ event.reset(new CaptureEvent());
+ event->m_type = CaptureEvent::EtKeyValue;
+ event->m_key = key;
+ event->m_value = value;
+ g_captureEventCallBack(event, m_capturePort);
+ }
+
// Report Local IP
char szLocalIp[16];
ACE_OS::inet_ntop(AF_INET, (void*)&m_localIp, szLocalIp, sizeof(szLocalIp));
@@ -633,6 +693,27 @@ void RtpSession::ReportMetadata()
g_captureEventCallBack(event, m_capturePort);
m_remotePartyReported = true;
+ if(DLLCONFIG.m_sipReportNamesAsTags == true)
+ {
+ CStdString key, value;
+
+ key = "localname";
+ value = m_localPartyName;
+ event.reset(new CaptureEvent());
+ event->m_type = CaptureEvent::EtKeyValue;
+ event->m_key = key;
+ event->m_value = value;
+ g_captureEventCallBack(event, m_capturePort);
+
+ key = "remotename";
+ value = m_remotePartyName;
+ event.reset(new CaptureEvent());
+ event->m_type = CaptureEvent::EtKeyValue;
+ event->m_key = key;
+ event->m_value = value;
+ g_captureEventCallBack(event, m_capturePort);
+ }
+
// Report direction
event.reset(new CaptureEvent());
event->m_type = CaptureEvent::EtDirection;
@@ -2531,7 +2612,7 @@ void SipInviteInfo::ToString(CStdString& string)
MemMacToHumanReadable((unsigned char*)m_senderMac, senderMac);
MemMacToHumanReadable((unsigned char*)m_receiverMac, receiverMac);
- string.Format("sender:%s from:%s@%s RTP:%s,%s to:%s@%s rcvr:%s callid:%s smac:%s rmac:%s", senderIp, m_from, m_fromDomain, fromRtpIp, m_fromRtpPort, m_to, m_toDomain, receiverIp, m_callId, senderMac, receiverMac);
+ string.Format("sender:%s from:%s@%s RTP:%s,%s to:%s@%s rcvr:%s callid:%s smac:%s rmac:%s fromname:%s toname:%s", senderIp, m_from, m_fromDomain, fromRtpIp, m_fromRtpPort, m_to, m_toDomain, receiverIp, m_callId, senderMac, receiverMac, m_fromName, m_toName);
}
//==========================================================
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h
index 6695985..3626936 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.h
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h
@@ -46,6 +46,8 @@ public:
bool m_telephoneEventPtDefined;
CStdString m_fromDomain;
CStdString m_toDomain;
+ CStdString m_fromName;
+ CStdString m_toName;
time_t m_recvTime;
};
@@ -165,6 +167,7 @@ public:
CStdString m_localParty;
CStdString m_remoteParty;
CStdString m_localPartyName;
+ CStdString m_remotePartyName;
bool m_localPartyReported;
bool m_remotePartyReported;
bool m_rtcpLocalParty;
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index 63fa355..66604dc 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -119,6 +119,18 @@ void memToHex(unsigned char* input, size_t len, CStdString&output)
}
}
+static char* memFindStr(char* toFind, char* start, char* stop)
+{
+ for(char * ptr = start; (ptr<stop) && (ptr != NULL); ptr = (char *)memchr(ptr+1, toFind[0],(stop-ptr)))
+ {
+ if(strncasecmp(toFind, ptr, (strlen(toFind) > (stop-ptr) ? (stop-ptr) : strlen(toFind))) == 0)
+ {
+ return (ptr);
+ }
+ }
+ return NULL;
+}
+
// find the address that follows the given search string between start and stop pointers - case insensitive
char* memFindAfter(char* toFind, char* start, char* stop)
{
@@ -241,6 +253,45 @@ void GrabSipUriDomain(char* in, char* limit, CStdString& out)
}
}
+void GrabSipName(char* in, char* limit, CStdString& out)
+{
+ char* nameStart = SkipWhitespaces(in, limit);
+ char* nameEnd = memFindStr("<sip:", nameStart, limit);
+
+ if(nameStart >= limit)
+ {
+ return;
+ }
+
+ if(nameEnd == NULL)
+ {
+ return;
+ }
+
+ if(nameEnd <= nameStart)
+ {
+ return;
+ }
+
+ // Get all characters before the <sip:
+ for(char *c = nameStart; c < nameEnd; c = c+1)
+ {
+ if(c == nameStart && *c == '"')
+ {
+ continue;
+ }
+ if(c+2 == nameEnd && *c == '"')
+ {
+ break;
+ }
+ if(c+1 == nameEnd && *c == ' ')
+ {
+ break;
+ }
+ out += *c;
+ }
+}
+
void GrabSipUserAddress(char* in, char* limit, CStdString& out)
{
char* userStart = SkipWhitespaces(in, limit);
@@ -2026,6 +2077,11 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader
char* fromFieldEnd = memFindEOL(fromField, sipEnd);
+ if(DLLCONFIG.m_sipReportNamesAsTags == true)
+ {
+ GrabSipName(fromField, fromFieldEnd, info->m_fromName);
+ }
+
char* sipUser = memFindAfter("sip:", fromField, fromFieldEnd);
if(sipUser)
{
@@ -2058,6 +2114,11 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader
char* toFieldEnd = GrabLine(toField, sipEnd, to);
LOG4CXX_DEBUG(s_sipExtractionLog, "to: " + to);
+ if(DLLCONFIG.m_sipReportNamesAsTags == true)
+ {
+ GrabSipName(toField, toFieldEnd, info->m_toName);
+ }
+
char* sipUser = memFindAfter("sip:", toField, toFieldEnd);
if(sipUser)
{
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
index 6b1946d..dbdd586 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
@@ -47,6 +47,7 @@ VoIpConfig::VoIpConfig()
m_sipReportFullAddress = false;
m_sipDynamicMediaAddress = false;
m_sipIgnoreBye = false;
+ m_sipReportNamesAsTags = false;
m_rtcpDetect = false;
m_inInMode = false;
@@ -116,6 +117,7 @@ void VoIpConfig::Define(Serializer* s)
s->BoolValue("SipDynamicMediaAddress", m_sipDynamicMediaAddress);
s->IpRangesValue("SipIgnoredMediaAddresses", m_sipIgnoredMediaAddresses);
s->BoolValue("SipIgnoreBye", m_sipIgnoreBye);
+ s->BoolValue("SipReportNamesAsTags", m_sipReportNamesAsTags);
s->BoolValue("RtcpDetect", m_rtcpDetect);
s->BoolValue("InInMode", m_inInMode);
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
index 078bb80..ccf7db8 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
@@ -84,6 +84,7 @@ public:
bool m_sipDynamicMediaAddress;
IpRanges m_sipIgnoredMediaAddresses;
bool m_sipIgnoreBye;
+ bool m_sipReportNamesAsTags;
bool m_rtcpDetect;
bool m_inInMode;
diff --git a/orkbasecxx/AudioTape.cpp b/orkbasecxx/AudioTape.cpp
index 336f492..fd152fa 100644
--- a/orkbasecxx/AudioTape.cpp
+++ b/orkbasecxx/AudioTape.cpp
@@ -838,6 +838,11 @@ void AudioTape::GenerateFinalFilePathAndIdentifier()
if(fileIdentifier.size() > 0)
{
+ CStdString newFileId;
+
+ FileEscapeName(fileIdentifier, newFileId);
+
+ fileIdentifier = newFileId;
m_fileIdentifier = fileIdentifier;
}
}
diff --git a/orkbasecxx/Utils.cpp b/orkbasecxx/Utils.cpp
index c06437f..dca2200 100644
--- a/orkbasecxx/Utils.cpp
+++ b/orkbasecxx/Utils.cpp
@@ -209,6 +209,28 @@ int FileSetOwnership(CStdString filename, CStdString owner, CStdString group)
return res;
}
+static char file_ok_chars[] = "-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
+static char hex_digits[17] = "0123456789ABCDEF";
+
+void FileEscapeName(CStdString& in, CStdString& out)
+{
+ // Translates all the characters that are not in file_ok_chars string into %xx sequences
+ // %xx specifies the character ascii code in hexadecimal
+ out = "";
+ for (int i = 0 ; i<in.size() ; i++)
+ {
+ if (strchr(file_ok_chars, in.GetAt(i)))
+ {
+ out += in.GetAt(i);
+ }
+ else
+ {
+ out += '%';
+ out += hex_digits[((unsigned char) in.GetAt(i)) >> 4];
+ out += hex_digits[in.GetAt(i) & 0x0F];
+ }
+ }
+}
//=====================================================
// TcpAddress
diff --git a/orkbasecxx/Utils.h b/orkbasecxx/Utils.h
index 610823d..31f059d 100644
--- a/orkbasecxx/Utils.h
+++ b/orkbasecxx/Utils.h
@@ -78,7 +78,7 @@ bool DLL_IMPORT_EXPORT_ORKBASE FileCanOpen(CStdString& path);
void DLL_IMPORT_EXPORT_ORKBASE FileRecursiveMkdir(CStdString& path, int permissions, CStdString owner, CStdString group, CStdString rootDirectory);
int DLL_IMPORT_EXPORT_ORKBASE FileSetPermissions(CStdString filename, int permissions);
int DLL_IMPORT_EXPORT_ORKBASE FileSetOwnership(CStdString filename, CStdString owner, CStdString group);
-
+void DLL_IMPORT_EXPORT_ORKBASE FileEscapeName(CStdString& in, CStdString& out);
//=====================================================
// threading related stuff