summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2009-02-20 22:18:03 +0000
committerHenri Herscher <henri@oreka.org>2009-02-20 22:18:03 +0000
commitad08a31ce17bf5f89d46fe6a0ee74ec213653830 (patch)
treeb98b1c7e3eba4f4e84dd0983d8d3666d157b4b16
parent17ab3f85e56d2ee715ad5207f76337f5565e865d (diff)
SIP ACK method is now taken into account as if it was an INVITE.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@604 09dcff7a-b715-0410-9601-b79a96267cd0
-rw-r--r--orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h2
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp35
2 files changed, 27 insertions, 10 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
index a32e8cd..87b2ee1 100644
--- a/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
+++ b/orkaudio/audiocaptureplugins/voip/PacketHeaderDefs.h
@@ -358,10 +358,12 @@ struct Iax2MetaTrunkEntryTs {
// SIP
#define SIP_METHOD_INVITE_SIZE 6
+#define SIP_METHOD_ACK_SIZE 3
#define SIP_METHOD_BYE_SIZE 3
#define SIP_RESPONSE_200_OK_SIZE 11
#define SIP_RESPONSE_SESSION_PROGRESS_SIZE 28
#define SIP_METHOD_INVITE "INVITE"
+#define SIP_METHOD_ACK "ACK"
#define SIP_METHOD_BYE "BYE"
#define SIP_RESPONSE_200_OK "SIP/2.0 200"
#define SIP_RESPONSE_SESSION_PROGRESS "SIP/2.0 183 Session Progress"
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index bf23eba..2539d19 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -1596,13 +1596,14 @@ bool TrySipTcp(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader, T
startTcpPayload = (u_char*)tcpHeader + (tcpHeader->off * 4);
tcpLengthPayloadLength = ((u_char*)ipHeader+ntohs(ipHeader->ip_len)) - startTcpPayload;
- if(tcpLengthPayloadLength < SIP_METHOD_INVITE_SIZE+3)
- {
- LOG4CXX_INFO(s_sipTcpPacketLog, "Payload shorter");
- return false;
- }
+ if(tcpLengthPayloadLength < SIP_METHOD_INVITE_SIZE+3)
+ {
+ LOG4CXX_DEBUG(s_sipTcpPacketLog, "Payload shorter");
+ return false;
+ }
if((memcmp(SIP_METHOD_INVITE, (void*)startTcpPayload, SIP_METHOD_INVITE_SIZE) == 0) ||
+ (memcmp(SIP_METHOD_ACK, (void*)startTcpPayload, SIP_METHOD_ACK_SIZE) == 0) ||
(memcmp(SIP_METHOD_BYE, (void*)startTcpPayload, SIP_METHOD_BYE_SIZE) == 0) ||
(memcmp("SIP/2.0 4", (void*)startTcpPayload, 9) == 0) ||
(memcmp("SIP/2.0 5", (void*)startTcpPayload, 9) == 0) ||
@@ -2032,14 +2033,28 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader
{
bool result = false;
bool drop = false;
-
+ CStdString sipMethod;
+
int sipLength = ntohs(udpHeader->len) - sizeof(UdpHeaderStruct);
char* sipEnd = (char*)udpPayload + sipLength;
- if(sipLength < SIP_METHOD_INVITE_SIZE || sipEnd > (char*)packetEnd)
+ if(sipLength < 3 || sipEnd > (char*)packetEnd)
{
- ; // packet too short
+ drop = true; // packet too short
+ }
+ else if(memcmp(SIP_METHOD_INVITE, (void*)udpPayload, SIP_METHOD_INVITE_SIZE) == 0)
+ {
+ sipMethod = SIP_METHOD_INVITE;
+ }
+ else if(memcmp(SIP_METHOD_ACK, (void*)udpPayload, SIP_METHOD_ACK_SIZE) == 0)
+ {
+ sipMethod = SIP_METHOD_ACK;
}
- else if (memcmp(SIP_METHOD_INVITE, (void*)udpPayload, SIP_METHOD_INVITE_SIZE) == 0)
+ else
+ {
+ drop = true;
+ }
+
+ if (drop == false)
{
result = true;
@@ -2265,7 +2280,7 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader
CStdString logMsg;
info->ToString(logMsg);
- logMsg = "INVITE: " + logMsg;
+ logMsg = sipMethod + ": " + logMsg;
LOG4CXX_INFO(s_sipPacketLog, logMsg);
if(drop == false && info->m_fromRtpPort.size() && info->m_from.size() && info->m_to.size() && info->m_callId.size())