Disclosure of Invention
The invention aims to overcome the defects in the prior art, and provides an embedded VoIP telephone system and a method for realizing VoIP telephone voice quality management, wherein the embedded VoIP telephone system is used for safely processing VoIP voice data in the transmission process and compensating the voice data under the condition of weak network signals, so that a user feels the integrity and reliability of information in the conversation, the user experience is greatly improved, and the embedded VoIP telephone system has the advantages of simple structure, low cost, simple and convenient application mode and wide application range.
In order to achieve the above object, an embedded VoIP telephone system of the present invention is configured as follows:
the system comprises: the system comprises a SOCKET API network processing unit, a call service control module, an SIP/H248 protocol stack, a bottom layer processing module, a bottom layer pick-up and hang-up event polling module, a polling bottom layer media message module, an RTP protocol processing module and a voice quality management module.
Wherein, the SOCKET API network processing unit is used for connecting an external network;
the call service control module is used for processing the starting and registration of the H248 protocol stack, and is responsible for the initialization of the terminal system, the task of receiving and transmitting media packets and the starting of the event detection task;
the SIP/H248 protocol stack is connected with the call service control module and is responsible for receiving, transmitting and retransmitting the H248 protocol packet;
the bottom layer processing module is used for processing bottom layer event reporting, media processing and sound playing;
the bottom pick-up and hang-up event polling module is connected between the bottom processing module and the call service control module and is used for waiting for taking out an event from the queue by a task in the call service control module for upper layer processing after polling the event and putting the event into the queue;
the polling bottom media message module is connected between the bottom processing module and the SOCKET API network processing unit and is used for sending the bottom media message through the SOCKET API network processing unit;
the RTP protocol processing module is connected with the SOCKET API network processing unit and is used for receiving RTP protocol packets and sending the RTP protocol packets to the DSP voice hardware through the bottom layer processing module;
the voice quality management module is connected between the RTP protocol processing module and the bottom layer processing module and is used for correcting and compensating the RTP protocol message obtained from the RTP protocol processing module.
In the embedded VoIP phone system, the voice quality management module includes: the device comprises a high-speed cache region, a message checking module, an RTP error processing module, an RTP voice compensation module and an RTP protocol message sending module.
Wherein, the high-speed buffer area is used for storing the message obtained from the RTP protocol processing module;
the message checking module is used for detecting whether the message stored in the cache region is an RTP protocol message or not and discarding a non-RTP protocol message in the RTP protocol message;
the RTP error processing module is used for detecting an RTP protocol message with an error;
the RTP voice compensation module is used for repairing the RTP protocol message with errors;
the RTP protocol message sending module is used for sending the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module.
The invention also provides a method for realizing the voice quality management of the embedded VoIP phone based on the system, which comprises the following steps:
(1) the high-speed buffer area stores the message obtained from the RTP protocol processing module;
(2) the message checking module detects whether the message stored in the cache region is an RTP protocol message, and discards a non-RTP protocol message therein;
(3) the RTP error processing module detects an RTP protocol message with an error;
(4) the RTP voice compensation module repairs the RTP protocol message with errors;
(5) the RTP protocol message sending module sends the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module.
In the method for implementing embedded VoIP phone voice quality management, the step (2) specifically comprises the following steps:
(21) the message checking module detects whether the message stored in the cache region is an RTP protocol message by using an incremental hash method and using a hash table as an index;
(22) the message checking module discards a non-RTP protocol message;
(23) the message checking module stores the RTP protocol message hash table into the cache region.
In the method for realizing the speech quality management of the embedded VoIP phone, the RTP error processing module detects an RTP protocol message with errors, specifically;
and the RTP error processing module polls the RTP protocol message in the hash table and detects the RTP protocol message with errors.
In the method for realizing the voice quality management of the embedded VoIP phone, the RTP voice compensation module repairs the RTP protocol message with errors, and the method specifically comprises the following steps:
the RTP voice compensation module utilizes the balance voice packet to compensate the RTP protocol message with errors.
In the method for realizing the voice quality management of the embedded VoIP phone, the RTP protocol message sending module sends the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module, and the method specifically comprises the following steps:
the RTP protocol message sending module merges the repaired RTP protocol message into a hash table and sends the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module.
The embedded VoIP telephone system comprises a SOCKET API network processing unit, a call service control module, an SIP/H248 protocol stack, a bottom layer processing module, a bottom layer pick-up event polling module, a polling bottom layer media message module, an RTP protocol processing module and a voice quality management module; the voice quality management module comprises: the device comprises a high-speed cache region, a message checking module, an RTP error processing module, an RTP voice compensation module and an RTP protocol message sending module, and is used for correcting and compensating the RTP protocol message obtained from the RTP protocol processing module. Therefore, the system and the method can compensate the voice data under the condition of weaker VoIP network signals, so that a user can feel the integrity and the reliability of information in the conversation, and the user experience is greatly improved.
Detailed Description
In order to clearly understand the technical contents of the present invention, the following examples are given in detail.
Fig. 1 is a schematic diagram of an embedded VoIP phone system according to the present invention.
In one embodiment, the embedded VoIP phone system includes a SOCKET API network processing unit, a call service control module, an SIP/H248 protocol stack, a bottom layer processing module, a bottom layer off-hook event polling module, a polling bottom layer media message module, an RTP protocol processing module, and a voice quality management module. Wherein,
the SOCKET API network processing unit is used for connecting an external network;
the call service control module is used for processing the starting and registration of the H248 protocol stack, and is responsible for the initialization of the terminal system, the task of receiving and transmitting media packets and the starting of the event detection task;
the SIP/H248 protocol stack is connected with the call service control module and is responsible for receiving, transmitting and retransmitting the H248 protocol packet;
the bottom layer processing module is used for processing bottom layer event reporting, media processing and sound playing;
the bottom pick-up and hang-up event polling module is connected between the bottom processing module and the call service control module and is used for waiting for taking out an event from the queue by a task in the call service control module for upper layer processing after polling the event and putting the event into the queue;
the polling bottom media message module is connected between the bottom processing module and the SOCKET API network processing unit and is used for sending the bottom media message through the SOCKET API network processing unit;
the RTP protocol processing module is connected with the SOCKET API network processing unit and is used for receiving RTP protocol packets and sending the RTP protocol packets to the DSP voice hardware through the bottom layer processing module;
the voice quality management module is connected between the RTP protocol processing module and the bottom layer processing module and is used for correcting and compensating the RTP protocol message obtained from the RTP protocol processing module.
The voice quality management module comprises a high-speed cache region, a message checking module, an RTP error processing module, an RTP voice compensation module and an RTP protocol message sending module. Wherein,
the high-speed buffer area is used for storing the message obtained from the RTP protocol processing module;
the message checking module is used for detecting whether the message stored in the cache region is an RTP protocol message or not and discarding a non-RTP protocol message in the RTP protocol message;
the RTP error processing module is used for detecting an RTP protocol message with an error;
the RTP voice compensation module is used for repairing the RTP protocol message with errors;
the RTP protocol message sending module is used for sending the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module.
The invention also provides a method for realizing embedded VoIP phone voice quality management based on the system, in one embodiment, as shown in FIG. 2, the method comprises the following steps:
(1) the high-speed buffer area stores the message obtained from the RTP protocol processing module;
(2) the message checking module detects whether the message stored in the cache region is an RTP protocol message, and discards a non-RTP protocol message therein;
(3) the RTP error processing module detects an RTP protocol message with an error;
(4) the RTP voice compensation module repairs the RTP protocol message with errors;
(5) the RTP protocol message sending module sends the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module.
In a preferred embodiment, the step (2) specifically comprises the following steps:
(21) the message checking module detects whether the message stored in the cache region is an RTP protocol message by using an incremental hash method and using a hash table as an index;
(22) the message checking module discards a non-RTP protocol message;
(23) the message checking module stores the RTP protocol message hash table into the cache region.
In a more preferred embodiment, the RTP error processing module in step (3) detects an RTP protocol packet with an error, specifically: and the RTP error processing module polls the RTP protocol message in the hash table and detects the RTP protocol message with errors.
The RTP voice compensation module in step (4) repairs the RTP protocol message with errors, specifically: the RTP voice compensation module utilizes the balance voice packet to compensate the RTP protocol message with errors.
The RTP protocol message sending module in step (5) sends the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module, which specifically includes: the RTP protocol message sending module merges the repaired RTP protocol message into a hash table and sends the repaired RTP protocol message to the DSP voice hardware through the bottom layer processing module.
In practical application, the embedded VoIP system of the present invention is shown in fig. 1, and integrates the voice quality and data security processing module (FastCache) of the system, and the message received from the network side is processed by error, and the voice loss is compensated, and the repackaged message is sent to the DSP for processing.
The voice message firstly enters a packet check module in a FastCache module to carry out RTP message filtering, which is similar to packet filtering processing in a computer network and mainly aims at the RTP message filtering. And (3) voice message error processing, which mainly checks whether the RTP message subjected to packet verification is an abnormal packet or a normal packet, and filters the RTP message with the correct format for transmission. The invention relates to a method for compensating voice loss, wherein the method comprises the following steps that a module is used for carrying out endless loop, the loss and the time delay of an RTP message are mainly continuously detected in a calling process, the RTP message is reflected to a user, namely the voice quality is relatively poor, or the voice is unclear, the designed algorithm can automatically detect the network connection condition, and the analysis and the processing can be carried out through the algorithm from the RTP flow statistics or the processing of unclear calling caused by incomplete messages.
The message is re-distributed to be sent to the DSP for processing, and the message is a forwarding module aiming at the message of the previous okay processing. And uniformly sending accurate and safe messages passing through the Fastcache module to a bottom layer module for processing.
The main reason for poor voice quality is the delay and loss of data packets, which is similar to the slow driving of automobiles due to traffic congestion on highways. The reason for the poor speech quality is not one, nor can one approach solve this problem. The reasons for this may be that the ISP limits the bandwidth, the speed of the data traffic is affected by firewalls and address translation mechanisms, or the phone conflicts with the video file being downloaded by a neighbor. Early adopters of VoIP may be willing to accept a poor quality VoIP conversation, but mainstream consumers and enterprise customers are unwilling. Quality of service is very important and VoIP providers who wish to obtain more revenue need to provide a consistent high quality experience. The invention aims to solve the problem by using a newly added Fastcache module in the system.
The Fastcache is mainly integrated in a VoIP telephone system, and the invention is implemented on the VoIP system under an improved scheme and can be used as a scheme adopted by a better terminal voice product design.
Two ports will be used when an application starts an RTP session: one for RTP and one for RTCP. RTP itself does not provide a reliable transport mechanism for transporting packets in sequence, nor does it provide flow control or congestion control, and relies on RTCP to provide these services. These RTCP packets are periodically sent between sessions in RTP to monitor quality of service and exchange session user information. The RTCP packets contain statistics such as the number of data packets that have been sent, the number of lost data packets, etc. Thus, the server can use this information to dynamically change the transmission rate and even the payload type. RTP and RTCP are used in conjunction, typically over UDP, to optimize transmission efficiency with efficient feedback and minimal overhead, and are therefore particularly well suited for transmitting real-time data over a network. According to the data transmission feedback information among users, a flow control strategy can be formulated, and the conversation control strategy can be formulated through the interaction of the conversation user information. Then the Fastcache is used as a better selection scheme to realize the session control, the loss of the session message is compensated, and the session is sent to the DSP for correct processing after being updated.
In order to realize the Fastcache function, the invention basically comprises the following main parts:
1. an embedded VoIP system is firstly established on the overall architecture of the VoIP system, the VoIP mainly comprises a CallClient module, an SIP/H248stack, a bottom layer processing module (ENDPT), an RTP module, a polling pick-up event module, a polling bottom layer media packet module and a FastCache module, which are system software parts, and a hardware part is mainly a DSP (digital signal processor), an SLIC (serial interface circuit) and a peripheral circuit which are related to voice.
2. The CallClient module processes the starting of the H248 protocol stack and registers the corresponding call-back, and is responsible for the initialization of endpoint, the starting of the task of receiving and sending the media package and the event detection task.
3. The SIP/H248 module of the protocol stack is a core module of the H248 protocol stack and is responsible for receiving, transmitting, retransmitting and the like of protocol packets.
4. The bottom layer module is a bottom layer processing module and is used for processing bottom layer event reporting, media processing, sound playing and the like.
5. The RTP module is only responsible for receiving the RTP packet and transmitting the RTP packet to the DSP.
6. Polling the bottom pick-up and hang-up event, putting the event into a queue after polling to the event, and waiting for a task in the CallClient module to take out the event from the queue for upper-layer processing.
7. Polling the bottom media message module and sending the message through SOCKETAPI.
8. The FastCache module mainly processes media messages sent from the socket api, because RTP is carried on UDP (unsafe protocol) for transmission, the messages may be lost, and normal voice communication is affected in terms of error control.
The FastCache module is implemented by using an embedded linux platform, which mainly comprises three parts, as shown in fig. 2:
1. the software operation comprises the following steps:
1.1, starting and initializing a process, and enabling the whole system to enter an idle state (initialization is also completed by Fastcache), including initialization of each module;
1.2 when receiving the voice RTP message from the SOCKETAPI side, the message logs in the Fastcache module, and firstly enters a high-speed cache region to cache all the received RTP messages in the secondary buffer region. Then, the first packet checking module will quickly detect the packet in the cache in the fastest way, and determine to remove the non-RTP packet, where the packet detection can be implemented by using an index algorithm (for example, the packet detection is implemented by using an incremental hash algorithm), and the problem to be solved by using a hash table as an index is: how can be the bucket dynamic growth. The existing solution is to expand the hash, but the algorithm is also complex, and when different keys have the same hash value, the problem of infinite expansion occurs. The incremental hash algorithm i introduce here is relatively simple and efficient to implement. As can be seen with reference to fig. 3.
The principle of the incremental hash algorithm is that it consists of multiple layers of buckets, as shown in the upper part of fig. 3. A packet may have n elements, each element having a fixed format as shown in the first column of fig. 3.
The flag field holds what type of element this element belongs to, as shown in the lower part of fig. 3, there are 3 cases as follows:
(1) when flag is equal to 0, this element is indicated as empty (for the third last column of FIG. 3).
(2) When flag is equal to 1, this indicates that this element is a pointer to the data record (for the penultimate column of FIG. 3).
(3) When flag is equal to-1, this indicates that this element is a pointer to the next layer (the first last column for FIG. 3).
As can be seen from FIG. 3, when flag is equal to 0, this element is empty, and nothing is saved. And when flag is 1, it indicates that this element is a pointer to a data record, the offset field is the file offset of the data file, the key _ length field is the length of key, and the data _ length is the length of data. When flag is equal to-1, it indicates that this element is a pointer to the next packet, the step field is the hash algorithm increment, the packet _ size field is the size of the next packet, and the offset field is the file offset of the next packet.
1.3 after RTP message rapid survey in RTP message 1.2 that logs on before, can return the correct RTP to and deposit in the hashtable cache again, abandon non-RTP message, in the process, it is the message error detection and voice make-up module that is parallel with it and also will poll the message after RTP check-up module constantly checks simultaneously, take away from the hashtable immediately, get into the message and make-up the module, this module will need to send the RTP message of DSP to detect once more, and after through flow statistics, lost RTP can compensate the transmission according to a special balanced voice packet, reach the effect that lost RTP will be supplemented in time.
1.4 after the compensation module and the check module finish the error control of the voice media message together, the voice media message is merged into a hash table and then is sent to the DSP one by one.
The VoIP telephone system is realized after the customization and cutting based on the linux of the embedded operating system, so the lowest layer is a TCP/IP protocol stack provided by the linux system, and IP, TCP, UDP and the like are mainly used. Above the basic protocol stacks, the SIP protocol or the H248 is used as a signaling control protocol, the UDP-based RTP/RTCP protocol is used as a real-time voice transmission protocol, and meanwhile, some applications of P2P are realized, some control hardware is also used above the protocol, during session establishment, the UDP-based RTP/RTCP messages are processed by the FastCache module in the text, so that excellent management is performed in the aspects of improving voice quality and data security, and the method is worthy of reference. The VoIP system has the advantages of simple structure, relatively small system overhead, powerful function and wide application range.
The above design scheme of the invention can be used as an efficient means for improving quality assurance and management, and is mainly applied to a voice terminal system and can also be used on local side equipment.
The embedded VoIP telephone system comprises a SOCKET API network processing unit, a call service control module, an SIP/H248 protocol stack, a bottom layer processing module, a bottom layer pick-up event polling module, a polling bottom layer media message module, an RTP protocol processing module and a voice quality management module; the voice quality management module comprises: the device comprises a high-speed cache region, a message checking module, an RTP error processing module, an RTP voice compensation module and an RTP protocol message sending module, and is used for correcting and compensating the RTP protocol message obtained from the RTP protocol processing module. Therefore, the system and the method can compensate the voice data under the condition of weaker VoIP network signals, so that a user can feel the integrity and the reliability of information in the conversation, and the user experience is greatly improved.
In this specification, the invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.