Commit f7246562 authored by Tristan Matthews's avatar Tristan Matthews

* #15266: dtmf: Use correct event codes for DTMF over RTP

parent f3a1748e
......@@ -49,8 +49,37 @@ std::ofstream rtpResampled ("testRtpOutputResampled.raw", std::ifstream::binary)
std::ofstream rtpNotResampled("testRtpOutput.raw", std::ifstream::binary);
#endif
DTMFEvent::DTMFEvent(int digit) : payload(), newevent(true), length(1000)
DTMFEvent::DTMFEvent(char digit) : payload(), newevent(true), length(1000)
{
/*
From RFC2833:
Event encoding (decimal)
_________________________
0--9 0--9
* 10
# 11
A--D 12--15
Flash 16
*/
switch (digit) {
case '*':
digit = 10;
break;
case '#':
digit = 11;
break;
case 'A' ... 'D':
digit = digit - 'A' + 12;
break;
case '0' ... '9':
digit = digit - '0';
break;
default:
ERROR("Unexpected DTMF %c", digit);
}
payload.event = digit;
payload.ebit = false; // end of event bit
payload.rbit = false; // reserved bit
......@@ -167,7 +196,7 @@ void AudioRtpRecordHandler::initNoiseSuppress()
}
#endif
void AudioRtpRecordHandler::putDtmfEvent(int digit)
void AudioRtpRecordHandler::putDtmfEvent(char digit)
{
DTMFEvent dtmf(digit);
audioRtpRecord_.dtmfQueue_.push_back(dtmf);
......
......@@ -59,7 +59,7 @@ timeval2microtimeout(const timeval& t)
}
struct DTMFEvent {
DTMFEvent(int digit);
DTMFEvent(char digit);
ost::RTPPacket::RFC2833Payload payload;
bool newevent;
int length;
......@@ -178,7 +178,7 @@ class AudioRtpRecordHandler {
return audioRtpRecord_.dtmfPayloadType_;
}
void putDtmfEvent(int digit);
void putDtmfEvent(char digit);
protected:
AudioRtpRecord audioRtpRecord_;
......
......@@ -1294,7 +1294,7 @@ void
dtmfSend(SIPCall &call, char code, const std::string &dtmf)
{
if (dtmf == SIPAccount::OVERRTP_STR) {
call.getAudioRtp().sendDtmfDigit(code - '0');
call.getAudioRtp().sendDtmfDigit(code);
return;
} else if (dtmf != SIPAccount::SIPINFO_STR) {
WARN("Unknown DTMF type %s, defaulting to %s instead",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment