Background technology
Traditional communication traffic is to adopt circuit-switched technology, and both call sides realizes providing professional by the circuit of setting up a fixed-bandwidth, under this mode at the bottom of the bandwidth availability ratio, and the cost height of communication, and the exploitation of value-added service, promote relatively difficulty.
At present, the professional packet-switch technology that adopts of many multi-media communications newly developed, bearer network is the IP packet switching network, such as the internet.The advantage of packet switching is the network utilization height, and at the bottom of the cost of communication, and owing to used open framework, the exploitation of new business, popularization ratio are faster.
When using IP or other packet switching networks as bearer network, usually use DSP to finish the bi-directional conversion of PCM (pulse code modulation) speech to packet voice, a user's speech is converted to packet after by DSP and transmits on packet network, after packet arrives the opposite end, DSP by the other side is converted to speech again, and vice versa.
When the user uses multi-media communication that IP network provides professional,, therefore can run into following problem because IP network determines not as circuit-switched network and be reliable:
When receiving the invalid packets that comes from network, because port meets the requirements, this packet also can be driven among the DSP, influences the operate as normal of DSP, causes voice quality decline or DSP unusual.
The source of packet may be from network error, for example IP or udp port mistake.
Also may be from the network attack of malice, these bags may also can be driven among the DSP because port meets the requirements, and cause identical problem.
Under the private network environment, owing to will maintain the inside mapping of NAT, equipment needs regularly to send media message, and this message is a kind of interference for recipient's DSP passage, also can cause same problem.
Reason is: DSP can only support a voice flow at the same time, and all messages except that this voice flow all can produce disadvantageous effect to DSP, gently then introduce delay and jitter, influence speech quality, and is heavy then cause the software anomaly of dsp chip inside.
Chinese patent application (03125107) discloses a kind of sequence number with the RTP packet and has sorted to eliminate the method for its shake time-delay; This patent adopts the buffer-stored formation to receive the RTP packet from IP network, determines its memory address in buffer queue and deposits this packet in its memory address according to the packet sequence number when data are joined the team, and starts corresponding counter simultaneously; During dequeuing data, each counter that has the memory address correspondence of packet in the buffer queue is added 1 respectively, reexamine in all packets of current storage in the buffer queue, whether there is a packet to satisfy output condition: timer (i)+seq (i)=min_seq+n, if have then reexamine in the pairing memory address of minimum data bag sequence number whether packet is arranged, have then packet is wherein outputed to next interface, and with the counter O reset of its place memory address correspondence.This method is to utilize sequence number to go shake, can not invalid assorted bag, if invalid packet also has been imported in the DSP.
Chinese patent application (03125108) discloses a kind of time stamp with the RTP packet and has sorted to eliminate the method for its shake time-delay.This method adopts buffer-stored formation to receive the RTP packet, earlier first packet that normally reaches is deposited in the initial address of buffer queue when data are joined the team, and with its time stamp as the benchmark time stamp; For after each packet of receiving, determine its memory address in buffer queue according to its time stamp, and deposit it in appropriate address.During dequeuing data, at buffer memory after the scheduled time, as sending time stamp, first packet that normally reaches of correspondence is outputed to next interface with the benchmark time stamp; Add to send time stamp time stamp interval sum as new transmission time stamp, reexamines in the pairing memory address of new transmission time stamp whether packet is arranged, and has then packet is wherein outputed to next interface then.This method is to utilize timestamp to go shake, can not filter invalid bag.If invalid packet also has been imported in the DSP.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of method of the VOIP of protection DSP passage; to overcome the defective in the VOIP dsp chip packet receiving processing; tonequality descends and unusual problem takes place when solving speech channel and receiving invalid data; thereby improve the reliability of DSP passage work, make VOIP equipment possess very strong robustness and antijamming capability.
To achieve these goals; the invention provides a kind of method of the VOIP of protection digital signal processing channel; wherein; by a plurality of buffer-stored message queues to described digital signal processing channel are set; and according to the live transmission protocol message sequence number that arrives and/or the continuity of timestamp; filter the invalid packet in the described message, and the message after the described filtration is input to described digital signal processing channel.
Described method wherein, comprises the steps:
Step 1 is provided with a plurality of buffer-stored message queues to digital signal processing channel, and described formation comprises normal queue and protection formation at least;
Step 2 extracts the sequence number of the new live transmission protocol message that arrives, and according to the continuity of front and back sequence of message number and/or timestamp, judges whether described message is suspicious message; In this way, then described suspicious message is left in the described protection formation; As not, then described message is put into normal queue;
Step 3 judges according to follow-up new sequence number of message whether the suspicious message in the described protection formation is invalid packet; In this way, then abandon described suspicious message, empty described protection formation; As not, then replace normal queue with described protection formation.
Described method wherein, further comprises the step of the message in the described normal queue being passed to digital signal processing channel.
Described method wherein, comprises that further a variable v is set writes down last sequence number of message in the current normal queue.
Described method wherein, comprises that further whether the message of judging described arrival is first message after passage is opened, and in this way, then the initial value assignment with described variable v is described first sequence number of message.
Described method wherein, further comprises when described new message is deposited in normal queue, brings in constant renewal in the step of variable v.
Described method, wherein, described step 2 further comprises:
Step 2 one is set threshold value A, B;
Step 2 two, judge that whether the sequence number of message M of described new arrival and absolute value that the current value of described variable v is subtracted each other are less than described threshold value A, as denying, then described message is suspicious message, in this way, further judge that then described sequence number is whether the timestamp of the timestamp of new message of M and the old message that described sequence number is the current value of v is less than described threshold value B; In this way, then described new message is not suspicious message, is that the new message of M is listed normal queue in described sequence number, and the value of upgrading described variable v is M, and as not, then described message is suspicious message.
Described method, wherein, described step 3 further comprises:
Step 3 one is set a threshold value C;
Step 3 two writes down follow-up new sequence number of message L;
Step 3 three, whether judge absolute value that the value of described L and described variable v subtracts each other less than described A, in this way, the then described message that leaves in the protection formation is an invalid packet, and described sequence number is that the new message of L is that effective message is deposited in normal queue, and the value of upgrading described variable v is L; As not, judge further that then whether last sequence number of message is subtracted each other in described L and the described protection formation absolute value is less than described threshold value C; In this way; then the sequence number of described new reception is that the subsequent packet of L also is suspicious message; and it is deposited in the described protection formation; as denying; the then described message that leaves in the protection formation is an invalid packet; empty described protection formation, and be that the message of L deposits in the protection formation as suspicious message with described sequence number.
Described method, wherein, described step 3 three further comprises:
Step 331, the threshold value D of setting one protection formation message number;
Step 3 three or two, judge that whether the message number of depositing in the described protection formation is more than or equal to described threshold value D, in this way, then empty original normal queue, replace original normal queue with the protection formation and form new normal queue, and the value of further upgrading described variable v is last sequence number of message in the described new normal queue; As not, then described v value is constant, continues the new sequence number of message of extraction and also changes step 2 two over to.
Described method, wherein, described step 3 three or two further comprises when the message number in the described protection formation during more than or equal to described threshold value D, with the step of described original normal queue as new protection formation.
The invention solves the defective during VOIP DSP packet receiving is handled in the prior art, tonequality descends and abnormal problem when having avoided receiving invalid data.When the message of receiving is under the normal situation, do not influence original message handling process, can not introduce packet loss, shake, and postpone.When in the message of receiving invalid packet being arranged, can filter out these invalid packets, avoid unusual, improve tonequality, can not introduce new packet loss simultaneously, shake, and postpone.When carrying out medium/calling when switching, can when switching, introduce the delay of a few tens of milliseconds, can ignore, but can avoid unusual, tonequality improves simultaneously.
This method goes for all and uses the communication system of RTP as media transmission protocol.Do not need existing call control protocol to make an amendment.
Describe the present invention below in conjunction with the drawings and specific embodiments, but not as a limitation of the invention.
Embodiment
Normal RTP message is continuous, once in a while because of out of order and packet loss, and an inner among a small circle fluctuation, when the generation medium switch (being meant the switching of normal speech rtp streaming), sequence number generation saltus step, still follow-up message should be again continuous.According to these characteristics, can temporarily be placed on suspicious message in the protection formation temporarily, be invalid packet if follow-up message proves suspicious message, then empty interim formation; If it is effective message really that follow-up message proves suspicious message, then replaces normal queue, and data are passed to DSP with the protection formation.Normal queue originally is as new protection formation.Method of the present invention can be by judging sequence of message number continuity or the continuity of timestamp, also can be used in combination, realize by the continuity of judging sequence number and timestamp simultaneously.
Fig. 1 shows the process chart of the inventive method, and it is as follows to invent described method:
1) several buffer-stored message queues of each DSP channel allocation comprise normal queue and protection formation.The reallocation variable writes down last sequence number of message that enters current normal queue, supposes and has distributed a variable that name is v.
2) when DSP receives a new RTP message (step 101), judge that whether this message is this passage first message (step 102) after opening, in this way, then this message is put in the normal queue, promptly when DSP receives first message, this message is put in the normal queue, and writes down this sequence number of message with variable v, suppose that this sequence number of message is N, then v=N (step 103);
3) as denying, then extract this sequence number of message (supposition equals M) (step 104), judge whether M=v+1 (step 105), if M=v+1, think that then this RTP message is a complete normal and continuous message, this message is put in the normal queue, and writes down new sequence number, be i.e. v=M (step 106) with variable v.
4) if the absolute value that judgement M and v subtract each other is little, be that M subtracts the absolute value of v (this threshold value can dispose less than a threshold value A, such as being set to 10), and sequence number is that (this threshold value also can dispose the absolute value that subtracts each other of the timestamp of the message of M, v less than a threshold value B, such as being set to 100 milliseconds) (step 107), thinking that then this message still belongs to normally, may be because low layer is unreliable transmission, has taken place out of order or packet loss.This message is put into normal queue.Write down new sequence number with variable v, i.e. v=M (step 108).
5) if the absolute value that M and v subtract each other bigger (being that M subtracts the absolute value of v more than or equal to threshold value A); perhaps sequence number is that the absolute value that subtracts each other of the timestamp of the message of M, v is more than or equal to threshold value B; think that this message is suspicious, this message is put into the protection formation.The value of variable v does not change.Wait for that follow-up message determines next step processing, (step 109).
6) when receiving follow-up RTP message; extract this sequence number of message (supposition equals L) (step 110); judge that whether not quite L compares difference (being that L subtracts the absolute value of v less than threshold value A) (step 111) with variable v; in this way; thinking that then protection formation the inside bag under a cloud is invalid bag, empty the protection formation, is sequence number that the message of L is put into the normal queue the inside; write down new sequence number with variable v, i.e. v=L (step 112).
7) big if L and variable v compare difference; be that L subtracts the absolute value of v greater than threshold value A; judge further then sequence number is whether continuous the message of L is compared with the message of protection formation the inside; be whether L subtracts the absolute value of the last sequence number of message of protecting the formation the inside less than threshold value C (step 113); as denying; be that new message is compared more discontinuous with the message in the protection formation; think that then not only going up a bag under a cloud is invalid bag; and the message of newly receiving also is suspicious; emptying the protection formation earlier, is the sequence number of newly receiving that the message of L is put in the protection formation (step 114) again.Notice that threshold value C and threshold value A dispose separately, C can be configured to 5 such as threshold value.
8) if L compares difference big (being that L subtracts the absolute value of v greater than threshold value A) with variable v; but comparing with the message of protection formation the inside is more continuous (L deducts the absolute value of last sequence number of message of protection formation less than threshold value C), is this sequence number that the message of L is put into protection formation (step 115).The number of check protection formation the inside message; judge whether that (this threshold value also can dispose if number is less than threshold value D less than threshold value D (step 116); for example be configured to 3); then the value of variable v does not change; wait for next message (step 118); and get back to step 110, wait for that follow-up message determines next step processing.Number up to protection formation the inside message is greater than or equal to threshold value D, then enters step 117.
9) think that at this moment the existing bag under a cloud in protection formation the inside all is effective bag, replace original normal queue as new normal queue, empty original normal queue simultaneously, use as new protection formation with the protection formation.Write down the sequence number (the supposition sequence number is X) of last test serial number of receiving, i.e. v=X (step 117) with variable v.
Wherein, threshold value A in the superincumbent step, B, C can dispose.In addition, the protection formation upgrades to normal queue when receiving what continuous RTP messages also can dispose, and that is to say that threshold value D also can dispose.The numerical value of threshold value D is big more, and the possibility that mistake is switched is more little, but switching delay is also big more.In the engineering, can find an optimal value, make speech quality, switching delay, combination property optimums such as equipment robustness by these threshold values of flexible configuration.
Lift an application example, other application is similar.Wherein, Fig. 2 is for using the sequence chart that the preceding RTP message of method of the present invention enters DSP.Fig. 3 is the sequence chart that the RTP message enters DSP after the application method of the present invention.
Here be example to have distributed two formations, one as normal queue, and one as the protection formation.Thresholding A is configured to 10 in this example, and thresholding B is configured to 100ms, and thresholding C is configured to 5, and thresholding D is configured to 2.
The first step receives that sequence number is that 1 bag is placed on normal queue (the initial normal queue 31 shown in Fig. 3) the inside, waits for that the DSP driver is input to message among the DSP.Record current sequence number=1.
In second step, receive that sequence number is that 2 bag is placed on the normal queue the inside, waits for that the DSP driver is input to message among the DSP.Record current sequence number=2.
In the 3rd step, receive that sequence number is 4 bag, though the sequence number of bag is discontinuous, but be more or less the same (less than thresholding A), at this time the review time stabs, and it also is be more or less the same (less than thresholding B) that discovery time is stabbed, then be placed on the normal queue the inside, wait for that the DSP driver is input to message among the DSP.Record current sequence number=4.
The 4th step; receive that sequence number is 1000 bag; the sequence number discontinuous fully (greater than thresholding A) of bag; illustrate that this bag is suspicious; owing to can not determine that this message is invalid packet or the medium switching has taken place at present; so this message is put into the protection formation, the initial protection formation 33 shown in Fig. 3.
The 5th step; receive that sequence number is 5 bag; the sequence number of bag and the current sequence number of normal queue are continuous; at this time can determine to protect bag under a cloud in the formation is invalid bag; empty No. 1000 bags in the protection formation; is sequence number that 5 Bao Ze is placed on the normal queue the inside, waits for that the DSP driver is input to message among the DSP.Record current sequence number=5.
In the 6th step, receive that sequence number is that 6 bag is placed on the normal queue the inside, waits for that the DSP driver is input to message among the DSP.Record current sequence number=6.
The 7th step, receive that sequence number is 1001 bag, the sequence number of bag discontinuous fully (greater than thresholding A) illustrates that this bag is suspicious, owing to can not determine that this message is invalid packet or the medium switching has taken place at present, so this message is put into the protection formation.
The 8th step; receive that sequence number is 1002 bag; the sequence number of bag and the current sequence number of normal queue are discontinuous; but comparing with 1001 messages of protection formation the inside is continuously (less than thresholding C); earlier this message is put into protection formation the inside; whether the quantity that reexamines the message of protection formation the inside reaches thresholding D; because thresholding D is configured to 2 now; so reached thresholding; at this time can determine to have taken place the medium switching, the protection formation is labeled as normal queue, be the normal queue after the switching shown in Fig. 3 32; empty original normal queue simultaneously, be labeled as the protection formation and use.Wait for that the DSP driver is input to 1001, No. 1002 messages among the DSP.Record current sequence number=1002.
In the 9th step, receive that sequence number is that 1003 bag is placed on the normal queue the inside, waits for that the DSP driver is input to message among the DSP.Record current sequence number=1003.
In the tenth step, receive that sequence number is 10 bag, the sequence number of bag discontinuous (greater than thresholding A); illustrate that this bag is suspicious; owing to can not determine that this message is invalid packet or the medium switching has taken place at present, so this message is put into the protection formation, the protection formation 34 after the switching shown in Fig. 3.
The 11 step; receive that sequence number is 1005 bag; the sequence number of bag and the current sequence number of normal queue are very near (less than thresholding A); at this time can determine to protect bag under a cloud in the formation is invalid bag; empty No. 10 bags in the protection formation; is sequence number that 1005 Bao Ze is placed on the normal queue the inside, waits for that the DSP driver is input to message among the DSP.Record current sequence number=1005.
The 12 step, receive that sequence number is 1006 bag, be placed on the normal queue the inside, wait for that the DSP driver is input to message among the DSP.Record current sequence number=1006.
The 13 step, receive that sequence number is 1007 bag, be placed on the normal queue the inside, wait for that the DSP driver is input to message among the DSP.Record current sequence number=1007.
The 14 step, receive that sequence number is 2000 bag, the sequence number of bag discontinuous fully (greater than thresholding A) illustrates that this bag is suspicious, owing to can not determine that this message is invalid packet or the medium switching has taken place at present, so this message is put into the protection formation.
The 15 step; receive that sequence number is 3000 bag; the sequence number and the normal queue discontinuous (greater than thresholding A) of bag; bag also discontinuous (greater than thresholding C) with protection formation the inside; illustrate that these two bags are all suspicious; can not determine that this message is invalid packet or the medium switching has taken place, No. 2000 bags of deletion protection formation the inside are sequence number that 3000 bag is put into protection formation the inside.
The 16 step, receive that sequence number is 1008 bag, the sequence number of bag and the current sequence number of normal queue are continuous, and at this time can determine to protect bag under a cloud in the formation is invalid bag, empties the protection formation.Wrap in the normal queue the inside for No. 1008 putting, wait for that the DSP driver is input to message among the DSP.Record current sequence number=1008.
The 17 step, receive that sequence number is 1009 bag, be placed on the normal queue the inside, wait for that the DSP driver is input to message among the DSP.Record current sequence number=1009.
Through this process, use RTP message before this method with reference to figure 2 and enter the sequence chart of DSP and accompanying drawing 3 and use the sequence chart that the RTP message enters DSP after this method.What Fig. 2 adopted is single formation mode of prior art, adopts this mode, and all messages directly enter DSP.Fig. 3 adopts deque's mode, and normal queue and protection formation are set respectively, has only the message of normal queue the inside just to enter DSP.The front and back contrast adopts method of the present invention to have only the message in the normal queue just to enter DSP as can be seen, has the RTP message of a lot of interference originally; after treatment; become one very clocklike, very the voice rtp streaming of " totally " is input in the DSP, plays the protective effect to DSP.
Can flexible configuration in the top process to the Rule of judgment of effective message, for example: thresholding A, thresholding B, thresholding C, thresholding D.Above condition can appropriate combination, modification flexibly.Reach the purpose that on engineering, finds optimal value.
Certainly; the present invention also can have other various embodiments; under the situation that does not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art work as can make various corresponding changes and distortion according to the present invention, but these corresponding changes and distortion all should belong to the protection range of the appended claim of the present invention.