From 159d57187854191b887f8392682ff8c2e0369b10 Mon Sep 17 00:00:00 2001 From: Gerald Begumisa Date: Thu, 27 Sep 2007 17:40:00 +0000 Subject: Added a boolean VoIP plugin configuration option, RtpReportDtmf, to control whether to report or not to report RTP events git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@497 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 17 ++++++++--- orkaudio/audiocaptureplugins/voip/VoIp.cpp | 39 +++++++++++++----------- orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp | 2 ++ orkaudio/audiocaptureplugins/voip/VoIpConfig.h | 1 + 4 files changed, 36 insertions(+), 23 deletions(-) (limited to 'orkaudio/audiocaptureplugins') diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index b133317..c52d9b6 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -596,12 +596,18 @@ bool RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket) if(m_protocol == ProtSip) { - /* Check if this is a telephone-event */ - if(rtpPacket->m_payloadType == StringToInt(m_telephoneEventPayloadType)) + if(DLLCONFIG.m_rtpReportDtmf) { - // This is a telephone-event - HandleRtpEvent(rtpPacket); - return true; + /* Check if this is a telephone-event */ + if(m_telephoneEventPayloadType.CompareNoCase("UNDEFINED") != 0) + { + if(rtpPacket->m_payloadType == StringToInt(m_telephoneEventPayloadType)) + { + // This is a telephone-event + HandleRtpEvent(rtpPacket); + return true; + } + } } } @@ -1844,6 +1850,7 @@ SipInviteInfo::SipInviteInfo() m_fromRtpIp.s_addr = 0; m_validated = false; m_attrSendonly = false; + m_telephoneEventPayloadType = "UNDEFINED"; } void SipInviteInfo::ToString(CStdString& string) diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index 6f3b81f..4790c7c 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -1641,31 +1641,34 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader } } - if(rtpmapAttribute) + if(DLLCONFIG.m_rtpReportDtmf) { - CStdString rtpPayloadType, nextToken; - char *nextStep = NULL; - - while(rtpmapAttribute && rtpmapAttribute < sipEnd) + if(rtpmapAttribute) { - GrabTokenSkipLeadingWhitespaces(rtpmapAttribute, sipEnd, rtpPayloadType); - nextToken.Format("%s ", rtpPayloadType); - nextStep = memFindAfter((char*)nextToken.c_str(), rtpmapAttribute, sipEnd); + CStdString rtpPayloadType, nextToken; + char *nextStep = NULL; - /* We need our "nextStep" to contain at least the length - * of the string "telephone-event", 15 characters */ - if(nextStep && ((sipEnd - nextStep) >= 15)) + while(rtpmapAttribute && rtpmapAttribute < sipEnd) { - if(ACE_OS::strncasecmp(nextStep, "telephone-event", 15) == 0) + 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)) { - /* Our DTMF packets are indicated using - * the payload type rtpPayloadType */ - info->m_telephoneEventPayloadType = rtpPayloadType; - break; + if(ACE_OS::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); + rtpmapAttribute = memFindAfter("\na=rtpmap:", rtpmapAttribute, sipEnd); + } } } diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp index 89ab57b..d9f299e 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp @@ -33,6 +33,7 @@ VoIpConfig::VoIpConfig() m_rtpSessionTimeoutSec = 10; m_rtpSessionWithSignallingTimeoutSec = 5*60; m_rtpSessionOnHoldTimeOutSec = 1800; + m_rtpReportDtmf = false; m_pcapTest= false; m_rtpDiscontinuityDetect = false; m_rtpDiscontinuityMinSeqDelta = 1000; @@ -76,6 +77,7 @@ void VoIpConfig::Define(Serializer* s) s->IntValue("RtpSessionTimeoutSec", m_rtpSessionTimeoutSec); s->IntValue("RtpSessionWithSignallingTimeoutSec", m_rtpSessionWithSignallingTimeoutSec); s->IntValue("RtpSessionOnHoldTimeOutSec", m_rtpSessionOnHoldTimeOutSec); + s->BoolValue("RtpReportDtmf", m_rtpReportDtmf); s->BoolValue("PcapTest", m_pcapTest); s->StringValue("PcapFilter", m_pcapFilter); s->BoolValue("RtpDiscontinuityDetect", m_rtpDiscontinuityDetect); diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h index c1959a4..521e0ac 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h +++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h @@ -71,6 +71,7 @@ public: bool m_rtpDiscontinuityDetect; int m_rtpDiscontinuityMinSeqDelta; bool m_rtpDetectOnOddPorts; + bool m_rtpReportDtmf; bool m_iax2Support; bool m_sipOverTcpSupport; bool m_sipLogFailedCalls; -- cgit v1.2.3