summaryrefslogtreecommitdiff
path: root/orkaudio
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2006-08-01 14:43:56 +0000
committerHenri Herscher <henri@oreka.org>2006-08-01 14:43:56 +0000
commit73d206c551c8af905f24336695d457ca3986c6e9 (patch)
tree054ca008c0070f0b4f864d8def77973ee6013531 /orkaudio
parent0182c73c34be9dea04a0274755bdba266cb0e7f9 (diff)
Applying changeset 269 from 0.5 to trunk:
Can now get local party info from the Skinny LineStatMessage. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@320 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio')
-rw-r--r--orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.cpp22
-rw-r--r--orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h15
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp58
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.h29
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp19
5 files changed, 123 insertions, 20 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.cpp b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.cpp
index 2d3cfe3..d0fa8a4 100644
--- a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.cpp
+++ b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.cpp
@@ -23,6 +23,10 @@ int SkinnyMessageToEnum(CStdString& msg)
{
msgEnum = SkCloseReceiveChannel;
}
+ else if (msg.CompareNoCase(SKINNY_MSG_LINE_STAT_MESSAGE) == 0)
+ {
+ msgEnum = SkLineStatMessage;
+ }
return msgEnum;
}
@@ -46,6 +50,9 @@ CStdString SkinnyMessageToString(int msgEnum)
case SkCloseReceiveChannel:
msgString = SKINNY_MSG_CLOSE_RECEIVE_CHANNEL;
break;
+ case SkLineStatMessage:
+ msgString = SKINNY_MSG_LINE_STAT_MESSAGE;
+ break;
default:
msgString = SKINNY_MSG_UNKN;
}
@@ -121,3 +128,18 @@ bool SkinnyValidateOpenReceiveChannelAck(SkOpenReceiveChannelAckStruct* orca)
}
return valid;
}
+
+bool SkinnyValidateLineStat(SkLineStatStruct* lineStat)
+{
+ bool valid = true;
+ if(valid)
+ {
+ valid = checkPartyString(lineStat->displayName, SKINNY_DISPLAY_NAME_SIZE);
+ }
+ if(valid)
+ {
+ valid = checkPartyString(lineStat->lineDirNumber, SKINNY_LINE_DIR_NUMBER_SIZE);
+ }
+ return valid;
+}
+
diff --git a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
index 57a9d8e..c861f66 100644
--- a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
+++ b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
@@ -90,6 +90,7 @@ typedef struct
//unsigned int csrc[1]; // optional CSRC list
} RtpHeaderStruct;
+//===================================================================
// Cisco Callmanager -> endpoint messages
typedef struct
{
@@ -154,6 +155,18 @@ typedef struct
char parties[76];
} SkNewCallInfoStruct;
+#define SKINNY_LINE_DIR_NUMBER_SIZE 24
+#define SKINNY_DISPLAY_NAME_SIZE 40
+typedef struct
+{
+ SkinnyHeaderStruct header;
+ unsigned int lineNumber;
+ char lineDirNumber[SKINNY_LINE_DIR_NUMBER_SIZE];
+ char displayName[SKINNY_DISPLAY_NAME_SIZE];
+} SkLineStatStruct;
+
+bool SkinnyValidateLineStat(SkLineStatStruct*);
+
// Endpoint -> Cisco Callmanager messages
typedef struct
{
@@ -177,6 +190,7 @@ bool SkinnyValidateOpenReceiveChannelAck(SkOpenReceiveChannelAckStruct *);
#define SKINNY_MSG_CLOSE_RECEIVE_CHANNEL "CloseReceiveChannel"
#define SKINNY_MSG_CALL_INFO_MESSAGE "CallInfoMessage"
#define SKINNY_MSG_OPEN_RECEIVE_CHANNEL_ACK "OpenReceiveChannelAck"
+#define SKINNY_MSG_LINE_STAT_MESSAGE "LineStatMessage"
#define SKINNY_CALL_TYPE_INBOUND 1
#define SKINNY_CALL_TYPE_OUTBOUND 2
@@ -188,6 +202,7 @@ typedef enum
SkStartMediaTransmission = 0x008A,
SkStopMediaTransmission = 0x008B,
SkCallInfoMessage = 0x008F,
+ SkLineStatMessage = 0x0092,
SkCloseReceiveChannel = 0x0106,
SkUnkn = 0x0
} SkinnyMessageEnum;
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
index f05ec17..f3b9d12 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
@@ -248,6 +248,19 @@ void RtpSession::ReportMetadata()
char szRemoteIp[16];
ACE_OS::inet_ntop(AF_INET, (void*)&m_remoteIp, szRemoteIp, sizeof(szRemoteIp));
+ // Check if we don't have the local party based on the endpoint IP address
+ if(m_localParty.IsEmpty())
+ {
+ if(m_protocol == ProtSkinny)
+ {
+ EndpointInfoRef endpointInfo = RtpSessionsSingleton::instance()->GetEndpointInfo(m_endPointIp);
+ if(endpointInfo.get())
+ {
+ m_localParty = endpointInfo->m_extension;
+ }
+ }
+ }
+
// Make sure Local Party is always reported
if(m_localParty.IsEmpty())
{
@@ -777,6 +790,51 @@ void RtpSessions::ReportSkinnyStopMediaTransmission(SkStopMediaTransmissionStruc
}
}
+void RtpSessions::ReportSkinnyLineStat(SkLineStatStruct* lineStat, IpHeaderStruct* ipHeader)
+{
+ if(strlen(lineStat->lineDirNumber) > 1)
+ {
+ EndpointInfoRef endpoint;
+ std::map<unsigned int, EndpointInfoRef>::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;
+
+ }
+ 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);
+ }
+ }
+}
+
+EndpointInfoRef RtpSessions::GetEndpointInfo(struct in_addr endpointIp)
+{
+ std::map<unsigned int, EndpointInfoRef>::iterator pair;
+ pair = m_endpoints.find((unsigned int)(endpointIp.s_addr));
+ if(pair != m_endpoints.end())
+ {
+ return pair->second;
+ }
+ return EndpointInfoRef();
+}
+
+
void RtpSessions::Stop(RtpSessionRef& session)
{
session->Stop();
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h
index 194db61..96ed18c 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.h
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h
@@ -45,31 +45,17 @@ public:
CStdString m_callId;
};
+//=============================================================
-class SccpCallInfoMessageInfo
+class EndpointInfo
{
- CStdString m_callingParty;
- CStdString m_calledParty;
- CStdString m_callId;
-};
-typedef boost::shared_ptr<SccpCallInfoMessageInfo> SccpCallInfoMessageInfoRef;
-
-
-class SccpStartMediaTransmissionInfo
-{
- struct in_addr m_remoteIp;
- int m_remoteTcpPort;
- CStdString m_callId;
+public:
+ CStdString m_extension;
};
-typedef boost::shared_ptr<SccpStartMediaTransmissionInfo> SccpStartMediaTransmissionInfoRef;
-
+typedef boost::shared_ptr<EndpointInfo> EndpointInfoRef;
-class SccpStopMediaTransmissionInfo
-{
- CStdString m_callId;
-};
-typedef boost::shared_ptr<SccpStopMediaTransmissionInfo> SccpStopMediaTransmissionInfoRef;
+// ============================================================
class RtpSession
{
@@ -142,8 +128,10 @@ public:
void ReportSkinnyStartMediaTransmission(SkStartMediaTransmissionStruct*, IpHeaderStruct* ipHeader);
void ReportSkinnyStopMediaTransmission(SkStopMediaTransmissionStruct*, IpHeaderStruct* ipHeader);
void ReportSkinnyOpenReceiveChannelAck(SkOpenReceiveChannelAckStruct*);
+ void ReportSkinnyLineStat(SkLineStatStruct*, IpHeaderStruct* ipHeader);
void ReportRtpPacket(RtpPacketInfoRef& rtpPacket);
void Hoover(time_t now);
+ EndpointInfoRef GetEndpointInfo(struct in_addr endpointIp);
private:
RtpSessionRef findByEndpointIp(struct in_addr);
void ChangeCallId(RtpSessionRef& session, unsigned int newId);
@@ -152,6 +140,7 @@ private:
std::map<CStdString, RtpSessionRef> m_byIpAndPort;
std::map<CStdString, RtpSessionRef> m_byCallId;
+ std::map<unsigned int, EndpointInfoRef> m_endpoints;
LoggerPtr m_log;
AlphaCounter alphaCounter;
};
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index 1be3b25..77a9dc6 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -366,6 +366,7 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea
SkStopMediaTransmissionStruct* stopMedia;
SkCallInfoStruct* callInfo;
SkOpenReceiveChannelAckStruct* openReceiveAck;
+ SkLineStatStruct* lineStat;
char szEndpointIp[16];
struct in_addr endpointIp = ipHeader->ip_dest; // most of the interesting skinny messages are CCM -> phone
@@ -435,6 +436,24 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea
LOG4CXX_WARN(s_skinnyPacketLog, "Invalid OpenReceiveChannelAck.");
}
break;
+ case SkLineStatMessage:
+ lineStat = (SkLineStatStruct*)skinnyHeader;
+ if(SkinnyValidateLineStat(lineStat))
+ {
+ if(s_skinnyPacketLog->isInfoEnabled())
+ {
+ logMsg.Format(" line:%u extension:%s display name:%s", lineStat->lineNumber, lineStat->lineDirNumber, lineStat->displayName);
+ }
+ endpointIp = ipHeader->ip_dest; // this skinny message is CCM -> phone
+ RtpSessionsSingleton::instance()->ReportSkinnyLineStat(lineStat, ipHeader);
+ }
+ else
+ {
+ useful = false;
+ LOG4CXX_WARN(s_skinnyPacketLog, "Invalid LineStatMessage.");
+ }
+
+ break;
default:
useful = false;
}