Disclosure of Invention
The embodiment of the disclosure provides a communication method, a communication device and a computer storage medium, which can reduce the requirement of VoIP communication on the bandwidth of a wireless communication network. The technical scheme is as follows:
in one aspect, an embodiment of the present disclosure provides a communication method, where the method includes:
establishing a session between the calling terminal and the called terminal based on the compressed first SIP message;
converting first voice data of a first coding mode from a first terminal into first voice data of a second coding mode, and sending the first voice data of the second coding mode to a second terminal by adopting the conversation;
converting second voice data of a second coding mode received from a second terminal through the session into second voice data of a first coding mode, and sending the second voice data of the first coding mode to the first terminal;
disconnecting the session based on the compressed second SIP message;
the first terminal is one of a calling terminal and a called terminal, and the second terminal is the other of the calling terminal and the called terminal.
Optionally, the compressed first SIP message corresponds to a first SIP message, the compressed second SIP message corresponds to a second SIP message, the first SIP message and the second SIP message both include a first session identifier, the compressed first SIP message and the compressed second SIP message both include a second session identifier uniquely associated with the first session identifier, the second session identifier is a memory address applied by the first wireless gateway, and the first wireless gateway is connected to the calling terminal through a portal.
Illustratively, the first SIP message comprises an SIP INVITE call request, a SIP180 response, a SIP200OK response, and a SIP ACK acknowledgment, and the compressed first SIP message comprises a SLIP call request message, a SLIP ringing response message, a SLIP off-hook response message, and a SLIP off-hook response acknowledgment message.
Optionally, the session is established between the calling terminal and the called terminal based on the compressed SIP message, including:
the first wireless gateway receives SIP INVITE call request sent by the calling terminal;
the first wireless gateway converts the SIP INVITE call request into a SLIP call request message;
the first wireless gateway sends the SLIP call request message to a second wireless gateway;
the first wireless gateway receives a SLIP ringing response message sent by the second wireless gateway, wherein the SLIP ringing response message is generated based on the second wireless gateway receiving a SIP180 response sent by a called terminal;
the first wireless gateway sends SIP180 response to the calling terminal;
the first wireless gateway receives a SLIP off-hook response message sent by the second wireless gateway, wherein the SLIP off-hook response message is generated based on the second wireless gateway receiving a SIP200OK response sent by a called terminal;
the first wireless gateway sends SIP200OK response to the calling terminal;
the first wireless gateway sends a SLIP off-hook response confirmation message to the second wireless gateway;
the first wireless gateway receives SIP ACK confirmation sent by the calling terminal;
and the second wireless gateway is connected with the called terminal through a network port.
Optionally, the session is established between the calling terminal and the called terminal based on the compressed SIP message, including:
the second wireless gateway receives the SLIP call request message;
the second wireless gateway sends SIP INVITE request corresponding to the SLIP call request message to the called terminal;
the second wireless gateway receives a SIP180 response sent by the called terminal;
the second wireless gateway sends the SLIP ringing response message corresponding to the SIP180 response to the first wireless gateway, wherein the SLIP ringing response message is used for triggering the first wireless gateway to send the SIP180 response to the calling terminal;
the second wireless gateway receives a SIP200OK response sent by the called terminal;
the second wireless gateway sends a SLIP off-hook response message corresponding to the SIP200OK response to the first wireless gateway, wherein the SLIP off-hook response message is used for triggering the first wireless gateway to send the SIP200OK response to the calling terminal;
the second wireless gateway sends SIP ACK confirmation to the called terminal;
the second wireless gateway receives a SLIP off-hook response confirmation message sent by the first wireless gateway;
and the second wireless gateway is connected with the called terminal through a network port.
Illustratively, the second SIP message comprises a SIP BYE on-hook request, and the compressed second SIP message comprises a SLIP on-hook request message.
Optionally, the disconnecting the session based on the compressed second SIP message includes:
the local wireless gateway receives an SIP BYE on-hook request sent by a first terminal;
the local wireless gateway sends a SLIP hang-up request message corresponding to the SIP BYE hang-up request to an opposite-end wireless gateway, wherein the SLIP hang-up request message is used for triggering the opposite-end wireless gateway to send the BYE hang-up request to the second terminal;
the local wireless gateway sends a SIP200OK response to the first terminal;
the local wireless gateway is a wireless gateway connected with the first terminal through a network port, and the opposite-end wireless gateway is a wireless gateway connected with the second terminal through a network port.
Optionally, the disconnecting the session based on the compressed second SIP message includes:
the local wireless gateway receives a SLIP hang-up request message sent by an opposite-end wireless gateway;
the local wireless gateway sends an SIP BYE on-hook request corresponding to the SLIP on-hook request message to the second terminal;
the local wireless gateway receives a SIP200OK response sent by the second terminal;
the local wireless gateway is a wireless gateway connected with a second terminal, and the opposite-end wireless gateway is a wireless gateway connected with the first terminal.
Optionally, the converting the first voice data of the first coding scheme from the first terminal into the first voice data of the second coding scheme includes:
acquiring first voice data of a first coding mode in an RTP packet sent by a first terminal;
decoding the first voice data of the first coding mode to obtain a first Pulse Code Modulation (PCM) signal;
compressing the first PCM signal into a first voice fragment with a length of Y bytes by adopting a second coding mode;
packaging the K first voice fragments into a first SLIP voice stream to obtain first voice data of a second coding mode;
the second voice data of the second coding mode is a second SLIP voice stream, the second SLIP voice stream is obtained by packaging K second voice fragments corresponding to a second PCM signal, and the second PCM signal is obtained by decoding the second voice data of the second coding mode sent by the second terminal;
the converting the second voice data of the second coding mode received from the second terminal through the session into the second voice data of the first coding mode includes:
extracting a second voice slice of Y byte length from the second SLIP voice stream;
decoding the second voice chip to obtain a second PCM signal;
coding the second PCM signal by adopting the first coding mode to obtain second voice data of the first coding mode;
wherein Y corresponds to the second encoding mode and is a positive integer, and K is a positive integer.
In another aspect, an embodiment of the present disclosure provides a communication apparatus, including: the session establishing module is used for establishing a session between the calling terminal and the called terminal based on the compressed first session initiation protocol SIP message;
the data processing module is used for converting first voice data of a first coding mode from a first terminal into first voice data of a second coding mode and sending the first voice data of the second coding mode to a second terminal by adopting the conversation; converting second voice data of a second coding mode received from a second terminal through the session into second voice data of a first coding mode, and sending the second voice data of the first coding mode to the first terminal;
a session disconnection module for disconnecting the session based on the compressed second SIP message;
the first terminal is one of a calling terminal and a called terminal, the second terminal is the other of the calling terminal and the called terminal, the code rate of the first voice data of the first coding mode is greater than that of the first voice data of the second coding mode, and the code rate of the second voice data of the first coding mode is greater than that of the second voice data of the second coding mode.
In another aspect, an embodiment of the present disclosure provides a communication apparatus, including: the communication method comprises a memory and a processor, wherein the memory and the processor are mutually connected in a communication mode, the memory stores computer instructions, and the processor executes the computer instructions so as to execute the communication method in the embodiment.
In another aspect, the present disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to execute the communication method in the above embodiments.
The technical scheme provided by the embodiment of the disclosure at least comprises the following beneficial effects: and establishing a session for the calling terminal and the called terminal based on the compressed first SIP message, and disconnecting the session based on the compressed second SIP message, thereby reducing the network overhead in the aspect of signaling control. Moreover, the code rates of the first voice data and the second voice data of the second coding mode transmitted through the session are lower than those of the first voice data and the second voice data of the first coding mode, namely, the voice data are subjected to low code rate processing and then transmitted through the session, so that the network overhead is reduced on the media transmission level. By reducing network overhead on two levels of signaling control and media transmission, transmission delay is reduced, and the requirement on network bandwidth is reduced, thereby being beneficial to realizing end-to-end VoIP communication of a narrow-band network and expanding the communication capacity of broadband VoIP.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
In order to facilitate understanding of the embodiments of the present disclosure, terms related to the embodiments of the present disclosure will be described below.
SIP: is an application-layer signaling control protocol for creating, modifying and releasing sessions for one or more participants, compliant with IETF standard RFC 3261. SIP messages typically include information such as SIP message type, calling terminal identification, called terminal identification, and session identification. The message types are denoted by the method names INVITE, 180, 200OK, ACK, BYE in SIP, respectively, that is, the SIP message includes INVITE request, 180, 200OK, ACK, BYE, and the like. A session is identified as a random string that is five bytes to tens of bytes in length.
SLIP (Serial Line Internet Protocol): the system supports a point-to-point link layer communication protocol on a serial communication line, and realizes the functions of framing user data streams and verifying frame data. SLIP is a simple character-oriented protocol. A special flag byte END (C0H) is added at the beginning and END of each user information frame and encapsulated into a SLIP frame. If a certain byte in the user information frame is the same as (C0H), the certain byte is replaced with (DBH, DCH). The special character (DBH) is referred to herein as a SLIP escape character. If a byte in the user information frame is the same as (DBH), the byte is replaced with (DBH, DDH).
RTP: the media transmission protocol is used for providing end-to-end real-time transmission service for a plurality of multimedia data needing real-time transmission, such as voice, images, faxes and the like, on an IP network, and conforms to IETF standard RFC 3550.
Fig. 1 shows an application scenario of an embodiment of the present disclosure. As shown in fig. 1, the communication system includes a plurality ofterminals 11, twowireless gateways 12, and tworadio stations 13. Eachwireless gateway 12 is connected to at least oneterminal 11 and eachwireless gateway 12 is connected to aradio station 13. Illustratively, the terminal 11 and thewireless gateway 12 may be connected via a network, such as an ethernet connection, and thewireless gateway 12 and theradio station 13 may be connected via a serial port.
Among other things, the terminal provides a VoIP voice call function for the user, also referred to as a voice terminal. The wireless gateway completes signaling, media format conversion and radio station flow control between the terminal and the radio station through SIP compression and low-bit-rate processing of the voice data. The radio station provides full duplex wireless communication.
In the embodiment of the present application, the wireless gateway and the radio station connected thereto may be integrated together, and the resulting integrated device may be referred to as a wireless access device.
In the embodiment of the present disclosure, the wireless gateway to which the calling terminal and the called terminal are connected is different. For example, the calling terminal 01100 is connected to a first wireless gateway and the called terminal 02100 is connected to a second wireless gateway.
Fig. 2 is a flowchart illustrating a communication method according to an embodiment of the disclosure, which may be performed by a wireless gateway, for example, the first wireless gateway or the second wireless gateway in fig. 1 may be connected to the communication method. As shown in fig. 2, the method comprises the steps of:
s201: a session is established between the calling terminal and the called terminal based on the compressed first SIP message.
S202: and converting the first voice data of the first coding mode from the first terminal into the first voice data of the second coding mode, and sending the first voice data of the second coding mode to the second terminal by adopting the conversation.
S203: and converting second voice data of a second coding mode received from the second terminal through the session into second voice data of a first coding mode, and sending the second voice data of the first coding mode to the first terminal.
S204: disconnecting the session based on the compressed second SIP message.
The first terminal is one of a calling terminal and a called terminal, the second terminal is the other of the calling terminal and the called terminal, the code rate of the first voice data of the first coding mode is greater than that of the first voice data of the second coding mode, and the code rate of the second voice data of the first coding mode is greater than that of the second voice data of the second coding mode.
And establishing a session for the calling terminal and the called terminal based on the compressed first SIP message, and disconnecting the session based on the compressed second SIP message, thereby reducing the network overhead in the aspect of signaling control. Moreover, the code rates of the first voice data and the second voice data of the second coding mode transmitted through the session are lower than those of the first voice data and the second voice data of the first coding mode, namely, the voice data are subjected to low code rate processing and then transmitted through the session, so that the network overhead is reduced on the media transmission level. By reducing network overhead on two levels of signaling control and media transmission, transmission delay is reduced, and the requirement on network bandwidth is reduced, thereby being beneficial to realizing end-to-end VoIP communication of a narrow-band network and expanding the communication capacity of broadband VoIP.
In an embodiment of the present disclosure, the compressed first SIP message corresponds to a first SIP message, and the compressed second SIP message corresponds to a second SIP message.
Wherein the compressed first SIP message is used for establishing a session, illustratively, the compressed first SIP message comprises a SLIP call request message, a SLIP ringing response message, a SLIP off-hook response message, and a SLIP off-hook response acknowledgement message, and accordingly, the first SIP message comprises an SIP INVITE call request, a SIP180 response, a SIP200OK response, and a SIP ACK acknowledgement.
The compressed second SIP message is used for disconnecting the session, the compressed second SIP message includes a SLIP on-hook request message, and accordingly, the second SIP message includes a SIP BYE on-hook request.
Optionally, the compressed first SIP message includes an information length indication field, an information content field, and a check field, where the information length field is used to indicate a data amount of the information content carried by the information content field, and the check field is used to carry a check sum, and the check sum is determined according to the contents of the information length field and the information content field, for example, the check sum is equal to modulo-2 addition of bytes corresponding to the information length field and the information content field before SLIP escape.
In this embodiment of the present disclosure, the field type included in the compressed second SIP message is the same as the field type included in the compressed first SIP message, and details are not described here again.
The information content field comprises at least an information element identification and a second session identification for each type of compressed SIP message. The information element identifier is used for indicating the type of the SLIP message and corresponds to the content of the SIP message. Illustratively, the first wireless gateway and the second wireless gateway may agree to represent the type of each SIP message with a length of 1 byte, without repetition. The length of the information element identity is reduced compared to the length of the message type in the SIP message.
The second session identifier is a unique identifier of a call session (also called a SLIP session), and the first wireless gateway uses the dynamically applied memory address as the second session identifier and uses the first session identifier in the corresponding first SIP message to implement mapping between the SIP session and the SLIP session. Illustratively, the first wireless gateway runs on a 32-bit Linux system, and the memory address length is fixed to 4 bytes. In the SIP message, the message types are represented by method names INVITE, 180, 200OK, ACK, BYE, and more bytes are required. Also, the first session identifier is a random string of five bytes to several tens of bytes in length, resulting in a large SIP message length.
By compressing the two key information of the message type and the session identifier, the corresponding compressed SIP message is obtained, and the length of the control signaling can be greatly reduced.
Fig. 3 is a schematic diagram of an interaction process of a communication method provided by another embodiment of the present disclosure, where the communication method may be executed by a terminal and a wireless gateway together, and as shown in fig. 3, the method includes the following processes:
3101: the calling terminal sends SIP INVITE a call request.
When a user initiates a call in the calling terminal to the called voice terminal, the calling terminal sends SIP INVITE a call request. Accordingly, the first wireless gateway receives the INVITE call request.
The SIP INVITE call request includes a SIP message type, a calling terminal identification, a called terminal identification, a first session identification, and first indication information indicating a first encoding manner. SIP message type, INVITE. The calling terminal identification and the called terminal identification may be terminal numbers, for example, the calling terminal identification is 01100, and the called terminal identification is 02100. The first session identifier is a random string of five to several tens of bytes in length for uniquely identifying the SIP session between the calling terminal and the called terminal. The first coding mode is a coding mode of voice data transmitted by the calling terminal, and includes but is not limited to g.711a, g.711u, g.729, and the like.
3102: and the first wireless gateway sends a SLIP call request message corresponding to the INVITE call request.
The SLIP call request message includes an information length field, an information content field, and a check field. The information content comprises an information unit identifier, a second session identifier, a source platform address, a source platform channel number, a calling terminal identifier, a called terminal identifier and first indication information used for indicating a first coding mode.
The information element identification is used to indicate the type of SLIP message, corresponding to the SIP INVITE request.
The second session identifier is the unique identifier of the SLIP session, and the first wireless gateway uses the dynamically applied memory address as the second session identifier and associates the second session identifier with the first session identifier in the SIP INVITE request, thereby realizing the mapping between the SIP session and the SLIP session.
The source platform address is the address of the radio station connected with the first wireless gateway, the source platform channel number is the channel number of the radio station connected with the first wireless gateway, the source platform address and the source platform channel number are used for helping the second wireless gateway to determine the signal source, and the second wireless gateway can reply SLIP ringing response messages to the signal source subsequently. The calling terminal identification and the called terminal identification respectively represent calling and called identities, and calling and called terminal numbers in the request of SIP INVITE are mapped through a number list. The length of the calling terminal identification and the called terminal identification is shorter than the length of the calling terminal number and the called terminal number. For example, the first wireless gateway maps the number 01100 to identify 0x01 and the number 02100 mapping table to identify 0x 02. It can be seen that, in addition to compressing the length of the field for indicating the message type and the session identifier, the calling and called terminal numbers in the SIP message are also compressed, which further reduces the length of the SLIP call request message.
The first indication information is used for transmitting the first coding mode to the called terminal for session negotiation. For example, the first wireless gateway and the second wireless gateway may agree to use 1-byte values, such as 0x01, 0x02, 0x03, 0x04, etc. to represent g.711a, g.711u, g.722, G729, etc. encoding modes.
Illustratively, the first wireless gateway packages SIP INVITE the request in the format of table 1 below, resulting in a SLIP call request message.
Table 1 SLIP call request message
As can be seen from table 1, redundant information such as Request-line, Cseq, Max-Forwards, Via, low, Contact, Content-Type, and Content-Length header fields in the SIP message are also removed from the SLIP call Request message, so that the Length of the SLIP call Request message is greatly reduced compared with the SIP message. It should be noted that some redundant information in the corresponding SIP message is also removed by other SLIP messages.
Illustratively, the first wireless gateway sends the SLIP call request message to the first wireless station through the serial port, and sends the SLIP call request message to the second wireless gateway through the first wireless station. Accordingly, the second wireless gateway receives the SLIP call request message.
Optionally, the method further comprises: after 3102, the first radio gateway sends aSIP 100 response to the calling terminal; accordingly, the calling terminal receives theSIP 100 response. The first wireless gateway informs SIP INVITE of the receipt of the call request by the calling terminal and prepares to process the INVITE request through theSIP 100 response.
3103: the second wireless gateway sends SIP INVITE call request corresponding to the SLIP call request message.
Wherein, the second wireless gateway sends SIP INVITE call request to the called terminal indicated by SIP INVITE call request, and accordingly, the called terminal receives the SIP INVITE call request.
Optionally, the method further comprises: after the called terminal receives SIP INVITE the call request, the called terminal sends aSIP 100 response to the second wireless gateway; accordingly, the second wireless gateway receives theSIP 100 response.
3104: the called terminal replies to the SIP180 response after ringing.
Accordingly, the second wireless gateway receives the SIP180 response.
3105: the second wireless gateway sends the SIP180 response to the corresponding SLIP ringing response message.
The SLIP ringing response message includes an information length field, an information content field, and a check field. The information content comprises an information unit identifier and a second session identifier. The information element identifier is used to indicate the type of the SLIP message, corresponding to the SIP180 response. The second session identification is identical to the second session identification in 102.
Illustratively, the second wireless gateway may encapsulate the SLIP ringing response message in the format of table 2 below.
The second wireless gateway sends SLIP ringing response message to the connected wireless radio station through the serial port, and the wireless radio station sends the SLIP ringing response message through the wireless channel. Accordingly, the first wireless gateway receives the SLIP ring response message.
TABLE 2SLIP ringing response message
3106: the first wireless gateway sends a SIP180 response to the calling terminal.
Accordingly, the calling terminal receives the SIP180 response. After receiving the SIP180 response, the calling terminal plays the ring back tone to prompt the calling user that the called party rings.
3107: and after the called terminal is off-hook, the called terminal sends a SIP200OK response to the second wireless gateway.
Accordingly, the second wireless gateway receives the SIP200OK response.
3108: and after receiving the 200OK response, the second wireless gateway sends SIP ACK confirmation to the called terminal.
3109: and the second wireless gateway sends a SLIP off-hook response message corresponding to the SIP200OK response.
Accordingly, the first wireless gateway receives the SLIP off-hook response message.
The SLIP off-hook response message includes an information length field, an information content field, and a check field. The information content comprises an information unit identifier, a second session identifier and a first coding mode. The information element identifier is used to indicate the type of the SLIP message, corresponding to the SIP200OK response. The second session identification is identical to the second session identification in 102. The first coding mode is a voice coding mode supported after session negotiation of the called terminal.
Illustratively, the second wireless gateway encapsulates the SLIP off-hook response message in the format of table 3 below.
TABLE 3 SLIP off-hook response message
After the called terminal sends the 200OK response, if the SIP ACK confirmation is not received within the set time length (shorter), the called terminal retransmits the 200OK response, and the 200OK response is continuously retransmitted for 10 times, and the session is disconnected if the SIP ACK confirmation is not received. In order to reduce the number of unnecessary messages and reduce the possibility of session disconnection, in this embodiment, after receiving the 200OK response, the second wireless gateway first sends a SIP ACK acknowledgement to the called terminal, and then sends a SLIP off-hook response message corresponding to the 200OK response to the first wireless gateway.
Alternatively, in other embodiments, after receiving the 200OK response, the second wireless gateway may also send a SLIP off-hook response message corresponding to the 200OK response to the first wireless gateway, and then send a SIP ACK acknowledgement to the called terminal.
3110: the first wireless gateway sends a SLIP off-hook response acknowledgement message to the second wireless gateway.
The SLIP off-hook response acknowledgement message includes an information length field, an information content field, and a check field. Wherein the information content comprises an information unit identity and a second session identity. The information element identifier is used to indicate the type of the SLIP message, corresponding to the SIP ACK acknowledgement. The second session identification is identical to the second session identification in 3102.
Illustratively, the first wireless gateway encapsulates the SLIP off-hook response acknowledgement message in the format of table 4 below.
TABLE 4 SLIP offhook response acknowledgment message
3111: the first wireless gateway sends a SIP200OK response to the calling terminal.
Accordingly, the originating terminal receives the SIP200OK response.
3112: the calling terminal replies with a SIP ACK acknowledgement.
Accordingly, the first wireless gateway receives a SIP ACK acknowledgement.
Through 3101-3112, session establishment between the calling terminal and the called terminal based on the compressed SIP message can be realized.
After the session is established, transmission of voice data for the calling and called terminals is started. The transmission process is as follows:
3201: after the session is established, the first terminal encapsulates the first voice data in the first coding mode into an RTP packet and sends the RTP packet to the local wireless gateway.
Accordingly, the local wireless gateway receives the RTP packets.
In 3201, the first terminal periodically transmits RTP packets to the local wireless gateway for a first period T1ms corresponding to the first encoding scheme.
The first period T1 is determined according to the code rate corresponding to the first encoding method. For example, assuming that the code rate corresponding to the first encoding method is Xkbps, the media load of each RTP packet is M bytes, and the RTP packet transmission period is T1ms, the formula (2) can be obtained according to the formula (1)
(1000/T1)*M*8=X*1000 (1)
T1=M*8/X (2)
Wherein M is agreed by the first wireless gateway and the second wireless gateway and is related to the first coding mode. For example, assuming that the first coding scheme is g.711a or g.711u, and the corresponding code rate is 64kbps, the media payload of each RTP packet is 160 bytes, and the equation (2) is substituted, where T1 is 64 × 8/160ms is 20 ms.
Accordingly, the local wireless gateway periodically receives RTP packets.
3202: the local wireless gateway converts the first voice data of the first coding mode in the RTP packet into the first voice data of the second coding mode, and sends the first voice data of the second coding mode through the conversation between the calling terminal and the called terminal.
Correspondingly, the opposite-end wireless gateway receives the first voice data of the second coding mode.
The code rate of the first voice data of the first coding mode is larger than that of the first voice data of the second coding mode.
Illustratively, the second encoding scheme is Codec2 or the like. Codec2 is an open source audio Codec, published under the GNU LGPL framework, supporting code rates between 0.7kbps and 3.2kbps, and is mainly applied to low bandwidth HF/VHF stations. The second coding mode adopts Codec2 and the code rate is 2.4kbps, which can ensure the session quality. It should be noted that, in the embodiment of the present disclosure, another coding method with a code rate equivalent to the code rate of Codec2 may be adopted as the second coding method.
The 3202 includes:
step one, a local wireless gateway takes out a media load from an RTP packet to obtain first voice data in a first coding mode, wherein the length of the media load obtained in each RTP packet is M bytes; as described above, M is 160 for the coding schemes such as g.711a and g.711u.
And a second step of decoding the first voice data of the first encoding scheme into a first PCM signal, wherein the first PCM signal is a PCM signal having an audio sample size of 16 bits, N bytes in total. Here, N is determined by the compression rate corresponding to the first encoding method. For example, g.711a and g.711u have a compression rate of 1:2 for PCM speech, so N is 2 × M. For another example, the compression rate of g.729 to PCM speech is 1:16, so N is 16 × M.
And thirdly, compressing the first PCM signal into first voice fragments by a second coding mode, wherein the length of each first voice fragment is Y bytes.
Wherein, the length of Y is related to the second coding mode, and Y is a positive integer. For example, for Codec2, Y equals 6. The following description will take the Codec2 with a code rate of 2.4kbps as the second coding scheme as an example.
In the embodiment of the present disclosure, the first voice data in the second coding mode is encapsulated into a SLIP voice stream and then transmitted. Illustratively, the SLIP voice stream may be packaged according to the format of table 5 below.
In order to reduce network overhead, the voice fragment can be written into the buffer, and when the length of the voice fragment in the buffer reaches 6 xK bytes, the voice fragment with 6 xK bytes is taken out from the buffer and then sent. Here, the local wireless gateway may fetch no more than L-byte messages from the serial cache at the second period T2. Here, K is determined according to the wireless channel bandwidth, and illustratively, K is equal to 15.
To avoid congestion of the wireless channel, K, N, L should be chosen to satisfy the following conditions: the bandwidth A occupied by the produced data is less than or equal to the actual bandwidth C of the wireless channel, and the bandwidth B occupied by the transmitted data is less than or equal to the actual bandwidth C of the wireless channel.
Here, the bandwidth occupied by the produced data refers to the bandwidth occupied by the voice produced within 1 second of the terminal after being compressed by the second encoding method and encapsulated into SLIP, and if the RTP packet interval is T1ms, a is (1000/T1) × 6/(6 × K) × (8+6 × K): 8/1000kbps is (64+ 48K)/(T1K) kbps; wherein 6 is the length of the media load after RTP media load is converted into PCM and then is compressed by Codec 2;
the bandwidth occupied by the transmitted data is 8L/T2 kbps;
then, the relationship K, N, L is (64+ 48K)/(T1K). ltoreq.8L/T2. ltoreq.C.
TABLE 5 SLIP Voice streams
In the disclosed embodiment, one conversation may correspond to one or more voice streams, and the number of voice streams is determined by the conversation time length.
3203: and the opposite-end wireless gateway converts the first voice data of the second coding mode into the first voice data of the first coding mode and sends the first voice data of the first coding mode to the second terminal.
Accordingly, the second terminal receives the first voice data of the first coding mode and can hear the voice of the first terminal.
Illustratively, the method for converting the first voice data of the second coding mode into the first voice data of the first coding mode by the peer wireless gateway includes:
firstly, an opposite terminal wireless gateway receives SLIP voice flow and takes out first voice data of a second coding mode from the SLIP voice flow to write into a cache;
second, a voice fragment of a set length is buffered according to a first period T1.
And thirdly, decoding the voice fragments into the PCM signal, wherein one voice fragment can obtain the PCM signal with the size of 16 bits of N bytes of audio samples.
And fourthly, coding the first PCM signal by adopting a first coding mode to obtain first voice data of the first coding mode.
And the opposite-end wireless gateway takes the first voice data of the first coding mode with the length of M bytes as a media load, encapsulates the first voice data into an RTP packet and then sends the RTP packet to the second terminal.
It should be noted that, in the process of 3201 to 3203, when the first terminal is a calling terminal, the local wireless gateway is a first wireless gateway, the opposite-end wireless gateway is a second wireless gateway, and the second terminal is a called terminal; when the first terminal is a called terminal, the local wireless gateway is a second wireless gateway, the opposite-end wireless gateway is a first wireless gateway, and the second terminal is a calling terminal.
In the session, either one of the calling terminal and the called terminal may end the session. The process of ending the session is as follows:
3301: the local terminal is hung up and sends out an SIP BYE hanging-up request;
accordingly, the local wireless gateway receives the SIP BYE on-hook request, stops voice processing and releases session resources. Optionally, the SIP200OK response is replied to the local terminal immediately after the local wireless gateway to SIP BYE on-hook request.
3302: and the local wireless gateway sends a SLIP hang-up request message corresponding to the SIP BYE hang-up request.
Correspondingly, the opposite-end wireless gateway receives the SLIP hang-up request message, stops voice processing and releases session resources.
The SLIP hang request message includes an information length field, an information content field, and a check field. The information content comprises an information unit identifier and a second session identifier. The information unit identifier is used for indicating the type of the SLIP message and corresponds to the SIP BYE on-hook request. The second session identification is identical to the second session identification in 3102.
Illustratively, the local wireless gateway will encapsulate the SLIP hang request message in the format of table 6 below.
TABLE 6 SLIP onhook request message
3303: and the opposite-end wireless gateway sends a BYE on-hook request to the opposite-end terminal.
Correspondingly, the opposite terminal receives the BYE hang-up request and disconnects the session.
Optionally, the method further comprises: and after the opposite terminal receives the BYE on-hook request, the opposite terminal sends SIP200OK response to the opposite wireless gateway.
It should be noted that, in 3301-3304, when the local terminal is a calling terminal, the local wireless gateway is a first wireless gateway, the peer wireless gateway is a second wireless gateway, and the peer terminal is a called terminal; when the local terminal is a called terminal, the local wireless gateway is a second wireless gateway, the opposite-end wireless gateway is a first wireless gateway, and the opposite-end terminal is a calling terminal.
According to the RFC3261 specification, the length of each SIP message is at least as follows: INVITE is 400 bytes, 180 response is 200 bytes, 200OK response is 400 bytes, ACK is 200 bytes, BYE is 200 bytes. In the embodiment of the present disclosure, the lengths of the SLIP call request message, the SLIP off-hook response message, the SLIP call acknowledgement message, and the SLIP on-hook request message are 13 bytes, 7 bytes, 8 bytes, 7 bytes, and 7 bytes, respectively, and it can be seen that the compression rate of the SIP message is 42/1400 ═ 3%, which is much lower than 10%, so that the network overhead is greatly reduced on the level of the control signaling.
The following exemplifies a communication method according to an embodiment of the present disclosure, which includes the following processes:
(1) establishing a session by SIP compression, comprising the following substeps:
(1.1) a user initiates a Call to a destination platform called voice terminal 02100 on a calling voice terminal 01100, and sends a SIP INVITE Call request carrying information such as a calling number 01100, a called number 02100, a Call-ID, a G.711A voice coding mode and the like;
(1.2) the source platform wireless gateway receives the INVITE Call request, maps or compresses a calling number, a called number, a Call-ID and a voice coding mode according to the requirement of the message format in the table 1, encapsulates the mapping or the compression into a SLIP Call request message, and sends the SLIP Call request message to a wireless radio station through a serial port;
(1.3) the destination platform wireless gateway receives the SLIP Call request message, records the source platform address and the channel number related to the session ID so as to reply the message subsequently, then inversely maps the encoding modes of the calling user ID, the called user ID, the session ID and the voice into the encoding modes of the calling number 01100, the called number 02100, the Call-ID and the G.711A voice, and then sends an INVITE Call request to a called voice terminal 02100;
(1.4) the called voice terminal 02100 receives the INVITE call request, and replies to the SIP180 response after ringing;
(1.5) the destination platform wireless gateway receives the 180 response, encapsulates the SLIP ringing response message according to the requirement of the format of the table 2, and sends the SLIP ringing response message to the source platform through a wireless channel;
(1.6) the source platform wireless gateway receives the SLIP ringing response message, sends SIP180 response to calling voice terminal 01100, and calling voice terminal 01100 plays the ring back tone;
(1.7) after the user goes off-hook at the called voice terminal 02100, sending a SIP200OK response to the wireless gateway;
(1.8) the wireless gateway of the destination platform receives the 200OK response, immediately sends SIP ACK confirmation to the called voice terminal 02100, then packages SLIP off-hook response message according to the requirement of the format of table 3, carries the voice coding mode representing G.711A, and sends the message to the source platform through a wireless channel;
(1.9) the source platform wireless gateway receives the SLIP off-hook response message, immediately replies a SLIP off-hook response confirmation message in a format of table 4, and then sends an SIP200OK response to the calling voice terminal 01100, wherein the response carries a G.711A voice coding mode;
(1.10) after the calling voice terminal 01100 replies SIP ACK confirmation, the calling voice terminal and the called voice terminal establish conversation through a wireless channel;
(2) performing a voice conversation by voice low rate processing optimization, comprising the steps of:
(2.1) after the session is established, a user speaks on one voice terminal (such as 01100), and the terminal periodically sends RTP packets coded by G.711A to a local wireless gateway every 20 ms;
(2.2) the local wireless gateway receives the RTP packet, takes out the media load with the length of 160 bytes from the RTP packet, decodes the G.711A into a PCM signal with the length of 320 bytes, then encodes and compresses the PCM signal into voice fragments with the length of 6 bytes through Codec2 with the code rate of 2.4kbps and writes the voice fragments into a cache, when the voice fragments in the cache reach 90 bytes, the voice fragments are encapsulated into SLIP voice stream according to the format requirement of a table 5 and written into a serial port cache, and in order to avoid wireless network congestion, the wireless gateway takes out the message with the length of no more than 100 bytes from the serial port cache at regular intervals with the period of 300ms and;
(2.3) the opposite wireless gateway receives the message from the wireless channel, takes out 90 bytes Codec2 coded voice from SLIP voice stream and writes into the buffer, then periodically buffers 6 bytes voice fragment every 20ms, decodes Codec2 into 320 bytes PCM signal, then G.711A codes into 160 bytes long media load, encapsulates into RTP packet and sends to the local voice terminal (such as 02100) through the wired network;
(2.4) the local voice terminal (e.g. 02100) receives the RTP stream and can hear the voice of the opposite voice terminal (e.g. 01100);
(3) disconnecting the session through SIP compression, comprising the steps of:
(3.1) after the conversation is finished, the user hangs up one voice terminal (such as 01100) and sends out an SIP BYE on-hook request;
(3.2) the local wireless gateway receives the BYE on-hook request, immediately replies a SIP200OK response, stops voice processing and releases session resources, and then requests to package a SLIP on-hook request message in a table 6 format and sends the message to a wireless channel;
(3.3) the opposite terminal wireless gateway receives SLIP hang-up request message from the wireless channel, stops voice processing and releases session resources, and then sends BYE hang-up request to the other party voice terminal (such as 02100);
(3.4) the voice terminal (e.g., 02100) receives the BYE hang request and disconnects the session.
Firstly, when a user initiates a conversation, standard SIP call signaling on a wired network is sent to a wireless network for transmission after SIP compression and SLIP encapsulation, and then is restored to the standard SIP call signaling on a target platform, so that a voice terminal can quickly complete end-to-end conversation connection through a narrow-band network; then in the conversation process, RTP packets on the wired network are decoded into PCM signals, Codec2 codes and SLIP packages through payload in sequence, then the PCM signals, the Codec2 codes and the SLIP packages are regularly sent to a wireless network for transmission on the principle of avoiding network congestion, and the RTP packets are restored through the inverse process of SLIP analysis, Codec2 decoding and PCM signal coding on a target platform, so that a voice terminal realizes voice conversation through a narrow-band network; finally, when the conversation is over, the standard SIP hang-up signaling on the wired network is sent to the wireless network for transmission after SIP compression and SLIP encapsulation, and then is restored to the standard SIP hang-up signaling on the destination platform, so that the conversation connection between the voice terminals is disconnected. The SIP compression method provided by the invention can compress the size of a standard SIP message to be less than 10%, and the provided voice low-bit-rate processing optimization method can reduce the channel bandwidth occupied by full-duplex conversation to be less than 3.2Kbps, so that the voice terminal can realize end-to-end VoIP conversation on a short wave/ultra-short wave wireless channel with the bandwidth not more than 10Kbps, and the communication capacity of broadband wireless channels such as satellite communication, microwave and the like can be expanded.
The embodiment of the disclosure is suitable for communication scenes such as ship communication and the like which need narrow-band communication.
Fig. 4 is a schematic structural diagram of a communication device provided in an embodiment of the present disclosure, which may be implemented by software, hardware, or a combination of the two to become part of or all of a wireless gateway. As shown in fig. 4, thecommunication apparatus 400 includes: asession setup module 401, adata processing module 402 and asession disconnect module 403.
Thesession establishing module 401 is configured to establish a session between the calling terminal and the called terminal based on the compressed first session initiation protocol SIP message. Adata processing module 402, configured to convert first voice data in a first coding scheme from a first terminal into first voice data in a second coding scheme, and send the first voice data in the second coding scheme to a second terminal by using the session; and converting second voice data of a second coding mode received from the second terminal through the session into second voice data of a first coding mode, and sending the second voice data of the first coding mode to the first terminal. Thesession disconnection module 403 is configured to disconnect the session based on the compressed second SIP message.
The first terminal is one of a calling terminal and a called terminal, the second terminal is the other of the calling terminal and the called terminal, the code rate of the first voice data of the first coding mode is greater than that of the first voice data of the second coding mode, and the code rate of the second voice data of the first coding mode is greater than that of the second voice data of the second coding mode.
Optionally, the compressed first SIP message corresponds to a first SIP message, the compressed second SIP message corresponds to a second SIP message, the first SIP message and the second SIP message both include a first session identifier, the compressed first SIP message and the compressed second SIP message both include a second session identifier uniquely associated with the first session identifier, the second session identifier is a memory address applied by the first wireless gateway, and the first wireless gateway is a wireless gateway connected to the calling terminal through a portal.
Optionally, the first SIP message includes SIP INVITE call request, SIP180 response, SIP200OK response, and SIP ACK acknowledgement, and the compressed first SIP message includes a SLIP call request message, a SLIP ringing response message, a SLIP off-hook response message, and a SLIP off-hook response acknowledgement message.
Optionally, thesession establishing module 401 is configured to receive an SIP INVITE call request sent by the calling terminal; converting the SIP INVITE call request into a SLIP call request message; sending the SLIP call request message to a second wireless gateway; receiving a SLIP ringing response message sent by the second wireless gateway, wherein the SLIP ringing response message is generated based on the second wireless gateway receiving a SIP180 response sent by a called terminal; sending SIP180 response to the calling terminal; receiving a SLIP off-hook response message sent by the second wireless gateway, wherein the SLIP off-hook response message is generated based on the second wireless gateway receiving a SIP200OK response sent by a called terminal; sending a SIP200OK response to the calling terminal; sending a SLIP off-hook response confirmation message to the second wireless gateway; receiving SIP ACK confirmation sent by a calling terminal; and the second wireless gateway is connected with the called terminal through a network port.
Optionally, thesession establishing module 401 is configured to receive a SLIP call request message; sending SIP INVITE request corresponding to the SLIP call request message to the called terminal; receiving SIP180 response sent by a called terminal; sending a SLIP ringing response message corresponding to the SIP180 response to the first wireless gateway, wherein the SLIP ringing response message is used for triggering the first wireless gateway to send the SIP180 response to the calling terminal; receiving SIP200OK response sent by the called terminal; sending a SLIP off-hook response message corresponding to the SIP200OK response to the first wireless gateway, wherein the SLIP off-hook response message is used for triggering the first wireless gateway to send the SIP200OK response to the calling terminal; sending SIP ACK confirmation to the called terminal; receiving a SLIP off-hook response confirmation message sent by a first wireless gateway; and the second wireless gateway is connected with the called terminal through a network port.
Optionally, thedata processing module 402 is configured to obtain first voice data of a first coding scheme in an RTP packet sent by the first terminal; decoding the first voice data of the first coding mode to obtain a first Pulse Code Modulation (PCM) signal; compressing the first PCM signal into a first voice fragment with a length of Y bytes by adopting a second coding mode; and packaging the K first voice fragments into a first SLIP voice stream to obtain first voice data of a second coding mode, wherein Y corresponds to the second coding mode and is a positive integer, and K is a positive integer.
Optionally, the second voice data of the second coding scheme is a second SLIP voice stream, the second SLIP voice stream is obtained by encapsulating K second voice fragments corresponding to a second PCM signal, the second PCM signal is obtained by decoding the second voice data of the second coding scheme sent by the second terminal, and thedata processing module 402 is further configured to extract a second voice fragment with a length of Y bytes from the second SLIP voice stream; decoding the second voice chip to obtain a second PCM signal; and coding the second PCM signal by adopting the first coding mode to obtain second voice data of the first coding mode, wherein Y corresponds to the second coding mode and is a positive integer.
Optionally, the second SIP message includes a SIP BYE on-hook request, and the compressed second SIP message includes a SLIP on-hook request message.
Optionally, thesession disconnection module 403 is configured to receive an SIP BYE on-hook request sent by the first terminal; sending a SLIP hang-up request message corresponding to the SIP BYE hang-up request to an opposite-end wireless gateway, wherein the SLIP hang-up request message is used for triggering the opposite-end wireless gateway to send the BYE hang-up request to the second terminal; sending a SIP200OK response to the first terminal; and the opposite-end wireless gateway is connected with the second terminal through a network port.
Optionally, thesession disconnection module 403 is configured to receive a SLIP hang request message sent by an opposite-end wireless gateway; sending a SIP BYE on-hook request corresponding to the SLIP on-hook request message to a second terminal; receiving a SIP200OK response sent by the second terminal; and the opposite-end wireless gateway is connected with the first terminal.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 5 is a schematic structural diagram of a communication device according to an embodiment of the present disclosure. As shown in fig. 5, the communication device may be acomputer apparatus 600, thecomputer apparatus 600 including a Central Processing Unit (CPU)601, asystem memory 604 including a Random Access Memory (RAM)602 and a Read Only Memory (ROM)603, and asystem bus 605 connecting thesystem memory 604 and thecentral processing unit 601. Thecomputer device 600 also includes a basic input/output system (I/O system) 606 for facilitating information transfer between various elements within the computer, and amass storage device 607 for storing anoperating system 613,application programs 614, and other program modules 615.
The basic input/output system 606 includes adisplay 608 for displaying information and aninput device 609 such as a mouse, keyboard, etc. for a user to input information. Wherein thedisplay 608 and theinput device 609 are connected to thecentral processing unit 601 through an input output controller 610 connected to thesystem bus 605. The basic input/output system 606 may also include an input/output controller 610 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input/output controller 610 may also provide output to a display screen, a printer, or other type of output device.
Themass storage device 607 is connected to thecentral processing unit 601 through a mass storage controller (not shown) connected to thesystem bus 605. Themass storage device 607 and its associated computer-readable media provide non-volatile storage for thecomputer device 600. That is, themass storage device 607 may include a computer-readable medium (not shown) such as a hard disk or CD-ROM drive.
Without loss of generality, the computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. Thesystem memory 604 andmass storage device 607 described above may be collectively referred to as memory.
Thecomputer device 600 may also operate as a remote computer connected to a network via a network, such as the internet, in accordance with various embodiments of the invention. That is, thecomputer device 600 may be connected to thenetwork 612 through thenetwork interface unit 611 connected to thesystem bus 605, or may be connected to other types of networks or remote computer systems (not shown) using thenetwork interface unit 611.
The memory further includes one or more programs, the one or more programs are stored in the memory, and thecentral processing unit 601 implements the communication method shown in fig. 2 or 3 by executing the one or more programs.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as a memory, including instructions executable by a processor of a computer device to perform the communication methods illustrated by the various embodiments of the present invention is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The embodiment of the disclosure also provides a communication system, which comprises a first wireless gateway and a second wireless gateway. The first wireless gateway is connected to the calling terminal for performing the steps performed by the wireless gateway connected to the calling terminal in fig. 3, and the second wireless gateway is connected to the called terminal for performing the steps performed by the wireless gateway connected to the called terminal in fig. 3.
The above description is meant to be illustrative of the principles of the present disclosure and not to be taken in a limiting sense, and any modifications, equivalents, improvements and the like that are within the spirit and scope of the present disclosure are intended to be included therein.