summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Begumisa <ben_g@users.sourceforge.net>2008-07-01 20:44:04 +0000
committerGerald Begumisa <ben_g@users.sourceforge.net>2008-07-01 20:44:04 +0000
commit8971a80d7afa112ebe8a75e7edeac5f7d98ab759 (patch)
treec778cb553483970576c36926c8ad01bcdc3f22a2
parent54517da801e2afae241fd02ab84a34add755c149 (diff)
A new configuration parameter, SkinnyNameAsLocalParty, has been added for the VoIpConfig section in config.xml. When this parameter is set to true, the local party is reported as a name and not telephone number, where available in Skinny sessions. Another configuration parameter, SkinnyReportTags, has been added for the VoIpConfig section in config.xml. This parameter should be populated with a comma-separated list of Skinny variables to report. Initially supported values are 'localpartyname' and 'callmanager'.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@549 09dcff7a-b715-0410-9601-b79a96267cd0
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp103
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.h3
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp45
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp3
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIpConfig.h2
5 files changed, 153 insertions, 3 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
index 208e161..fe9ba07 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
@@ -208,6 +208,21 @@ bool RtpSession::MatchesSipDomain(CStdString& domain)
return false;
}
+bool RtpSession::IsInSkinnyReportingList(CStdString item)
+{
+ for(std::list<CStdString>::iterator it = DLLCONFIG.m_skinnyReportTags.begin(); it != DLLCONFIG.m_skinnyReportTags.end(); it++)
+ {
+ CStdString element = *it;
+
+ if(element.CompareNoCase(item) == 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void RtpSession::ProcessMetadataSipIncoming()
{
m_remoteParty = m_invite->m_from;
@@ -243,7 +258,14 @@ void RtpSession::UpdateMetadataSkinny()
// Report Local party
CaptureEventRef event(new CaptureEvent());
event->m_type = CaptureEvent::EtLocalParty;
- event->m_value = m_localParty;
+ if(DLLCONFIG.m_skinnyNameAsLocalParty == true && m_localPartyName.size())
+ {
+ event->m_value = m_localPartyName;
+ }
+ else
+ {
+ event->m_value = m_localParty;
+ }
g_captureEventCallBack(event, m_capturePort);
// Report remote party
@@ -489,7 +511,14 @@ void RtpSession::ReportMetadata()
// Report Local party
CaptureEventRef event(new CaptureEvent());
event->m_type = CaptureEvent::EtLocalParty;
- event->m_value = m_localParty;
+ if(m_protocol == ProtSkinny && DLLCONFIG.m_skinnyNameAsLocalParty == true && m_localPartyName.size())
+ {
+ event->m_value = m_localPartyName;
+ }
+ else
+ {
+ event->m_value = m_localParty;
+ }
g_captureEventCallBack(event, m_capturePort);
// Report remote party
@@ -945,6 +974,41 @@ bool RtpSession::PartyMatches(CStdString &party)
return false;
}
+void RtpSession::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruct* ipHeader)
+{
+ std::map<CStdString, CStdString>::iterator pair;
+
+ if(IsInSkinnyReportingList(CStdString("localpartyname")))
+ {
+ CStdString key, value;
+
+ key = "localpartyname";
+ value = callInfo->callingPartyName;
+
+ pair = m_tags.find(key);
+ if(pair == m_tags.end())
+ {
+ m_tags.insert(std::make_pair(key, value));
+ }
+ }
+
+ if(IsInSkinnyReportingList(CStdString("callmanager")))
+ {
+ CStdString key, value;
+ char szIp[16];
+
+ ACE_OS::inet_ntop(AF_INET, (void*)&ipHeader->ip_src, szIp, sizeof(szIp));
+ key = "callmanager";
+ value = szIp;
+
+ pair = m_tags.find("callmanager");
+ if(pair == m_tags.end())
+ {
+ m_tags.insert(std::make_pair(key, value));
+ }
+ }
+}
+
//=====================================================================
RtpSessions::RtpSessions()
{
@@ -1185,6 +1249,8 @@ void RtpSessions::UpdateSessionWithCallInfo(SkCallInfoStruct* callInfo, RtpSessi
void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruct* ipHeader)
{
CStdString callId = GenerateSkinnyCallId(ipHeader->ip_dest, callInfo->callId);
+ CStdString logMsg;
+
std::map<CStdString, RtpSessionRef>::iterator pair;
pair = m_byCallId.find(callId);
@@ -1194,10 +1260,24 @@ void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruc
// just update timestamp
RtpSessionRef existingSession = pair->second;
existingSession->m_skinnyLastCallInfoTime = ACE_OS::gettimeofday();
+
+ if(DLLCONFIG.m_skinnyNameAsLocalParty == true)
+ {
+ if(!(existingSession->m_localPartyName).size())
+ {
+ (existingSession->m_localPartyName).Format("%s", callInfo->callingPartyName);
+ logMsg.Format("[%s] setting localpartyname:%s", existingSession->m_trackingId, callInfo->callingPartyName);
+ LOG4CXX_INFO(m_log, logMsg);
+ }
+ }
+
if(DLLCONFIG.m_skinnyAllowCallInfoUpdate)
{
UpdateSessionWithCallInfo(callInfo, existingSession);
}
+
+ existingSession->ReportSkinnyCallInfo(callInfo, ipHeader);
+
return;
}
@@ -1212,6 +1292,17 @@ void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruc
ipPortSession->m_callId = callId;
UpdateSessionWithCallInfo(callInfo, ipPortSession);
ipPortSession->UpdateMetadataSkinny();
+ ipPortSession->ReportSkinnyCallInfo(callInfo, ipHeader);
+
+ if(DLLCONFIG.m_skinnyNameAsLocalParty == true)
+ {
+ if(!(ipPortSession->m_localPartyName).size())
+ {
+ (ipPortSession->m_localPartyName).Format("%s", callInfo->callingPartyName);
+ logMsg.Format("[%s] setting localpartyname:%s", ipPortSession->m_trackingId, callInfo->callingPartyName);
+ LOG4CXX_INFO(m_log, logMsg);
+ }
+ }
if(m_log->isInfoEnabled())
{
@@ -1238,6 +1329,14 @@ void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruc
session->m_endPointIp = ipHeader->ip_dest; // CallInfo message always goes from CM to endpoint
session->m_protocol = RtpSession::ProtSkinny;
UpdateSessionWithCallInfo(callInfo, session);
+ session->ReportSkinnyCallInfo(callInfo, ipHeader);
+
+ if(DLLCONFIG.m_skinnyNameAsLocalParty == true)
+ {
+ (session->m_localPartyName).Format("%s", callInfo->callingPartyName);
+ logMsg.Format("[%s] setting localpartyname:%s", session->m_trackingId, callInfo->callingPartyName);
+ LOG4CXX_INFO(m_log, logMsg);
+ }
if(m_log->isInfoEnabled())
{
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h
index 08da190..ce4b96c 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.h
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h
@@ -128,6 +128,7 @@ public:
bool OrkUidMatches(CStdString &oUid);
bool PartyMatches(CStdString &party);
void UpdateMetadataSkinny();
+ void ReportSkinnyCallInfo(SkCallInfoStruct*, IpHeaderStruct* ipHeader);
CStdString m_capturePort;
CStdString m_trackingId;
@@ -141,6 +142,7 @@ public:
ProtocolEnum m_protocol;
CStdString m_localParty;
CStdString m_remoteParty;
+ CStdString m_localPartyName;
CaptureEvent::DirectionEnum m_direction;
int m_numRtpPackets;
struct in_addr m_endPointIp; // only used for Skinny
@@ -163,6 +165,7 @@ private:
void RecordRtpEvent();
bool MatchesSipDomain(CStdString& domain);
bool MatchesReferenceAddresses(struct in_addr inAddr);
+ bool IsInSkinnyReportingList(CStdString item);
RtpPacketInfoRef m_lastRtpPacket;
RtpPacketInfoRef m_lastRtpPacketSide1;
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index 130c720..0af85b5 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -146,6 +146,16 @@ void GrabToken(char* in, char* limit, CStdString& out)
}
}
+// Same as GrabToken but includes spaces in the token grabbed as opposed to stopping
+// when a space is encountered
+void GrabTokenAcceptSpace(char* in, char* limit, CStdString& out)
+{
+ for(char* c = in; *c != '\0' && *c != 0x0D && *c != 0x0A && c<limit; c = c+1)
+ {
+ out += *c;
+ }
+}
+
// Same as GrabToken but skipping leading whitespaces
void GrabTokenSkipLeadingWhitespaces(char* in, char* limit, CStdString& out)
{
@@ -1907,6 +1917,23 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea
GrabToken(parties, parties+SKINNY_CCM5_PARTIES_BLOCK_SIZE, callingParty);
CStdString calledParty;
GrabToken(parties+callingParty.size()+1, parties+SKINNY_CCM5_PARTIES_BLOCK_SIZE, calledParty);
+ CStdString callingPartyName;
+
+ if(DLLCONFIG.m_skinnyNameAsLocalParty)
+ {
+ // It appears that the calling party name is the 9th token
+ int tokenNr = 0;
+ char *partiesPtr = NULL;
+
+ partiesPtr = parties;
+ while(tokenNr < 9 && partiesPtr < parties+SKINNY_CCM5_PARTIES_BLOCK_SIZE)
+ {
+ callingPartyName = "";
+ GrabTokenAcceptSpace(partiesPtr, parties+SKINNY_CCM5_PARTIES_BLOCK_SIZE, callingPartyName);
+ partiesPtr += callingPartyName.size() + 1;
+ tokenNr += 1;
+ }
+ }
// Emulate a regular CCM CallInfo message
SkCallInfoStruct callInfo;
@@ -1916,7 +1943,23 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea
callInfo.callType = ccm5CallInfo->callType;
callInfo.lineInstance = 0;
callInfo.calledPartyName[0] = '\0';
- callInfo.callingPartyName[0] = '\0';
+
+ if(DLLCONFIG.m_skinnyNameAsLocalParty)
+ {
+ if(callingPartyName.size())
+ {
+ strncpy(callInfo.callingPartyName, (PCSTR)callingPartyName, sizeof(callInfo.callingPartyName));
+ }
+ else
+ {
+ callInfo.callingPartyName[0] = '\0';
+ }
+ }
+ else
+ {
+ callInfo.callingPartyName[0] = '\0';
+ }
+
if(s_skinnyPacketLog->isInfoEnabled())
{
logMsg.Format(" CallId:%u calling:%s called:%s", callInfo.callId, callInfo.callingParty, callInfo.calledParty);
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
index d9a0ebb..cd95e03 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp
@@ -55,6 +55,7 @@ VoIpConfig::VoIpConfig()
m_skinnyDynamicMediaAddress = false;
m_skinnyAllowCallInfoUpdate = false;
m_skinnyAllowLateCallInfo = false;
+ m_skinnyNameAsLocalParty = false;
m_sangomaEnable = false;
m_sangomaRxTcpPortStart = 0;
@@ -116,6 +117,8 @@ void VoIpConfig::Define(Serializer* s)
s->BoolValue("SkinnyAllowCallInfoUpdate", m_skinnyAllowCallInfoUpdate);
s->IntValue("SkinnyTcpPort", m_skinnyTcpPort);
s->BoolValue("SkinnyAllowLateCallInfo", m_skinnyAllowLateCallInfo);
+ s->BoolValue("SkinnyNameAsLocalParty", m_skinnyNameAsLocalParty);
+ s->CsvValue("SkinnyReportTags", m_skinnyReportTags);
s->IntValue("SangomaRxTcpPortStart", m_sangomaRxTcpPortStart);
s->IntValue("SangomaTxTcpPortStart", m_sangomaTxTcpPortStart);
diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
index 47a7351..56bab46 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
+++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h
@@ -90,6 +90,8 @@ public:
bool m_skinnyDynamicMediaAddress;
bool m_skinnyAllowCallInfoUpdate;
bool m_skinnyAllowLateCallInfo;
+ bool m_skinnyNameAsLocalParty;
+ std::list<CStdString> m_skinnyReportTags;
std::list<CStdString> m_dnisNumbers;
std::list<CStdString> m_sipExtractFields;