Introduction
Dual SME signaling, gradually uses on the button telephone in the world, and quickly replaces the dial-up pulse letter used by traditional turntable telephones due to its higher dial rate. make. In recent years, DTMF has also been applied to interactive control, such as language menu, language mail, telephone banking, and ATM terminals.
Since DTMF is widely used in traditional communications, DTMF is still an important role in VoIP.
A DTMF signal is superimposed by an audio signal of two frequencies. The frequency of these two audio signals comes from two sets of pre-allocated frequency groups: row frequency groups or column frequency groups. Each pair of audio signals uniquely represents a number or symbol. The DTMF signal is generated, and the waveform formed after two different frequencies is formed, and the improved Goertzel algorithm is used to search for two sine waves from the frequency domain when decoding the waveform formed.
The following table describes the frequency of each DTMF signal.
1209 Hz 1336 HZ 1477 HZ 1633 HZ
ABC DEF
697 HZ 1 2 3 A
GHI JKL MNO
770 Hz 4 5 6 B
PRS TUV WXY
852 HZ 7 8 9 C
Oper
941 HZ * 0 # d
DTMF solution in VoIP
Since communication transmission in the IP network is a Packet Switch instead of a circuit exchange in the traditional field, the solution and traditional DTMF applied to the VoIP in VoIP. And temporarily uniform, there are a variety of solutions.
The following is a brief introduction to various programs.
Carry the DTMF signal with the INFO method of SIP signaling.
This method is to define the DTMF signal in clear text using the INFO method of SIP signaling. The method is also in the research discussion, some experts believe that it does not apply, the main defect is because SIP control signaling and media transmission (RTP) are separated, it is easy to cause DTMF signals and media packets.
Simply put an example, in the Voice Mail application, the user enters a DTMF signal according to the prompt sound, and then begins. Server starts saving the user's message after receiving the DTMF signal. However, since the DTMF signal is transmitted through the SIP signaling, the media stream is transmitted by the RTP, and the RTP package that may be user message is first arrived, and the DTMF signal is delayed, resulting in the voice message of the user does not save the user. The info message is accepted until it accepts.
Carry the DTMF signal in the RTP media transfer.
The method is to transmit the DTMF signal and the media stream, and use the RTP package to transmit, so there is no problem with the DTMF signal and the media stream, and the VOIP using the H323 signaling is to use this method, which is relatively mature.
Among them, it is divided into two in bald and out of band (RFC2833).
l in band dtmf
In Band DTMF refers to the transfer of DTMF's audio digital signals directly into the RTP package in IP networks directly from any processing. Among them, it may be transmitted together with the user's voice media stream mix (MIX). The program is to know which package has a DTMF signal, what DTMF signal, must check the media stream data in each RTP package in real time, and analyze its frequency domain.
l Out of band DTMF (RFC 2833)
Out of band DTMF is a DTMF signal to identify with a special RTP package, and you can know that the package is a DTMF package in the head domain of the RTP package, and knows what DTMF signal. RFC2833 is specifically defined here. Dynamically generate DTMF audio signals
When the program needs to generate a DTMF audio digital signal, it is of course possible to read the file already recorded.
Here, how to use the algorithm program to dynamically generate a single DTMF audio digital signal.
The principle of the DTMF signal is the principle of the DTMF signal is a sinusoidal shape of two different frequencies.
Simple formula to generate sine wave: Sample = SIN (n * 2 * pi * f / schement)
N: Sampling order, increased by 0
f: frequency of sine wave
SampleRate: Sampling Frequency
Sample: The sample value obtained when the order N
If you want to generate a sampling frequency is 8000Hz, the sampling bit is the 8bit DTMF signal, the formula:
Sample (n) = 128 63 * sin (n * 2 * pi * f1 / 8000) 63 * sin (n * 2 * pi * f2 / 8000)
F1 and F2 are two sinusoidal frequencies of the DTMF signal, respectively.
Among them, 128 = 256/2
63 = 128/2 - 1
Similarly, if you want to generate a 16bit DTMF signal, the formula:
Sample (n) = 32768 16383 * sin (n * 2 * pi * f1 / 8000) 16383 * sin (n * 2 * pi * f2 / 8000)
Calculating the DTMF signal is a resource process, you can optimize your code through different ways, the simplest is to calculate the value of 2 * pi * f1 and 2 * pi * f2, reducing the calculation time of the CPU.
With regard to the time interval of the DTMF signal, the indicator specified by the CCITT to the DTMF signal is that the transfer / reception rate is 10 numbers per second, ie each number 100ms. The audio signal representing the number must last for at least 45ms, but no more than 55ms. Other time within 100ms is mute so that two consecutive buttons are different.
Detect DTMF signal according to audio signals in the RTP package
The DTMF signal is detected in the input signal, and convert it to the actual number, this decoding process is essentially a continuous process, and the presence of the DTMF signal spectrum needs to be continuously searched in the input data signal stream.
The entire detection process is divided into two steps: first using the Goertzel algorithm in the input signal to extract spectrum information; follow the validity check of the test results. The Goertzel Algorithm DTMF decoding is to search for effective row frequency and column frequency in the input signal. The spectrum of calculating the digital signal can use DFT and its fast algorithm FFT, and when implementing DTMF decoding, the Goertzel algorithm is faster than FFT. You can calculate all the lines of the signal through the FFT, to understand the entire frequency domain information of the signal, and for the DTMF signal, only 8 line frequency / recovery and its secondary harmonic information (the information of the second harmonics is used for information The DTMF signal is distinguished from the sound signal). At this time, the Goertzel algorithm can extract spectrum information in the input signal.
reference
[1] "Generating DTMF Tones Using SoundCard" Tomi ENGDAHL
[2] "Double Solid Strong DTMF Technology in DSP System" Guaixing Xu Sheng
[3] "RTP PAYLOAD for DTMF DIGITS, Telephony Tones and Telephony Signals" RFC2833
H. SCHULZRINNE, S. PETRACK
[4] "RTP: a Transport Protocol for Real-Time Applications" RFC1889
H. Schulzrinne, S. Casner, R. Frederick, And V. Jacobson,