CN105704137A - Method and system for transmitting voices based on TCP in VoIP - Google Patents
Method and system for transmitting voices based on TCP in VoIP Download PDFInfo
- Publication number
- CN105704137A CN105704137A CN201610141100.5A CN201610141100A CN105704137A CN 105704137 A CN105704137 A CN 105704137A CN 201610141100 A CN201610141100 A CN 201610141100A CN 105704137 A CN105704137 A CN 105704137A
- Authority
- CN
- China
- Prior art keywords
- data
- coding
- tcp
- byte
- middleware
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/1066—Session management
- H04L65/1101—Session protocols
- H04L65/1104—Session initiation protocol [SIP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/02—Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
- H04L63/029—Firewall traversal, e.g. tunnelling or, creating pinholes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M7/00—Arrangements for interconnection between switching centres
- H04M7/006—Networks other than PSTN/ISDN providing telephone service, e.g. Voice over Internet Protocol (VoIP), including next generation networks with a packet-switched transport layer
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Multimedia (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention provides a method and a system for transmitting voices based on the TCP in the VoIP, wherein an SIP terminal sends and receives data by means of a middleware unit. The data sending process comprises the steps of encoding a self-recognition boundary of data by the middleware unit, and sending the encoded data to an opposite-site SIP terminal through the TCP transmission. The data receiving process comprises the steps of decoding the self-recognition boundary of data received through the TCP transmission by the middleware unit, and sending the decoded data to the SIP terminal. According to the technical scheme of the invention, the TCP protocol stack is optimized, and the real-time transmission effect of voice data is improved. Meanwhile, the voice transmission is conducted based on the optimized TCP protocol to traverse a firewall. During the transmission process of voice data, the middleware unit is adopted cooperatively. Therefore, the self-recognition of the TCP data boundary is realized. The transmission effect of voice data is further improved.
Description
Technical field
The present invention relates to communication technical field, particularly relate to the method and system based on TCP transmission voice in a kind of VoIP。
Background technology
Network address conversion anti-virus transition (NAT/FT, NetworkAddressTranslation/FirewallTraversal), is can the technology of proper communication between a kind of main frame ensured after NAT device and the main frame of outside。
Owing to IPv4 address is in short supply and network security problem, most enterprise customers are provided with NAT/NAPT equipment at network exit and set up the binding between a private IP address, privately owned port and public network IP, public network port, distribute public network address and port for intranet host and external host communicates。Session initiation Protocol (SIP, SessionInitiationProtocol) it is a text based application layer protocol, the relevant IP address information of session establishment is transmitted in the packet, but below TCP/IP protocol layer is processed by NAT, the SIP data bag of application layer cannot be resolved, it is impossible to complete normal SIP session establishment process。Considering from secure context, most enterprises are provided with fire wall at network exit, and the IP packet of the fire wall by arranging is filtered according to corresponding strategies。Fire wall is when access list configures, and except opening in net except the well-known port of service needed (80 ports such as http), other port is generally all configured to refusal。For applying based on the multimedia communication of SIP, it is necessary to dynamically consult Media Stream port in controlling signaling, and safeguard that multiple UDP flow realizes transmission and the reception of Media Stream。Dynamically the port of distribution is configure fixing packet filtering strategy on fire wall to bring difficulty, for not supporting the fire wall of SIP application gateway (SIPALG), it is impossible to obtains dynamic port information, causes that media message can not pass through。
Along with VoIP (VoiceoverInternetProtocol, the networking telephone) and the maturation of Softswitch technology and extensive use, increasing enterprises and individuals have employed VoIP and Softswitch technology carries out the integration of inside data of enterprise network and speech network。But, for the purpose of safety, Intranet exists substantial amounts of fire wall;Meanwhile, in order to save the address of IPv4, a lot of enterprises adopt NAT (NetworkAddressTranslation, network address translation) technology, namely private network at present, make substantial amounts of main frame in Intranet access Internet by a few IP。These technology Internet network in early days plays a significant role, it is possible to be used for stopping the data safety attacking, saving IP address, protection enterprises from enterprise external network。But in the application of VoIP, the feature of various business needs and underlying protocol so that fire wall that enterprise leaves over and NAT seriously hinder the application of VoIP so that speech data cannot effectively transmit。Then, fire wall that enterprise leaves over just has become a problem demanding prompt solution how to make VoIP pass through。
At present in speech communication field, main employing TCP, as the agreement of voice transfer, utilizes TCP to realize the purpose that fire wall/private network passes through。Traditional Transmission Control Protocol is when sending data, it is necessary to strict guarantee data orderly, has two buffer queues: sequential queue and out of order queue in protocol stack。When TCP transmission data time, if what the current data arrived were ordered into, then data enter in ordered queue;If out of order, then data can be cached in out of order queue, and after the data before wait arrive, another rising copies continuous print data in sequential queue to。When application layer calls read () reading data time, if sequential queue has data, then the data in sequential queue are returned to application layer;If sequential queue not having data and out of order team having data, then, after the data of vacancy arrive before needing to wait, the data in out of order data are copied in sequential queue, returns again to application layer。This transmission characteristic, when using TCP transmission voice, will increase speech data time delay end to end, cause the delay of voice, shake and pause, it is impossible to reach gratifying communication effect。
And, it TCP transmission process is face phase byte stream, do not retain the boundary information of any data, once there occurs packet loss, unless waited pending data to retransmit successfully, otherwise application layer will be incapable of recognizing that the border of data, can cause that application layer cannot parse VoP, causes that whole call all will be unable to hear effective sound。
In order to solve in TCP transmission voice process, the high latency problem that its retransmission mechanism and congestion control mechanism cause, currently mainly there is solution below:
1, act on behalf of thinking
Agency makes the calling of terminal-to-terminal service look like two callings separated: one is from privately owned online terminal to agency, and another is that agency solves NAT problem by this calling is carried out transfer from the terminal acted on behalf of to public network。
It is however a drawback of the method that: this solution typical case application is to put an agency after fire wall, and agency needs to be assigned with public ip address。Fire wall is configured to allow agency and outside to carry out multi-media communication。Sometimes all apply NAT device along network path in many positions, be at this moment accomplished by using the local of NAT to place agency at each。
2, Tunnel Passing scheme
General enterprises net is not intended to upgrading or changes their fire wall and the configuration of NAT device, also do not want to allow inside and outside interactive correspondence walk around these equipment, the penetration tunnel scheme allowing ip voice passing fire wall and NAT is adopted to may is that most suitable, penetration tunnel solution is made up of two assemblies, Server software and Client software。Client is placed on the privately owned net in fire wall, it has gatekeeper function and agent functionality simultaneously, endpoint registration in privately owned net is to Client, Server outside it and fire wall creates a signaling and controls passage, all of registration and call control signalling can be forwarded to Server, also speech data being forwarded to Server, address and port numbers with the outside packet mailing to terminal that when forwarding, it sends inside terminals replace with oneself。Server is placed in the Public Space outside fire wall。
The maximum shortcoming of this method is that all communications through fire wall all must via Server to carry out transfer, and this can cause potential bottleneck, and this can increase the delay less than 5ms via the process of Client and Server。But this is again necessary, because the equipment that Server is fire wall uniquely to be trusted。
In having generally comprised NAT real network scene, fire wall is always with occurring, in this case, NAT and fire wall all effectively cannot be passed through by aforesaid technology while taking into account efficiency simultaneously, under considering the premise passing through efficiency, each prior art for network environment all more single, it is impossible to solve in VoIP NAT and firewall traversal problem in most classical network environment。
Summary of the invention
The features and advantages of the present invention are partly stated in the following description, or can from this description it is clear that or can learn by putting into practice the present invention。
For overcoming problem of the prior art, the present invention provides the method and system in a kind of VoIP based on TCP transmission voice, in communication process, SIP software terminal completes transmission and the reception of data by adopting middleware unit, this middleware unit is by the coding to data simultaneously, realizing the function that out of order datagram sends, thus ensureing the quality of call, jointly completing the interaction of SIP software terminal session。
This invention address that the technical scheme that above-mentioned technical problem adopts is as follows:
According to an aspect of the present invention, it is provided that based on the method for TCP transmission voice in a kind of VoIP, it is characterised in that sip terminal uses middleware unit to carry out transmission and the reception of data, wherein:
Step is included: these data are carried out the coding on self-identifying border by this middleware unit when carrying out the transmission of these data, and by these data after coding by TCP transmission to opposite end sip terminal;
Include step when carrying out the reception of these data: the decoding to carrying out self-identifying border from this TCP data received of this middleware unit, decoded data are passed to this sip terminal。
According to one embodiment of present invention, when these data are carried out the coding on self-identifying border by this middleware unit, including step:
A1, inquire about the position that 0x00 byte in these data occurs, with byte 0x00 for mark, be divided into several with the data block of 0x00 ending these data, then respectively this data block each inputted data as one;If these data do not have 0x00 byte, then these data whole are inputted data as one;
A2, use consistent overhead byte filling algorithm, these input data are encoded, the result of the coding of these input data all is spliced, obtain final coding data;
A3, at the head and the tail of these coding data respectively plus 0x00 byte, as data boundary mark, it is achieved identify the function on border。
According to one embodiment of present invention, this middleware unit to when carrying out the decoding on self-identifying border from this TCP data received, including step:
B1, searching head and the tail are all these coding data of 0x00, and remove the 0x00 byte of head and the tail,
B2, use consistent overhead byte filling algorithm, to this coding decoding data, then judge the type of these coding data according to the type information of data header;
B3 if signaling data, then passes to signaling processing module this signaling data and processes, if speech data, then this speech data is passed to Voice media processing module and processes。
According to one embodiment of present invention, by these data after coding by TCP transmission to this opposite end sip terminal, including step: judge that the sequential queue of the protocol stack of this TCP and out of order queue have no data;If this sequential queue has data, then read the data in this sequential queue, and be saved in the middleware relief area of correspondence;If no data in this sequential queue, and this out of order queue has data, then read continuous print one piece of data in this out of order queue, according to its side-play amount, be saved in the middleware relief area of correspondence;If equal no data, then remain waiting in this sequential queue and out of order queue;Before the decoding to carrying out self-identifying border from this TCP data received of this middleware unit, when first detecting the continuous print the data segment whether data in this middleware relief area exist with 0x00 beginning and end;If existing, then this continuous print data segment is carried out the decoding on self-identifying border, decoded data are passed to the data processing module that sip terminal is corresponding。
According to one embodiment of present invention, after the data in reading this sequential queue, the protocol stack of TCP first adds the header information of 5 bytes the data in this sequential queue, then copies middleware relief area to;In reading this out of order queue after continuous print one piece of data, the protocol stack of this TCP first adds the header information of this 5 byte this continuous print one piece of data, then copies reception data buffer, intermediate layer to。
According to one embodiment of present invention, the 1st byte in the header information of this 5 byte represents that the data this time read are ordered into or out of order, and rear 4 bytes represent the data read side-play amount in original data stream。
According to another aspect of the present invention, it is provided that based on the system of TCP transmission voice in a kind of VoIP, including:
Sip terminal, is used for receiving data or sending data to opposite end sip terminal;
Middleware unit, including coding module and decoder module, this coding module for carrying out the coding on self-identifying border to these data, and this decoder module is for the decoding carrying out self-identifying border from this TCP data received;
TCP unit, for these data after coding are transferred to this opposite end sip terminal, or receives these data after this opposite end sip terminal coding。
According to one embodiment of present invention, this coding module includes:
Input data submodule, for inquiring about the position that in these data, 0x00 byte occurs, with byte 0x00 for mark, is divided into several with the data block of 0x00 ending these data, then respectively this data block each is inputted data as one;If these data do not have 0x00 byte, then these data whole are inputted data as one;
Data encoding submodule, is used for using consistent overhead byte filling algorithm, these input data is encoded, the result of the coding of these input data all is spliced, obtain final coding data;
Boundary marking submodule, for the head and the tail in these coding data respectively plus 0x00 byte, as data boundary mark, it is achieved identify the function on border;
This decoder module includes:
Data query submodule, for finding these coding data that head and the tail are all 0x00, and removes the 0x00 byte of head and the tail,
Data decoding sub-module, uses consistent overhead byte filling algorithm, to this coding decoding data, then judges the type of these coding data according to the type information of data header;If signaling data, then this signaling data is passed to signaling processing module and process, if speech data, then this speech data is passed to Voice media processing module and process。
According to one embodiment of present invention, this TCP unit includes:
Judge module, is used for judging there is no data in the sequential queue of the protocol stack of this TCP and out of order queue;If this sequential queue has data, then the data in this sequential queue are copied to middleware relief area;If no data in this sequential queue, and this out of order queue has data, one section of continuous print data in this out of order queue, copy middleware relief area to;If equal no data in this sequential queue and out of order queue, wait that this opposite end sip terminal sends data;
Byte adds module, for the data in this sequential queue, first adding the header information of 5 bytes, then copy middleware relief area to;It is additionally operable to one section of continuous print data in this out of order queue, first add the header information of this 5 byte, then reception data buffer, intermediate layer is copied to, wherein the 1st byte in the header information of this 5 byte represents that the data this time read are ordered into or out of order, and rear 4 bytes represent the data read side-play amount in original data stream。
According to one embodiment of present invention, this middleware unit adopts middleware_sendmsg interface as the interface sending data, for receiving signaling or the speech data that this sip terminal sends;This middleware unit also adopts middleware_recvmsg interface as the interface receiving data, for obtaining signaling or the speech data that this sip terminal sends。
Based on the method and system of TCP transmission voice in a kind of VoIP provided by the invention, first tcp protocol stack is optimized, improves the effect of its transmission Real-time voice data;After sip terminal is deployed in fire wall, uses the UDP of routine to transmit voice and cannot pass through fire wall, it is impossible to when reaching gratifying communication effect, then voice is transmitted by the Transmission Control Protocol after must using optimization, passing fire wall;In voice data transmission process, with the use of intermediate module, it is achieved the self-identifying on tcp data border, optimize the effect of voice data transmission further。
By reading description, those of ordinary skill in the art will be best understood feature and the content of these technical schemes。
Accompanying drawing explanation
It is specifically described the present invention below with reference to accompanying drawing and in conjunction with example, advantages of the present invention and implementation will become apparent from, wherein content shown in accompanying drawing is only for explanation of the present invention, and does not constitute the restriction gone up in all senses to the present invention, in the accompanying drawings:
Fig. 1 be the embodiment of the present invention VoIP in based on the schematic flow sheet of method of TCP transmission voice。
Fig. 2 is the step schematic diagram of the coding that data carry out self-identifying border of the embodiment of the present invention。
Fig. 3 be the embodiment of the present invention VoIP in based on the structural representation of system of TCP transmission voice。
Detailed description of the invention
As shown in Figure 1, the present invention provides a kind of method in VoIP based on TCP transmission voice, it is characterized in that, sip terminal uses middleware unit to carry out transmission and the reception of data, wherein: include step S1 when carrying out the transmission of data: data are carried out the coding on self-identifying border by middleware unit, and by the data after coding by TCP transmission to opposite end sip terminal;Step is included: the middleware unit data to receiving from TCP carry out the decoding on self-identifying border, and decoded data are passed to sip terminal when carrying out the reception of data。
Visible, the present invention uses the API that middleware unit provides to carry out signaling, the transmission of speech data and reception, specifically: when the API using middleware unit to provide sends data, middleware unit is that sip terminal provides middleware_sendmsg as the interface sending data, when sip terminal needs that signaling, speech data are sent to opposite end sip terminal time, it is only necessary to pass to middleware_sendmsg needing the data sent;When the API using middleware to provide receives data, middleware is that sip terminal provides middleware_recvmsg as the interface receiving data, when opposite end sip terminal needs the data receiving opposite end transmission time, have only to call this interface and obtain data, after the data type received is judged, if signaling data, then do respective handling according to signaling content;If speech data, then speech data is then carried out speech play。
In the present invention, sip terminal or opposite end sip terminal can include various types of SIP software terminal, such as PC, Pad or smart mobile phone, in the present invention, the side sending data is defined as sip terminal, the side receiving data is then defined as opposite end sip terminal, that is, sip terminal or opposite end sip terminal are to work as the sip terminal that the first two carries out conversing, therefore same smart mobile phone is the sip terminal in the present invention when sending data, and when receiving data, be then the opposite end sip terminal in the present invention。First, the IP and port that UE (SIP software terminal) inputs opposite end by dialling, initiates call request。
Refer to Fig. 2, in step sl, when these data are carried out the coding on self-identifying border by middleware unit, including step:
A1, inquire about the position that 0x00 byte in these data occurs, with byte 0x00 for mark, be divided into several with the data block of 0x00 ending these data, then respectively this data block each inputted data as one;If these data do not have 0x00 byte, then these data whole are inputted data as one;In the present embodiment, former outgoing data comprises 3 byte 0x00, split into four data blocks, corresponding 4 input data;
A2, use consistent overhead byte filling algorithm, these input data are encoded, the result of the coding of these input data all is spliced, obtain final coding data;In the present embodiment, these coding data are that after inputting, by 4, the coding that data are corresponding, result is spliced;
A3, at the head and the tail of these coding data respectively plus 0x00 byte, as data boundary mark, it is achieved identify the function on border。
In step s 2, this middleware unit to when carrying out the decoding on self-identifying border from this TCP data received, including step:
B1, searching head and the tail are all these coding data of 0x00, and remove the 0x00 byte of head and the tail,
B2, use consistent overhead byte filling algorithm, to this coding decoding data, then judge the type of these coding data according to the type information of data header;
B3 if signaling data, then passes to signaling processing module this signaling data and processes, if speech data, then this speech data is passed to Voice media processing module and processes。Above-mentioned signaling processing module, Voice media processing module belong to sip terminal。
The data of TCP are also transmitted and are optimized by the present invention, improve the TCP process that data are transmitted, namely when sequential queue does not have data, and out of order queue has data, then first the data in out of order queue are passed to sip terminal, utilize middleware to determine the integrity of out of order data simultaneously, after datagram completely arrives, to decoding data, pass to the processing module that sip terminal is corresponding, specifically, when these data after coding are passed through TCP transmission to this opposite end sip terminal, including step: judge that the sequential queue of the protocol stack of this TCP and out of order queue have no data;If this sequential queue has data, then read the data in this sequential queue, and be saved in middleware relief area corresponding in middleware unit;If no data in this sequential queue, and this out of order queue has data, then read continuous print one piece of data in this out of order queue, according to its side-play amount, be saved in the middleware relief area of correspondence;If equal no data in this sequential queue and out of order queue, then illustrate that opposite end sip terminal does not transmit data, remains waiting for。Specifically, after the data in reading this sequential queue, the protocol stack of TCP first adds the header information of 5 bytes the data in this sequential queue, then copies middleware relief area to;Equally in reading this out of order queue after continuous print one piece of data, the protocol stack of TCP first adds the header information of this 5 byte this continuous print one piece of data, then copies reception data buffer, intermediate layer to;The 1st byte in the header information of this 5 byte represents that the data this time read are ordered into or out of order, and rear 4 bytes represent the data read side-play amount in original data stream。
Before the middleware unit decoding to carrying out self-identifying border from this TCP data received, when first detecting the continuous print the data segment whether data in this middleware relief area exist with 0x00 beginning and end;If existing, then this continuous print data segment is carried out the decoding on self-identifying border, decoded data are passed to the data processing module that sip terminal is corresponding, passes to signaling processing module by signaling data and process, speech data is passed to Voice media processing module and processes。
In the present invention, data to be sent first pass around middleware unit coding and form coding data, and add 0x00 byte as Boundary Recognition mark at the head and the tail encoding data, are subsequently sent to opposite end sip terminal。In transmitting procedure, data are likely that multiple data segment sends by disassembled asset such as routers, and the situation having packet loss sends, but when data receiver, according to Boundary Recognition mark, complete coding data can be found, after decoding, pass to opposite end sip terminal。
As it is shown on figure 3, the present invention provides the system in a kind of VoIP based on TCP transmission voice, including: sip terminal 10, it is used for receiving data or sending data to opposite end sip terminal;Middleware unit 20, including coding module 30 and decoder module 40, this coding module 30 for carrying out the coding on self-identifying border to these data, and this decoder module 40 is for the decoding carrying out self-identifying border from this TCP data received;TCP unit 50, for these data after coding are transferred to this opposite end sip terminal, or receives the data after the sip terminal coding of opposite end。Wherein, sip terminal or opposite end sip terminal are to work as the sip terminal that the first two carries out conversing, and in the present invention, the side sending data are defined as sip terminal, and the side receiving data is then defined as opposite end sip terminal。
Above-mentioned sip terminal 10 is responsible for the process of signaling and the acquisition of speech data and encapsulation, and middleware unit 20 is responsible for sip terminal to submit to the data encoding come and decoding, it is provided that datagram transmission service, calls TCP unit 50 and carries out data transmission。This sip terminal 10 includes SIPUA module 11 (SIP signaling proxy module), medium process module 12 and audio coding decoding module 13;Wherein SIPUA module has been used for the interaction of all SIP signalings;Medium process module 12, in order to catch the audio stream of audio frequency apparatus, then calls audio coding decoding module 13 and is encoded, be finally packaged into realtime transmission protocol RTP bag and be sent to opposite end communication party;Audio coding decoding module 13, in order to the encoding and decoding to described audio stream。
In the present embodiment, this coding module 30 includes: input data submodule 31, for inquiring about the position that in these data, 0x00 byte occurs, with byte 0x00 for mark, it is divided into several with the data block of 0x00 ending these data, then respectively this data block each is inputted data as one;If these data do not have 0x00 byte, then these data whole are inputted data as one;Data encoding submodule 32, is used for using consistent overhead byte filling algorithm, these input data is encoded, the result of the coding of these input data all is spliced, obtain final coding data;Boundary marking submodule 33, for the head and the tail in these coding data respectively plus 0x00 byte, as data boundary mark, it is achieved identify the function on border。
This decoder module 40 includes: data query submodule 41, for finding these coding data that head and the tail are all 0x00, and removes the 0x00 byte of head and the tail;Data decoding sub-module 42, uses consistent overhead byte filling algorithm, to this coding decoding data, then judges the type of these coding data according to the type information of data header;If signaling data, then this signaling data is passed to signaling processing module and process, if speech data, then this speech data is passed to Voice media processing module and process。Although not showing in figure, but this signaling processing module, Voice media processing module belong to sip terminal 10。
Additionally, middleware unit 20 can adopt middleware_sendmsg interface as the interface sending data, for receiving signaling or the speech data that this sip terminal sends;This middleware unit can also adopt middleware_recvmsg interface as the interface receiving data, for obtaining signaling or the speech data that this sip terminal sends。
In the present embodiment, this TCP unit 50 includes: judge module 51, is used for judging there is no data in the sequential queue of the protocol stack of this TCP and out of order queue;If this sequential queue has data, then utilize this middleware unit that the data in sequential queue are received;If no data in this sequential queue, and this out of order queue has data, then utilize this middleware unit to receive one section of continuous print data in out of order queue;If equal no data in this sequential queue and out of order queue, then this middleware unit waits that opposite end sip terminal sends data;Byte adds module 52, for the data in this sequential queue, first adding the header information of 5 bytes, then copies middleware relief area corresponding in middleware unit to;It is additionally operable to one section of continuous print data in this out of order queue, first add the header information of this 5 byte, then the middleware relief area of correspondence is copied to, wherein the 1st byte in the header information of this 5 byte represents that the data this time read are ordered into or out of order, and rear 4 bytes represent the data read side-play amount in original data stream。
Based on the method and system of TCP transmission voice in VoIP provided by the invention, use TCP to come transmitting audio data and the impact that Real-time voice data is transmitted by the retransmission mechanism reducing TCP, improve the effect of TCP transmission voice。When sending data, utilize middleware unit that the data to send are encoded, it is achieved to identify the function of data boundary;When receiving data, again by middleware unit to decoding data, utilize Boundary Recognition, after reading complete data decoding, pass to opposite end sip terminal。
Describing the preferred embodiments of the present invention above by reference to accompanying drawing, those skilled in the art are without departing from the scope of the present invention and essence, it is possible to have multiple flexible program to realize the present invention。For example, the feature as the shown partially of an embodiment or description can be used for another embodiment to obtain another embodiment。These are only the embodiment that the present invention is preferably feasible, not thereby limit to the interest field of the present invention that the equivalence change that all utilizations description of the present invention and accompanying drawing content are made is both contained within the interest field of the present invention。
Claims (10)
1. based on the method for TCP transmission voice in a VoIP, it is characterised in that sip terminal uses middleware unit to carry out transmission and the reception of data, wherein:
Step is included: described data are carried out the coding on self-identifying border by described middleware unit when carrying out the transmission of described data, and by the described data after coding by TCP transmission to opposite end sip terminal;
Include step when carrying out the reception of described data: the decoding to carrying out self-identifying border from the described TCP data received of the described middleware unit, decoded data are passed to described sip terminal。
2. according to claim 1 in VoIP based on the method for TCP transmission voice, it is characterised in that when described data are carried out the coding on self-identifying border by described middleware unit, including step:
A1, inquire about the position that 0x00 byte in described data occurs, with byte 0x00 for mark, be divided into several with the data block of 0x00 ending described data, then respectively each described data block inputted data as one;If described data do not have 0x00 byte, then whole described data are inputted data as one;
A2, use consistent overhead byte filling algorithm, described input data are encoded, the result of the coding of all described input data are spliced, obtains final coding data;
A3, at the head and the tail of described coding data respectively plus 0x00 byte, as data boundary mark, it is achieved identify the function on border。
3. according to claim 1 in VoIP based on the method for TCP transmission voice, it is characterised in that described middleware unit to when carrying out the decoding on self-identifying border from the described TCP data received, including step:
B1, searching head and the tail are all the described coding data of 0x00, and remove the 0x00 byte of head and the tail,
B2, use consistent overhead byte filling algorithm, to described coding decoding data, then judge the type of described coding data according to the type information of data header;
B3 if signaling data, then passes to signaling processing module described signaling data and processes, if speech data, then described speech data is passed to Voice media processing module and processes。
4. according to claim 1 in VoIP based on the method for TCP transmission voice, it is characterized in that, by the described data after coding by TCP transmission to described opposite end sip terminal time, including step: judge that the sequential queue of the protocol stack of described TCP and out of order queue have no data;If described sequential queue has data, then read the data in described sequential queue, and be saved in the middleware relief area of correspondence;If no data in described sequential queue, and described out of order queue has data, then read continuous print one piece of data in described out of order queue, according to its side-play amount, be saved in the middleware relief area of correspondence;If equal no data, then remain waiting in described sequential queue and out of order queue;
Before the decoding to carrying out self-identifying border from the described TCP data received of the described middleware unit, when first detecting the continuous print the data segment whether data in described middleware relief area exist with 0x00 beginning and end;If existing, then described continuous print data segment is carried out the decoding on self-identifying border, decoded data are passed to the data processing module that sip terminal is corresponding。
5. based on the method for TCP transmission voice in VoIP described in claim 4, it is characterized in that, after data in reading described sequential queue, the protocol stack of TCP first adds the header information of 5 bytes the data in described sequential queue, then copies middleware relief area to;In reading described out of order queue after continuous print one piece of data, the protocol stack of described TCP first adds the header information of described 5 bytes described continuous print one piece of data, then copies reception data buffer, intermediate layer to。
6. according to claim 5 in VoIP based on the method for TCP transmission voice, it is characterized in that, the 1st byte in the header information of described 5 bytes represents that the data this time read are ordered into or out of order, and rear 4 bytes represent the data read side-play amount in original data stream。
7. based on the system of TCP transmission voice in a VoIP, it is characterised in that including:
Sip terminal, is used for receiving data or sending data to opposite end sip terminal;
Middleware unit, including coding module and decoder module, described coding module for carrying out the coding on self-identifying border to described data, and described decoder module is for the decoding carrying out self-identifying border from the described TCP data received;
TCP unit, for the described data after coding are transferred to described opposite end sip terminal, or receives the described data after the sip terminal coding of described opposite end。
8. according to claim 7 in VoIP based on the system of TCP transmission voice, it is characterised in that described coding module includes:
Input data submodule, for inquiring about the position that in described data, 0x00 byte occurs, with byte 0x00 for mark, is divided into several with the data block of 0x00 ending described data, then respectively each described data block is inputted data as one;If described data do not have 0x00 byte, then whole described data are inputted data as one;
Data encoding submodule, is used for using consistent overhead byte filling algorithm, described input data is encoded, and the result of the coding of all described input data is spliced, obtains final coding data;
Boundary marking submodule, for the head and the tail in described coding data respectively plus 0x00 byte, as data boundary mark, it is achieved identify the function on border;
Described decoder module includes:
Data query submodule, for finding the described coding data that head and the tail are all 0x00, and removes the 0x00 byte of head and the tail,
Data decoding sub-module, uses consistent overhead byte filling algorithm, to described coding decoding data, then judges the type of described coding data according to the type information of data header;If signaling data, then described signaling data is passed to signaling processing module and process, if speech data, then described speech data is passed to Voice media processing module and process。
9. according to claim 7 in VoIP based on the system of TCP transmission voice, it is characterised in that described TCP unit includes:
Judge module, is used for judging there is no data in the sequential queue of the protocol stack of described TCP and out of order queue;If described sequential queue has data, then the data in described sequential queue are copied to middleware relief area;If no data in described sequential queue, and described out of order queue has data, one section of continuous print data in described out of order queue, copy middleware relief area to;If equal no data in described sequential queue and out of order queue, wait that described opposite end sip terminal sends data;
Byte adds module, for the data in described sequential queue, first adding the header information of 5 bytes, then copy middleware relief area to;It is additionally operable to one section of continuous print data in described out of order queue, first add the header information of described 5 bytes, then reception data buffer, intermediate layer is copied to, the 1st byte in the header information of wherein said 5 bytes represents that the data this time read are ordered into or out of order, and rear 4 bytes represent the data read side-play amount in original data stream。
10. according to claim 7 in VoIP based on the system of TCP transmission voice, it is characterised in that described middleware unit adopts middleware_sendmsg interface as the interface sending data, for receiving signaling or the speech data that described sip terminal sends;Described middleware unit also adopts middleware_recvmsg interface as the interface receiving data, for obtaining signaling or the speech data that described sip terminal sends。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610141100.5A CN105704137A (en) | 2016-03-11 | 2016-03-11 | Method and system for transmitting voices based on TCP in VoIP |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610141100.5A CN105704137A (en) | 2016-03-11 | 2016-03-11 | Method and system for transmitting voices based on TCP in VoIP |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105704137A true CN105704137A (en) | 2016-06-22 |
Family
ID=56221477
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610141100.5A Pending CN105704137A (en) | 2016-03-11 | 2016-03-11 | Method and system for transmitting voices based on TCP in VoIP |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105704137A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108616558A (en) * | 2016-12-26 | 2018-10-02 | 展讯通信(上海)有限公司 | Establish the method, apparatus and user equipment of call |
CN111857805A (en) * | 2020-07-27 | 2020-10-30 | 广西美立方工程咨询有限公司 | Configuration-adjustable business process engine middleware system and use method thereof |
CN112202777A (en) * | 2020-09-29 | 2021-01-08 | 佛山科学技术学院 | Middleware of custom TCP (Transmission control protocol) parser and using method |
WO2021159478A1 (en) * | 2020-02-14 | 2021-08-19 | 华为技术有限公司 | Message order preservation method and apparatus |
CN113286380A (en) * | 2021-07-20 | 2021-08-20 | 四川优家库信息技术有限公司 | Communication establishing method, communication method and system based on middleware and Freeswitch |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1804460A1 (en) * | 2006-01-02 | 2007-07-04 | Samsung Electronics Co., Ltd. | Method and terminal for applying background skin in internet protocol network |
CN101005448A (en) * | 2006-12-18 | 2007-07-25 | 广州市高科通信技术股份有限公司 | VoIP gateway transmission medium stream method |
CN101035157A (en) * | 2006-03-10 | 2007-09-12 | 北京中创信测科技股份有限公司 | IP network based voice detection and control method and system |
CN102984402A (en) * | 2011-09-06 | 2013-03-20 | 中兴通讯股份有限公司 | Processing method of voice over internet phone (VoIP) data package and processing system of VoIP data package |
-
2016
- 2016-03-11 CN CN201610141100.5A patent/CN105704137A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1804460A1 (en) * | 2006-01-02 | 2007-07-04 | Samsung Electronics Co., Ltd. | Method and terminal for applying background skin in internet protocol network |
CN101035157A (en) * | 2006-03-10 | 2007-09-12 | 北京中创信测科技股份有限公司 | IP network based voice detection and control method and system |
CN101005448A (en) * | 2006-12-18 | 2007-07-25 | 广州市高科通信技术股份有限公司 | VoIP gateway transmission medium stream method |
CN102984402A (en) * | 2011-09-06 | 2013-03-20 | 中兴通讯股份有限公司 | Processing method of voice over internet phone (VoIP) data package and processing system of VoIP data package |
Non-Patent Citations (1)
Title |
---|
孟椿智: "TCP-RTM承载VoIP业务的原型***的设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108616558A (en) * | 2016-12-26 | 2018-10-02 | 展讯通信(上海)有限公司 | Establish the method, apparatus and user equipment of call |
CN108616558B (en) * | 2016-12-26 | 2021-03-19 | 展讯通信(上海)有限公司 | Method and device for establishing call and user equipment |
WO2021159478A1 (en) * | 2020-02-14 | 2021-08-19 | 华为技术有限公司 | Message order preservation method and apparatus |
CN111857805A (en) * | 2020-07-27 | 2020-10-30 | 广西美立方工程咨询有限公司 | Configuration-adjustable business process engine middleware system and use method thereof |
CN111857805B (en) * | 2020-07-27 | 2024-05-31 | 广西美立方工程咨询有限公司 | Configuration-adjustable business process engine middleware system and using method thereof |
CN112202777A (en) * | 2020-09-29 | 2021-01-08 | 佛山科学技术学院 | Middleware of custom TCP (Transmission control protocol) parser and using method |
CN113286380A (en) * | 2021-07-20 | 2021-08-20 | 四川优家库信息技术有限公司 | Communication establishing method, communication method and system based on middleware and Freeswitch |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP1693998B1 (en) | Method and system for a proxy-based network translation | |
US7694127B2 (en) | Communication systems for traversing firewalls and network address translation (NAT) installations | |
US8769659B2 (en) | Null-packet transmission from inside a firewall to open a communication window for an outside transmitter | |
US7890749B2 (en) | System and method for providing security in a telecommunication network | |
US8457117B1 (en) | Static, dynamic and intelligent VRF routing for services traffic | |
US8599747B1 (en) | Lawful interception of real time packet data | |
CN105704137A (en) | Method and system for transmitting voices based on TCP in VoIP | |
US20030091026A1 (en) | System and method for improving communication between a switched network and a packet network | |
CN100566300C (en) | A kind of netted trunking method and IP communication system of controlling the media delivery path | |
CA2603341A1 (en) | Voip proxy server | |
KR101705440B1 (en) | Hybrid cloud media architecture for media communications | |
US20100031339A1 (en) | Streaming Media Service For Mobile Telephones | |
US20070058537A1 (en) | Handling of early media ii | |
US7948971B2 (en) | Method and device for controlling media resources, method and system for establishing calls | |
WO2008095430A1 (en) | A method and a system for preventing a media agency from hacker attacking | |
JP6048129B2 (en) | Communication system, apparatus, method, and program | |
US20060168266A1 (en) | Apparatus and method for providing signaling mediation for voice over internet protocol telephony | |
CN110636029B (en) | Communication method and communication device | |
US8582559B2 (en) | System and method for handling media streams | |
JP2014093642A (en) | High-speed distribution method to session border controller, and connection system | |
CN106921624B (en) | Session boundary controller and data transmission method | |
JP4649242B2 (en) | Terminal adapter device | |
JP4080937B2 (en) | Packet relay method and system between networks | |
JP3698701B2 (en) | Establishing calls on intranets and external networks via DMZ | |
JP4070655B2 (en) | Media communication method and media communication system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160622 |
|
RJ01 | Rejection of invention patent application after publication |