summaryrefslogtreecommitdiff
path: root/orkaudio/audiocaptureplugins/voip/VoIp.cpp
diff options
context:
space:
mode:
authorGerald Begumisa <ben_g@users.sourceforge.net>2007-09-21 17:26:05 +0000
committerGerald Begumisa <ben_g@users.sourceforge.net>2007-09-21 17:26:05 +0000
commit5a418de8f295d76e16873a0f1a8314e2a9fa6745 (patch)
tree10cc23c3fecf6ff2d876c58503885f4b9e65a286 /orkaudio/audiocaptureplugins/voip/VoIp.cpp
parent92876587193f588bb1fd34853861f3fedea25b6a (diff)
Added support to report RTP events in SIP sessions
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@494 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins/voip/VoIp.cpp')
-rw-r--r--orkaudio/audiocaptureplugins/voip/VoIp.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
index d85d05c..2d3faba 100644
--- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp
+++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp
@@ -1031,7 +1031,7 @@ bool TryRtp(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader, UdpH
u_short dest = ntohs(udpHeader->dest);
if(!(ntohs(udpHeader->source)%2) && !(ntohs(udpHeader->dest)%2) || DLLCONFIG.m_rtpDetectOnOddPorts) // udp ports usually even
{
- if((rtpHeader->pt <= 34 && rtpHeader->pt != 13) || rtpHeader->pt == 97 || rtpHeader->pt == 98) // pt=34 is H263 and is the last possible valid codec
+ if((rtpHeader->pt <= 34 && rtpHeader->pt != 13) || rtpHeader->pt == 97 || rtpHeader->pt == 98 || rtpHeader->pt > 98) // pt=34 is H263 and is the last possible valid codec, pt > 98 is for the case of SIP telephone-event
{ // pt=13 is CN (Comfort Noise)
result = true;
u_char* payload = (u_char *)rtpHeader + sizeof(RtpHeaderStruct);
@@ -1470,6 +1470,7 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader
char* audioField = NULL;
char* connectionAddressField = NULL;
char* attribSendonly = memFindAfter("a=sendonly", (char*)udpPayload, sipEnd);
+ char* rtpmapAttribute = memFindAfter("\na=rtpmap:", (char*)udpPayload, sipEnd);
if(fromField)
{
@@ -1583,6 +1584,34 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader
}
}
+ if(rtpmapAttribute)
+ {
+ CStdString rtpPayloadType, nextToken;
+ char *nextStep = NULL;
+
+ while(rtpmapAttribute && rtpmapAttribute < sipEnd)
+ {
+ GrabTokenSkipLeadingWhitespaces(rtpmapAttribute, sipEnd, rtpPayloadType);
+ nextToken.Format("%s ", rtpPayloadType);
+ nextStep = memFindAfter((char*)nextToken.c_str(), rtpmapAttribute, sipEnd);
+
+ /* We need our "nextStep" to contain at least the length
+ * of the string "telephone-event", 15 characters */
+ if(nextStep && ((sipEnd - nextStep) >= 15))
+ {
+ if(strncasecmp(nextStep, "telephone-event", 15) == 0)
+ {
+ /* Our DTMF packets are indicated using
+ * the payload type rtpPayloadType */
+ info->m_telephoneEventPayloadType = rtpPayloadType;
+ break;
+ }
+ }
+
+ rtpmapAttribute = memFindAfter("\na=rtpmap:", rtpmapAttribute, sipEnd);
+ }
+ }
+
if((unsigned int)info->m_fromRtpIp.s_addr == 0)
{
// In case connection address could not be extracted, use SIP invite sender IP address