WO2016066027A1 - Media transmission method and device - Google Patents

Media transmission method and device Download PDF

Info

Publication number
WO2016066027A1
WO2016066027A1 PCT/CN2015/092103 CN2015092103W WO2016066027A1 WO 2016066027 A1 WO2016066027 A1 WO 2016066027A1 CN 2015092103 W CN2015092103 W CN 2015092103W WO 2016066027 A1 WO2016066027 A1 WO 2016066027A1
Authority
WO
WIPO (PCT)
Prior art keywords
tunnel
media
data packet
user terminal
port number
Prior art date
Application number
PCT/CN2015/092103
Other languages
French (fr)
Chinese (zh)
Inventor
张旭武
张进生
Original Assignee
华为技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2016066027A1 publication Critical patent/WO2016066027A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Definitions

  • the present invention relates to the field of IP communication technologies, and in particular, to a media transmission method and device.
  • voice data and video media data are usually transmitted in real time using RTP (Real-Time Transport Protocol), and RTCP (Real-Time Transport Control Protocol; The Real-Time Transport Control Protocol) provides a reliable transport management mechanism for RTP packets.
  • RTP packets and RTCP packets are transmitted by User Datagram Protocol (UDP).
  • UDP User Datagram Protocol
  • the UDP port number required for transmitting the RTCP data packet is larger than the UDP port number used for transmitting the RTP data packet, and is used for transmitting the RTCP data packet.
  • the UDP port number is an odd number.
  • firewalls In the enterprise network or LAN application scenario, for the sake of network security, a firewall is deployed between the enterprise network or the local area network and the public network. In addition to providing network address translation, firewalls often limit the types of packets allowed and the range of open ports. In practical applications, RTP packets and RTCP packets cannot be performed normally due to firewall limitations.
  • ICE Interactive Connectivity Establishment
  • STUN Session Traversal Utilities for NAT
  • TURN Traversal Using Relay Network Address Translation
  • the ports used by the communication parties to transmit RTP data packets and RTCP data packets can be multiplexed on the same port, that is, the media gateway fixedly allocates the RTP/RTCP ports to 80.
  • the media stream traverses from the 443 or 80 port of the firewall in the form of RTP/RTCP over TCP.
  • this method can only guarantee to traverse part of the firewall, for example, has HTTP (Hyper Text Transport Protocol, Hypertext Transfer Protocol)
  • HTTP Hyper Text Transport Protocol, Hypertext Transfer Protocol
  • the firewall with the HTTP proxy function can identify whether the upper-layer protocol packets carried by the IP (Internetwork Protocol) packet are HTTP protocol packets, if not HTTP. Protocol packets, which directly drop packets.
  • IP Internetwork Protocol
  • the HTTP proxy function firewall can easily identify the packet as a non-HTTP packet and discard it. Media packets cannot traverse the firewall.
  • a TURN server is deployed between the VoIP client and the network side as a media relay server, and the TURN server supports the TURN request sent by the terminal from the protocol default port 3478 port.
  • the media traverses the firewall from the 443 through the RTP/RTCP over UDP over TURN over TCP method, or through the RTP/RTCP over UDP over TURN over TLS mode to reach the TURN server, and the TURN server forwards the media to the peer end.
  • the TURN server is added to the system, causing the data packet transmission delay of the media
  • the number of data packets encapsulated by the media is too many, and the header of the media data packet is redundant, which affects the efficiency of media transmission;
  • TURN handshake signaling between the TURN server and the user terminal is complex, and each media A separate handshake negotiation is required to establish a relay channel, which increases the complexity of data packet transmission of the medium.
  • the embodiments of the present invention provide a media transmission method and device, which are used to solve the problems of complex transmission and low transmission efficiency of the media of the current VoIP communication system in the process of traversing the firewall.
  • a media transmission method comprising:
  • the user terminal determines, according to the detection result of the network address translation session transmission application STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer secure TLS tunnel type and data. Reporting one or more of the transport layer security DTLS tunnel types;
  • the user terminal allocates a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type according to the determined tunnel type, and loads the tunnel type, the first port number, and the tunnel data packet.
  • the format information is sent to the network side, so that the network side allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and establishes between the first port number and the second port number.
  • the user terminal sends the tunnel type, the first port number, and payload format information of a tunnel data packet to a network side.
  • the tunnel type is a second port number of the network side of the transmission tunnel corresponding to the tunnel type, and the second port number is sent to the media gateway and the user terminal;
  • the user terminal establishes a transmission tunnel between the first port number and the second port number by negotiating with the media gateway.
  • the user terminal determines according to the detection result of the STUN Establish a tunnel type for the transport tunnel to traverse the firewall for the media to be transmitted, including:
  • the user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting real-time transmission. Controlling the public address of the port assignment of the protocol RTCP packet;
  • the user terminal When the user terminal cannot receive the address collection response of the UDP bearer returned by the STUN server, it determines that the tunnel type of the transport tunnel for traversing the firewall for the media to be transmitted is the TLS tunnel type.
  • the user terminal establishes a transmission tunnel between the first port number and the second port number, and specifically includes:
  • the user terminal If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
  • the user terminal determines to wait according to the detection result of the STUN.
  • the transmitted media establishes the tunnel type for the transport tunnel that traverses the firewall, including:
  • the user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol. Port assignment of RTCP packets Use address
  • the user terminal When receiving the address collection response returned by the STUN server, the user terminal further sends a STUN connectivity detection request of the media path to the media port corresponding to the media gateway by using the media port of the user terminal, where the STUN connectivity detection is performed. Determining whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
  • the user terminal determines that the tunnel type of the transmission tunnel for traversing the firewall is the DTLS tunnel type.
  • the user terminal establishes a transmission tunnel that includes the first port number and the second port number, and specifically includes:
  • the user terminal If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
  • the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is a TLS tunnel type
  • the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet;
  • the tunnel type is a DTLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
  • the port number included in the UDP protocol packet header is respectively a media port and a location allocated by the user terminal.
  • the media transmission method further includes :
  • the user terminal decapsulates the received media data packet, and acquires a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
  • a media transmission device comprising:
  • a type determining module configured to determine, according to a detection result of the network address translation session transmission application STUN, a tunnel type for a transmission tunnel traversing a firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer security TLS One or more of tunnel type, datagram transport layer security DTLS tunnel type;
  • a tunnel establishment module configured to allocate, according to the determined tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and the tunnel type, the first port number, and the tunnel data packet
  • the load format information is sent to the network side, so that the network side allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, where the first port number and the second port number are Establish a transmission tunnel;
  • a data packet receiving module configured to receive, by the network side, a data packet of the media encapsulated according to the load format information of the tunnel data packet that is transmitted by using the established transmission tunnel.
  • the tunnel establishment module sends the tunnel type, the first port number, and load format information of a tunnel data packet to a network.
  • Side specifically for:
  • the voice description protocol SDP message is sent to the IP bearer voice VoIP signaling server, and the VoIP signaling server allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and the second port number is The port number is sent to the media gateway and the user terminal;
  • a transmission tunnel is established between the first port number and the second port number by negotiating with the media gateway.
  • the type determining module is based on the detection result of the STUN. Determining the tunnel type for the transport tunnel to traverse the firewall for the media to be transmitted, specifically for:
  • the tunnel type for the transport tunnel traversing the firewall for the media to be transmitted is the TLS tunnel type.
  • the tunnel establishment module establishes a transmission tunnel between the first port number and the second port number, specifically for:
  • the user terminal If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
  • the type determining module is based on the detection result of the STUN. Determining the tunnel type for the transport tunnel to traverse the firewall for the media to be transmitted, specifically for:
  • the STUN connectivity detection request of the media path is further sent to the media port corresponding to the media gateway by the media port of the user terminal, where the STUN connectivity detection request is used to determine Whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
  • the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a DTLS tunnel type.
  • the tunnel establishment module establishes a transmission tunnel that includes the first port number and the second port number, specifically for:
  • the user terminal If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
  • the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is a TLS tunnel type
  • the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet;
  • the tunnel type is a DTLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
  • the port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
  • the media transmission device further includes : Parsing module, where:
  • the parsing module is configured to decapsulate the received media data packet, and obtain a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
  • the user terminal determines, according to the detection result of the STUN, the tunnel type of the transmission tunnel used to traverse the firewall for the media to be transmitted, and allocates the user terminal to the transmission tunnel corresponding to the tunnel type according to the determined tunnel type.
  • a first port number of the side and sending the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, so that the network side is the transmission tunnel corresponding to the tunnel type according to the tunnel type.
  • Allocating a second port number on the network side establishing a transmission tunnel between the first port number and the second port number; receiving the tunnel data packet that is transmitted by the network side through the established transmission tunnel
  • the payload format information encapsulates the packets of the media.
  • the firewall cannot know the type of the upper layer protocol packet, and the method of the embodiment of the present invention directly establishes a transmission tunnel with the media gateway without adding additional network elements and nodes, which can not only traverse All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
  • FIG. 1 is a schematic flowchart diagram of a media transmission method according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic diagram of a TLS tunnel data packet format when traversing a firewall
  • FIG. 3 is a schematic diagram of a DTLS tunnel data packet format when traversing a firewall
  • FIG. 4 is a schematic flowchart of a media transmission method according to Embodiment 2 of the present invention.
  • FIG. 5 is a schematic flowchart diagram of a media transmission method according to Embodiment 3 of the present invention.
  • FIG. 6 is a schematic flowchart diagram of a media transmission method according to Embodiment 4 of the present invention.
  • FIG. 7 is a schematic structural diagram of a media transmission device according to Embodiment 5 of the present invention.
  • FIG. 8 is a schematic structural diagram of a media transmission device according to Embodiment 6 of the present invention.
  • an embodiment of the present invention provides a media transmission method and device.
  • the user terminal determines, according to the detection result of the STUN, a tunnel type for a transmission tunnel traversing a firewall for the media to be transmitted, according to the determined Assigning, by the tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and storing the tunnel type, the first port number, and the payload of the tunnel data packet (English: Payload) format information Sending to the network side, the network side allocates a second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and establishes a transmission tunnel between the first port number and the second port number.
  • a tunnel type for a transmission tunnel traversing a firewall for the media to be transmitted according to the determined Assigning, by the tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and storing the tunnel type, the first port number, and the payload of the tunnel data packet (English: Pay
  • the firewall cannot know the type of the upper layer protocol packet, and the method of the embodiment of the present invention directly establishes a transmission tunnel with the media gateway without adding additional network elements and nodes, which can not only traverse All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
  • the data packet of the media described in the embodiment of the present invention includes: an RTP data packet and/or an RTCP data packet.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • FIG. 1 is a schematic flowchart diagram of a media transmission method according to Embodiment 1 of the present invention. The method can be as follows.
  • Step 101 The user terminal determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted.
  • the tunnel type includes at least one of a transport layer security (TLS) tunnel type and a datagram transport layer security (DTLS) tunnel type.
  • TLS transport layer security
  • DTLS datagram transport layer security
  • step 101 the user terminal initiates a VoIP session and runs the ICE client to initiate the ICE/STUN traversal firewall process.
  • the user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted, wherein the RTP port number is an even number and is one less than the port number of the RTCP.
  • the user terminal sends an address collection request to the STUN server.
  • the address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
  • the user terminal sends an address collection request carried by the UDP (User Datagram Protocol) to the STUN server.
  • UDP User Datagram Protocol
  • the user terminal sends the UDP to the STUN server through the P1 port and the P2 port respectively.
  • the bearer address allocation request ie STUN allocate
  • the STUN bind request ie STUN Binding
  • the STUN address allocation request and the STUN binding request may be collectively referred to as an address collection request).
  • the STUN server obtains the source address of the address collection request.
  • the source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request.
  • the STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
  • the address collection response sent by the user terminal by the UDP bearer and the STUN server to the user terminal is also carried by the UDP.
  • the firewall restricts the UDP packet from passing, or the firewall port 3478 (the default protocol port of the STUN) is not open, the firewall The address collection request sent by the user terminal is discarded, so that the STUN server cannot receive the address collection request sent by the user terminal, and the user terminal cannot receive the address collection response sent by the STUN server.
  • the user terminal determines that the firewall prohibits VoIP media transmission, and needs to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
  • the user terminal determines that the firewall restricts the transmission of the UDP data packet, and the tunnel type that needs to establish a transmission tunnel for the medium to be transmitted for traversing the firewall is a TLS tunnel type.
  • the response is collected by the UDP-hosted address returned by the STUN server. If the firewall has not restricted the UDP packet passing, or the firewall port 3478 (the default protocol port of the STUN) is open, the user terminal receives the address collection response returned by the STUN server, and obtains the firewall respectively.
  • a public address also known as a reflexive address assigned to a P1 port and a P2 port.
  • the user terminal continues to execute the ICE/STUN traversal firewall process:
  • the user terminal sends an SDP (Session Description Protocol) message to the VoIP signaling server, where the SDP message includes a reflexive address.
  • SDP Session Description Protocol
  • the VoIP signaling server sends the received SDP message and ICE information to the media gateway, and
  • the device allocates corresponding network side media ports (ie, P3 port and P4 port) for the P1 port and the P2 port.
  • network side media port herein may refer to a media port corresponding to the media gateway.
  • the VoIP signaling server returns an SDP response message to the user terminal, wherein the SDP response message includes the allocated network side media ports (ie, P3 port and P4 port).
  • the SDP response message includes the allocated network side media ports (ie, P3 port and P4 port).
  • the user terminal further sends a STUN Connectivity check request of the media path to the media port corresponding to the media gateway through the media port of the user terminal, where the STUN connectivity detection request is used to determine whether the media sent by the user terminal is
  • the user can directly access the media port corresponding to the media gateway, that is, the user terminal checks whether the path between the local media port and the media port corresponding to the media gateway is reachable.
  • the user terminal determines to establish the media to be transmitted for use. A transmission tunnel that traverses the firewall.
  • the firewall between the user terminal and the media gateway has the DPI (Deep Packet Inspection) function
  • the STUN connectivity detection request can be allowed to pass, but the RTP/RTCP data packet is not allowed to pass, so that the user terminal remains.
  • the media data packet from the media gateway cannot be received.
  • the user terminal determines to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
  • the tunnel type that the user terminal needs to establish a transport tunnel for traversing the firewall for the medium to be transmitted is a DTLS tunnel type.
  • the user terminal sends an address collection request that is carried by the UDP to the STUN server, and fails to receive the address collection response of the UDP bearer returned by the STUN server, it is determined that the transmission for the media to be transmitted is established for traversing the firewall.
  • the tunnel type of the tunnel is the TLS tunnel type.
  • the user terminal sends an address collection request by the UDP to the STUN server, and receives the response from the UDP bearer returned by the STUN server, the media port corresponding to the media gateway through the P1 and P2 ports respectively according to the existing technical specifications.
  • Send a STUN connectivity check request When the STUN connectivity detection response sent by the media gateway has not been received, it is determined that the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a DTLS tunnel type.
  • Step 102 The user terminal allocates a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type according to the determined tunnel type.
  • step 102 the user terminal traverses the firewall by using the tunnel data packet to encapsulate the RTP/RTCP over UDP data packet when determining to establish a transmission tunnel for traversing the firewall.
  • the transmission tunnel corresponding to the determined tunnel type is determined.
  • the first port number on the user terminal side is assigned.
  • the first port number on the user terminal side is a port number of the TLS tunnel type assigned to the user terminal side TLS client;
  • the first port number on the user terminal side is the port number of the DTLS client allocated to the user terminal side for the TLS tunnel type.
  • Step 103 The user terminal sends the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, so that the network side allocates the transmission tunnel corresponding to the tunnel type according to the tunnel type.
  • a second port number on the network side establishing a transmission tunnel between the first port number and the second port number.
  • the user terminal carries the tunnel type, the first port number, and the payload format information of the tunnel data packet in an SDP message and sends the information to the IP bearer voice VoIP signaling server, which is determined by the VoIP signaling server.
  • the tunnel type is a second port number on the network side of the transmission tunnel corresponding to the tunnel type, and the second port number is sent to the media gateway and the user terminal.
  • the user terminal may also send the IP address of the user terminal to the VoIP signaling server.
  • the VoIP signaling server may also send an authentication parameter to the user terminal, where the authentication parameter is used to authenticate the media gateway when establishing a transmission tunnel with the media gateway.
  • the payload format of the tunnel data packet refers to how the RTP protocol data packet/RTCP protocol data packet is carried in the tunnel data packet
  • the payload format information of the tunnel data packet refers to a specific identifier or attribute line carried by the SDP, and is used for Notify the receiver how to encapsulate the data packets of the media to be sent in the tunnel data packet.
  • the VoIP signaling server receives the SDP message sent by the user terminal, and determines the TLS protocol default port number 443 as the TLS tunnel network side when determining the firewall traversed by the TLS tunnel according to the tunnel type included in the SDP message. Port, at the same time, randomly assigns the port number of the RTP protocol packet/RTCP protocol packet to P4/P5; and generates an authentication parameter for the user terminal to authenticate the media gateway during the handshake negotiation process of establishing the TLS transmission tunnel, for example:
  • the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
  • the VoIP signaling server sends the port number of the allocated TLS transmission tunnel network side and the authentication parameter for establishing the TLS tunnel to the user terminal through the SDP response message.
  • the VoIP signaling server sends the network side port (ie, the second port number) of the TLS transmission tunnel and the payload format information of the tunnel data packet to the media gateway.
  • the network side port ie, the second port number
  • the user terminal and the media gateway negotiate to establish a TLS transmission tunnel between the first port number and the second port number according to the existing TLS protocol.
  • the user terminal authenticates the media gateway because the TLS transmission is established according to the existing ICE protocol.
  • the user terminal sends a STUN connectivity check request through the TLS transport tunnel.
  • the media gateway authenticates the user terminal by using the ICE short-term credential mechanism.
  • the VoIP signaling server receives the SDP message sent by the user terminal, and determines the default port number 3478 of the STUN protocol as the DTLS tunnel network side when determining the firewall that traverses the DTLS tunnel mode according to the tunnel type included in the SDP message.
  • the authentication parameter of the user terminal to authenticate the media gateway during the handshake negotiation process of establishing the DTLS transmission tunnel.
  • the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
  • the VoIP signaling server sends the port number (ie, the second port number) of the DTLS tunnel network side and the authentication parameter for establishing the tunnel to the user terminal through the SDP response message.
  • the VoIP signaling server sends the network format port of the DTLS tunnel and the payload format information of the tunnel data packet to the media gateway.
  • the user terminal and the media gateway negotiate to establish a DTLS transmission tunnel between the first port number and the second port number according to the existing DTLS protocol.
  • Step 104 The user terminal receives a data packet of a media that is encapsulated by the network side and is encapsulated according to load format information of the tunnel data packet.
  • the data packet of the media includes an RTP protocol data packet/RTCP protocol data packet and a UDP protocol header, that is, an RTP/RTCP over UDP data packet, and the port number included in the UDP protocol header is the communication party carried in the SDP. RTP/RTCP port.
  • the data packet of the tunneled media may be encapsulated in an encrypted form or a non-encrypted form.
  • TLS and DTLS encapsulate the carried data packets in two ways.
  • One is to encrypt data by using a normal encryption algorithm (such as AES, 3DES, etc.), and the other is to adopt Data is encapsulated in plain text without encryption.
  • a normal encryption algorithm such as AES, 3DES, etc.
  • the two parties must perform the same TLS/DTLS handshake negotiation process as the encryption encapsulation method, except that the encryption algorithm negotiated by both parties is null (null). .
  • null algorithm does not actually encrypt the data, and the format of the packet is the same regardless of the encapsulation method.
  • the firewall since the firewall does not perform protocol logic analysis on the TLS/DTLS handshake process, it cannot be known which encryption algorithm is used for encryption by TLS/DTLS. The data of the default payload part has been encrypted, so that the firewall cannot know the data carried by the TLS/DTLS tunnel. Package protocol type. Therefore, as long as the user terminal can establish a TLS/DTLS tunnel with the media gateway, no matter which encryption algorithm is used, the media data packets carried by the TLS/DTLS tunnel do not affect the firewall.
  • step 104 the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is TLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are used as the payload format information of the tunnel packet. Encapsulated in a TLS tunnel packet; or
  • the tunnel type is a DTLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
  • the port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
  • the media transmission method further includes:
  • the user terminal decapsulates the received media data packet, acquires a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet, and according to a UDP protocol data packet in a TLS tunnel data packet/DTLS tunnel data packet
  • the port number included in the header sends the data packet of the media to the media processing unit.
  • FIG. 2 it is a schematic diagram of the TLS tunnel packet format when traversing the firewall.
  • FIG. 2 shows the TLS tunnel packet.
  • the TLS message contains the tunnel packet header, the tunnel packet payload, and the TLS trailer.
  • the port number of the TCP included in the tunnel packet header is the source port number and destination port number of the TLS transport tunnel. If the data packet of the media is sent by the user terminal to the media gateway, the source port number of the tunnel data packet is the first port number, and the destination port is the second port number; if the media data packet is sent by the media gateway to the user terminal, The source port number of the tunnel packet is the second port number, and the destination port number is the port number corresponding to the public network address assigned to the user terminal through the firewall.
  • the media gateway passes the STUN connectivity check (for example: The TLS handshake request message or the STUN connectivity check request message acquires a public network address assigned to the user terminal by the firewall.
  • the communication parties exchange the media port number of the peer end through the SDP message.
  • the port number of the UDP header included in the tunnel packet payload is the media port number of the communication parties carried in the SDP. If the media packet is used by the user.
  • the source port number of the UDP header is P1/P2, and the destination port number is P3/P4. If the media packet is sent by the media gateway to the user terminal, the source port number of the UDP header is P3. /P4, the destination port is P1/P2.
  • the TLS trailer part is the integrity check value of the TLS payload part. According to the TLS protocol, this value is used to verify whether the payload part data has been modified.
  • the firewall cannot know the type of packet of the media carried by the tunnel packet.
  • FIG. 3 it is a schematic diagram of the DTLS tunnel packet format when traversing the firewall.
  • Figure 3 shows the DTLS tunnel packet.
  • the DTLS message contains the tunnel packet header, the tunnel packet payload, and the DTLS trailer.
  • the port number of the UDP included in the tunnel packet header is the source port number and destination port of the DTLS transmission tunnel. If the data packet of the media is sent by the user terminal to the media gateway, the source port number of the tunnel data packet is the first port number, and the destination port number is the second port number; if the media data packet is sent by the media gateway to the user terminal The source port number of the tunnel data packet is the second port number, and the destination port number is the port number corresponding to the public network address allocated by the firewall for the user terminal.
  • the media gateway passes the STUN connectivity detection (for example, The DTLS handshake request message or the STUN connectivity check message acquires a public network address assigned to the user terminal by the firewall.
  • the port number of the UDP header included in the tunnel packet payload is the media port number of the communication parties carried by the SDP. If the media packet is sent by the user terminal to the media gateway, the port number is P1/P2; if the media datagram When the text is sent to the user terminal by the media gateway, the port number is P3/P4.
  • the DTLS trailer part is the integrity check value of the TLS payload part. According to the DTLS protocol, this value is used to verify whether the payload part data has been modified.
  • the user terminal determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, according to the determined tunnel.
  • a type the first port number on the user terminal side is allocated to the transmission tunnel corresponding to the tunnel type, and the tunnel type, the first port number, and the load format information of the tunnel data packet are sent to the network side, so that the network side
  • the firewall cannot know the type of the upper layer protocol packet, and the method of the embodiment of the present invention directly establishes a transmission tunnel with the media gateway without adding additional network elements and nodes, which can not only traverse All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • FIG. 4 is a schematic flowchart diagram of a media transmission method according to Embodiment 2 of the present invention. The method can be as follows.
  • Step 401 The user terminal initiates a VoIP session and runs the ICE client.
  • step 401 the user terminal initiates the ICE/STUN traversal firewall process.
  • Step 402 The user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted.
  • the RTP port number is an even number and is one less than the port number of the RTCP.
  • Step 403 The user terminal sends an address collection request to the STUN server.
  • the address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
  • the user terminal sends an address collection request carried by the UDP (User Datagram Protocol) to the STUN server.
  • UDP User Datagram Protocol
  • the user terminal sends an address allocation request (ie, STUN allocate) or a STUN binding request (that is, STUN Binding) carried by the UDP to the STUN server through the P1 port and the P2 port, respectively (in the present invention, for the convenience of description, address allocation)
  • an address allocation request ie, STUN allocate
  • a STUN binding request that is, STUN Binding
  • Request and STUN binding request can Collectively referred to as address collection requests).
  • the STUN server obtains the source address of the address collection request.
  • the source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request.
  • the STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
  • Step 404 The user terminal determines whether the address collection response returned by the STUN server can be received. If yes, step 409 is performed; if not, step 405 is performed.
  • Step 405 The user terminal determines that the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a TLS tunnel type.
  • Step 406 The user terminal allocates a port number of the user terminal side TLS client to the transmission tunnel corresponding to the TLS tunnel type according to the determined TLS tunnel type.
  • the port number of the TLS client on the user terminal side herein may also be referred to as the first port number on the user terminal side.
  • Step 407 The user terminal sends the tunnel type, the port number of the user terminal side TLS client, and the load format information of the tunnel data packet to the network side, so that the network side corresponds to the tunnel type according to the tunnel type.
  • the transmission tunnel allocates a port number on the network side, and establishes a transmission tunnel between the port number of the TLS client on the user terminal side and the port number on the network side.
  • port number on the network side herein may also be referred to as a second port number on the network side.
  • the user terminal carries the tunnel type, the port number of the user terminal side TLS client, and the payload format information of the tunnel data packet in an SDP message and sends the message to the IP bearer voice VoIP signaling server by VoIP.
  • the signaling server allocates a port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and sends the port number of the network side to the media gateway and the user terminal.
  • the user terminal may also send the IP address of the user terminal to the VoIP signaling server.
  • the VoIP signaling server may further send an authentication parameter to the user terminal, where the authentication parameter is used.
  • the media gateway is authenticated when establishing a transmission tunnel with the media gateway.
  • the VoIP signaling server receives the SDP message sent by the user terminal, and determines the TLS protocol default port number 443 as the TLS tunnel network side when determining the firewall traversed by the TLS tunnel according to the tunnel type included in the SDP message.
  • the port number of the RTP/RTCP protocol data packet is randomly assigned to be P4/P5; and the authentication parameter for authenticating the media gateway by the user terminal during the handshake negotiation process of establishing the TLS transmission tunnel, for example, the authentication parameter may be A digital certificate fingerprint or pre-shared key for the media gateway.
  • the VoIP signaling server sends the port number of the allocated TLS transmission tunnel network side and the authentication parameter for establishing the TLS tunnel to the user terminal through the SDP response message.
  • the VoIP signaling server sends the port format of the network side of the TLS transmission tunnel and the payload format information of the tunnel data packet to the media gateway.
  • the user terminal and the media gateway negotiate to establish a TLS transmission tunnel between the port number of the TLS client on the user terminal side and the port number on the network side according to the existing TLS protocol.
  • the user terminal authenticates the media gateway because the TLS transmission is established according to the existing ICE protocol.
  • the user terminal sends a STUN connectivity check request through the TLS transport tunnel.
  • the media gateway authenticates the user terminal by using the ICE short-term credential mechanism.
  • Step 408 The user terminal receives a data packet of a media that is encapsulated by the network side and is encapsulated according to the load format information of the tunnel data packet.
  • step 408 the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is the TLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the TLS tunnel packet as the payload format information of the tunnel packet.
  • the user terminal sends a STUN connectivity check request through the TLS transport tunnel, and the media gateway adopts The short-term credential mechanism is used to perform authentication on the user terminal.
  • the user terminal After receiving the STUN connectivity detection response, the user terminal notifies the media gateway by using the update SDP offer message to determine to traverse the firewall by using the TLS transmission tunnel.
  • the user terminal and the media gateway send the RTP/RTCP over UDP protocol data packet to the peer end according to the TLS tunnel data packet format of FIG. 2 through the TLS transport tunnel.
  • Step 409 The user terminal receives the address collection response returned by the STUN server, and obtains the public address assigned by the firewall to the P1 port and the P2 port respectively.
  • the user terminal sends an SDP (Session Description Protocol) message to the VoIP signaling server, where the public address is included in the SDP message.
  • SDP Session Description Protocol
  • the VoIP signaling server sends the received SDP message and ICE information to the media gateway, and randomly allocates the media ports (ie, P3 port and P4 port) corresponding to the network side to the P1 port and the P2 port.
  • the VoIP signaling server returns an SDP response message to the user terminal, where the SDP response message includes the media port corresponding to the allocated network side (ie, the P3 port and the P4 port).
  • network side media port herein may refer to a media port corresponding to the media gateway.
  • Step 410 The user terminal sends a STUN connectivity detection request of the media path to the media port P3/P4 corresponding to the media gateway through the media port P1/P2.
  • the STUN Connectivity check (STUN Connectivity check) request is used to determine whether the media sent by the user terminal can directly reach the media port corresponding to the media gateway, that is, the user terminal checks the media corresponding to the media gateway from the local media port to the media gateway. Whether the path between the ports is accessible.
  • Step 411 When the user terminal cannot receive the STUN connectivity detection response sent by the media gateway, determine that the tunnel type of the transmission tunnel used for traversing the firewall is the DTLS tunnel type.
  • step 411 if the firewall between the user terminal and the media gateway does not open the protocol port of the communication party, the user terminal cannot receive the STUN connectivity detection response sent by the media gateway. At this time, the user terminal determines that the user terminal is to be transmitted. The media establishes a transport tunnel for traversing the firewall.
  • DPI Deep Packet
  • deep packet inspection deep packet inspection
  • Step 412 The user terminal allocates a port number of the DTLS client of the user terminal to the DTLS tunnel type according to the determined DTLS tunnel type.
  • the port number of the DTLS client on the user terminal side herein may also be referred to as the first port number on the user terminal side.
  • Step 413 The user terminal sends the tunnel type, the port number and the payload format information of the user terminal side DTLS client to the network side, so that the network side allocates the transmission tunnel corresponding to the tunnel type according to the tunnel type.
  • a port number on the network side establishes a transmission tunnel between the port number of the DTLS client on the user terminal side and the port number on the network side.
  • the VoIP signaling server receives the SDP message sent by the user terminal, and determines the default port number 3478 of the STUN protocol as the DTLS tunnel when determining the firewall traversed by the DTLS tunnel according to the tunnel type included in the SDP message.
  • the authentication parameter of the user terminal to authenticate the media gateway during the handshake negotiation process of the DTLS transmission tunnel.
  • the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
  • the VoIP signaling server sends the port number of the DTLS tunnel network side and the authentication parameter for establishing the tunnel to the user terminal through the SDP response message.
  • the VoIP signaling server sends the network format port of the DTLS tunnel and the payload format information of the tunnel data packet to the media gateway.
  • the user terminal and the media gateway negotiate to establish a DTLS transmission tunnel between the port number of the DTLS client on the user terminal side and the port number on the network side according to the existing DTLS protocol.
  • Step 414 The user terminal receives a data packet of a media that is encapsulated by the network side and is encapsulated according to the load format information of the tunnel data packet.
  • step 414 the media is encapsulated according to the payload format information of the tunnel data packet in the following manner.
  • Volume packet :
  • the tunnel type is a DTLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS as the payload format information of the tunnel packet corresponding to the DTLS tunnel type.
  • the tunnel packet In the tunnel packet.
  • the user terminal sends the STUN connectivity check request through the DTLS transmission tunnel, and the media gateway performs the authentication on the user terminal by using the short-term credential mechanism.
  • the user terminal After receiving the STUN connectivity detection response, the user terminal notifies the media gateway through the update SDP offer message, and determines to use the DTLS transmission tunnel to traverse the firewall.
  • the user terminal and the media gateway send the RTP/RTCP over UDP protocol data packet to the peer end through the DTLS transmission tunnel according to the encapsulation format of FIG. 3.
  • the firewall cannot know the packet type of the upper layer protocol.
  • a transmission tunnel is directly established between the IP gateway and the node without adding additional network elements and nodes. All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
  • Embodiment 3 is a diagrammatic representation of Embodiment 3
  • FIG. 5 it is a schematic flowchart of a media transmission method according to Embodiment 3 of the present invention.
  • the method can be as follows.
  • Step 501 The user terminal initiates a VoIP session and runs the ICE client.
  • step 501 the user terminal initiates the ICE/STUN traversal firewall process.
  • Step 502 The user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted.
  • the RTP port number is an even number and is one less than the port number of the RTCP.
  • Step 503 The user terminal sends an address collection request to the STUN server.
  • the address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
  • the user terminal sends UDP (User Datagram) to the STUN server.
  • Protocol User Datagram Protocol
  • the user terminal sends an address allocation request (ie, STUN allocate) or a STUN binding request (that is, STUN Binding) carried by the UDP to the STUN server through the P1 port and the P2 port, respectively (in the present invention, for the convenience of description, address allocation)
  • an address allocation request ie, STUN allocate
  • a STUN binding request that is, STUN Binding
  • Request and STUN binding requests can be collectively referred to as address collection requests).
  • the STUN server obtains the source address of the address collection request.
  • the source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request.
  • the STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
  • Step 504 When the user terminal cannot receive the address collection response returned by the STUN server, determine that the tunnel type used for the transmission tunnel to traverse the firewall is TLS tunnel type.
  • the address collection request sent by the user terminal is received by the UDP. Once the firewall restricts the UDP packet from passing through, or the firewall port 3478 (the default protocol port of the STUN) is not open, the firewall discards the address collection request sent by the user terminal, so that the STUN server cannot receive the packet. The address collection request sent by the user terminal does not receive the address collection response sent by the STUN server.
  • the user terminal determines that the firewall prohibits VoIP media transmission, and needs to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
  • the user terminal determines that the firewall restricts the transmission of UDP packets, and the tunnel type that needs to establish a transmission tunnel for traversing the firewall for the media to be transmitted is a TLS tunnel type.
  • Step 505 The user terminal allocates a port number of the user terminal side TLS client to the transmission tunnel corresponding to the TLS tunnel type according to the determined TLS tunnel type.
  • Step 506 The user terminal sends the tunnel type, the port number of the user terminal side TLS client, and the payload format information of the tunnel data packet to the VoIP signaling server by using the SDP message, so that the VoIP signaling server determines to adopt the TLS tunnel mode to traverse Firewall.
  • the SDP message may also carry the IP address of the user terminal (that is, the private address of the user terminal).
  • step 506 the manner in which the SDP message carries the tunnel type, the port number of the user terminal side TLS client, and the media encapsulation format includes but is not limited to:
  • SDP attribute line is defined.
  • the SDP attribute line is used to describe the tunnel type that traverses the firewall, the port number of the TLS client on the user terminal side, and the media encapsulation format information.
  • a traversal: P3 TLS-tunnel UDP-included, indicating that the port number of the TLS client on the user terminal side is P1, and the TLS tunnel type is adopted, and the payload format information of the tunnel data packet is the RTP protocol data packet/ The RTCP protocol packet plus the UDP header is used as the payload of the TLS tunnel packet.
  • the candidate attribute line in the SDP message is extended, and the identifier bit is added, and the path describing the candidate is the tunnel type and the payload format information of the tunnel data packet.
  • a host candidate: ⁇ existing protocol parameter> ⁇ tunnel type> ⁇ load format information of tunnel packet>.
  • Step 507 When the VoIP signaling server receives the SDP message sent by the user terminal, and determines the firewall traversed by the TLS tunnel according to the tunnel type included in the SDP message, the TLS protocol default port number 443 is fixedly allocated as the TLS tunnel server end. (that is, the network side) port, and the port number of the RTP/RTCP protocol packet randomly assigned at the same time is P4/P5.
  • the VoIP signaling server generates an authentication parameter used by the user terminal to authenticate the media gateway in the handshake negotiation process of establishing the TLS transmission tunnel.
  • the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
  • Step 508 The VoIP signaling server sends the port number of the allocated TLS transmission tunnel network side and the authentication parameter for establishing the TLS tunnel to the user terminal by using an SDP response message.
  • the VoIP signaling server sends the network side port of the TLS transmission tunnel and the payload format information of the tunnel data packet to the media gateway.
  • Step 509 The user terminal and the media gateway negotiate to establish a TLS transmission tunnel between the port number of the TLS client on the user terminal side and the port number on the network side according to the existing TLS protocol.
  • the media gateway establishes a mapping relationship between the private address of the user terminal and the public network address assigned by the firewall according to the public network address allocated by the firewall for the user terminal and the private address of the user terminal sent by the VoIP signaling server.
  • the destination port number corresponding to the tunnel packet in the media data packet sent by the subsequent media gateway to the user terminal is the port number corresponding to the public network address.
  • Step 510 The user terminal receives the data packet of the media encapsulated according to the load format information of the tunnel data packet that is transmitted by the network side through the established transmission tunnel.
  • the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is the TLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the TLS protocol as the payload format information of the tunnel packet corresponding to the TLS tunnel type.
  • the tunnel packet In the tunnel packet.
  • the user terminal sends a STUN connectivity check request through the TLS transport tunnel, and the media gateway performs short-term credential mechanism to perform authentication on the user terminal.
  • the user terminal After receiving the STUN connectivity detection response, the user terminal notifies the media gateway by using the update SDP offer message to determine to traverse the firewall by using the TLS transmission tunnel.
  • the user terminal and the media gateway send the RTP/RTCP over UDP protocol data packet to the peer end according to the TLS tunnel data packet format of FIG. 2 through the TLS transport tunnel.
  • Embodiment 4 is a diagrammatic representation of Embodiment 4:
  • FIG. 6 is a schematic flowchart diagram of a media transmission method according to Embodiment 4 of the present invention. The method can be as follows.
  • Step 601 The user terminal initiates a VoIP session and runs the ICE client.
  • step 601 the user terminal initiates the ICE/STUN traversal firewall process.
  • Step 602 The user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted.
  • the RTP port number is an even number and is one less than the port number of the RTCP.
  • Step 603 The user terminal sends an address collection request to the STUN server.
  • the address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
  • the user terminal sends an address collection request carried by the UDP (User Datagram Protocol) to the STUN server.
  • UDP User Datagram Protocol
  • the user terminal sends an UDP-encapsulated address allocation request (ie, STUN allocate) or a STUN binding request (that is, STUN Binding) to the STUN server through the P1 port and the P2 port, respectively (in the present invention, for the convenience of description, address allocation)
  • STUN allocate an UDP-encapsulated address allocation request
  • STUN binding request that is, STUN Binding
  • Request and STUN binding requests can be collectively referred to as address collection requests).
  • the STUN server obtains the source address of the address collection request.
  • the source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request.
  • the STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
  • Step 604 The user terminal receives the address collection response returned by the STUN server, and obtains a public address assigned by the firewall to the P1 port and the P2 port respectively.
  • the user terminal sends an SDP (Session Description Protocol) message to the VoIP signaling server, where the public address is included in the SDP message.
  • SDP Session Description Protocol
  • the VoIP signaling server sends the received SDP message and ICE information to the media gateway, and randomly allocates the media ports (ie, P3 port and P4 port) corresponding to the network side to the P1 port and the P2 port.
  • the VoIP signaling server returns an SDP response message to the user terminal, where the SDP response message includes the media port corresponding to the allocated network side (ie, the P3 port and the P4 port).
  • network side media port herein may refer to a media port corresponding to the media gateway.
  • Step 605 The user terminal sends a STUN connectivity detection request of the media path to the media port P3/P4 corresponding to the media gateway through the media port P1/P2.
  • the STUN Connectivity check (STUN Connectivity check) request is used to determine whether the media sent by the user terminal can directly reach the media port corresponding to the media gateway, that is, the user terminal checks the media corresponding to the media gateway from the local media port to the media gateway. Whether the path between the ports is accessible.
  • Step 606 When the user terminal cannot receive the STUN connectivity detection response sent by the media gateway, determine that the tunnel type of the transmission tunnel used for traversing the firewall is the DTLS tunnel type.
  • step 606 if the firewall between the user terminal and the media gateway does not open the protocol port of the communication party, the user terminal cannot receive the STUN connectivity detection response sent by the media gateway. At this time, the user terminal determines that the user terminal is to be transmitted. The media establishes a transport tunnel for traversing the firewall.
  • the firewall between the user terminal and the media gateway has the DPI (Deep Packet Inspection) function
  • the STUN connectivity detection request can be allowed to pass, but the RTP protocol packet/RTCP protocol packet is not allowed to pass.
  • the user terminal still cannot receive the data packet of the media from the media gateway.
  • the user terminal determines to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
  • Step 607 The user terminal allocates a port number of the DTLS client of the user terminal to the DTLS tunnel type according to the determined DTLS tunnel type.
  • the port number of the DTLS client on the user terminal side herein may also be referred to as the first port number on the user terminal side.
  • Step 608 The user terminal sends, by using an SDP message, the tunnel type, the port number of the DTLS client on the user terminal side, and the payload format information of the tunnel data packet to the VoIP signaling server, so that The VoIP signaling server determines the firewall that traverses through the DTLS tunnel.
  • step 608 the manner in which the SDP carries the tunnel type, the port number of the DTLS client on the user terminal side, and the payload format information of the tunnel data packet includes, but is not limited to:
  • SDP attribute line is defined.
  • the SDP attribute line is used to describe the tunnel type, the port number of the DTLS client on the user terminal side, and the payload format information of the tunnel data packet.
  • a traversal: P5 DTLS-tunnel UDP-included, indicating that the DTLS client port number is P5, and the DTLS tunnel type is adopted, and the payload format information of the tunnel data packet is RTP protocol data packet/RTCP protocol data.
  • the packet is added with the UDP header as the payload of the DTLS tunnel packet.
  • the candidate attribute line in the SDP message is extended, and the identifier bit is added, and the path describing the candidate is the tunnel type and the payload format information of the tunnel data packet.
  • a host candidate: ⁇ existing protocol parameter> ⁇ tunnel type> ⁇ load format information of tunnel packet>.
  • Step 609 The VoIP signaling server receives the SDP message sent by the user terminal, and determines the default port number 3478 of the STUN protocol as the DTLS tunnel network side when determining the firewall traversed by the DTLS tunnel mode according to the tunnel type included in the SDP message. Port.
  • the VoIP signaling server generates an authentication parameter that the user terminal authenticates the media gateway during the handshake negotiation process of establishing the DTLS transmission tunnel.
  • the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
  • the VoIP signaling server sends the port number of the DTLS tunnel network side and the authentication parameter for establishing the tunnel to the user terminal through the SDP response message.
  • the VoIP signaling server sends the network format port of the DTLS tunnel and the payload format information of the tunnel data packet to the media gateway.
  • Step 610 The user terminal and the media gateway negotiate to establish a DTLS transmission tunnel between the port number of the DTLS client on the user terminal side and the port number on the network side according to the existing DTLS protocol.
  • the user terminal authenticates the media gateway, because after the DTLS transmission tunnel is established according to the existing ICE protocol, the user The terminal sends a STUN connectivity detection request through the DTLS transmission tunnel.
  • the media gateway authenticates the user terminal by using an ICE short-term credential mechanism.
  • the so-called short-term credential is actually using the STUN account password carried by the user terminal to send the STUN connectivity detection request for authentication.
  • the firewall obtained by the media gateway is the public network address allocated by the tunnel client in the user terminal and the private address of the tunnel client sent by the VoIP signaling server, and the private address of the user terminal and the public network address assigned by the firewall are established.
  • Step 611 The user terminal sends a STUN connectivity check request through the DTLS transmission tunnel. After receiving the STUN connectivity detection response, the user terminal is notified by the update SDP offer message to determine that the DTLS transmission tunnel is used to traverse the firewall.
  • Step 612 The user terminal receives a data packet of a media that is encapsulated by the network side through the established DTLS tunnel and encapsulated according to the payload format information of the tunnel data packet.
  • step 612 the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is a DTLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS as the payload format information of the tunnel packet corresponding to the DTLS tunnel type.
  • the tunnel packet In the tunnel packet.
  • the user terminal and the media gateway transmit the tunnel through DTLS according to the encapsulation format of FIG. RTP/RTCP over UDP protocol packets are sent to the peer.
  • Embodiment 5 is a diagrammatic representation of Embodiment 5:
  • FIG. 7 is a schematic structural diagram of a media transmission device according to Embodiment 5 of the present invention.
  • the media transmission device includes: a type determining module 71, a tunnel establishing module 72, and a data packet receiving module 73, where:
  • the type determining module 71 is configured to determine, according to the detection result of the network address translation session transmission application STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer security.
  • a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer security.
  • the tunnel establishment module 72 is configured to allocate, according to the determined tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and use the tunnel type, the first port number, and the tunnel data.
  • the load format information of the packet is sent to the network side, so that the network side allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, where the first port number and the second port number are Establish a transmission tunnel between them;
  • the data packet receiving module 73 is configured to receive, by the network side, the data packet of the media encapsulated according to the load format information of the tunnel data packet that is transmitted by using the established tunnel.
  • the tunnel establishment module 72 sends the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, specifically for:
  • the transmission tunnel corresponding to the tunnel type allocates a second port number on the network side, and sends the second port number to the media gateway and the user terminal;
  • a transmission tunnel is established between the first port number and the second port number by negotiating with the media gateway.
  • the type determining module 71 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for:
  • the tunnel type for the transport tunnel traversing the firewall for the media to be transmitted is the TLS tunnel type.
  • the tunnel establishment module 72 establishes a transmission tunnel between the first port number and the second port number, specifically for:
  • the user terminal If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
  • the type determining module 71 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for:
  • the STUN connectivity detection request of the media path is further sent to the media port corresponding to the media gateway by the media port of the user terminal, where the STUN connectivity detection request is used to determine Whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
  • the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a DTLS tunnel type.
  • the tunnel establishment module 72 establishes a transmission tunnel that includes the first port number and the second port number, specifically for:
  • the user terminal If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
  • the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is a TLS tunnel type
  • the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet;
  • the tunnel type is a DTLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
  • the port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
  • the media transmission device further includes: a parsing module 74, where:
  • the parsing module 74 is configured to decapsulate the received media data packet, and obtain a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
  • the media transmission device in the fifth embodiment of the present invention may be implemented in a hardware manner or in a software manner, which is not limited herein.
  • FIG. 8 is a schematic structural diagram of a media transmission device according to Embodiment 6 of the present invention.
  • the media transmission device has the functions of the first embodiment of the present invention to the fourth embodiment of the present invention.
  • the media transmission device may adopt a general computer system structure, and the computer system may be a processor-based computer.
  • the media transport device entity includes at least one processor 81, a communication bus 82, a memory 83, and at least one communication interface 84.
  • the processor 81 can be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present invention.
  • CPU central processing unit
  • ASIC application-specific integrated circuit
  • the communication bus 82 can include a path for transferring information between the components.
  • the communication interface 84 using any device such as a transceiver, for communicating with other devices or communication networks, Such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.
  • RAN Radio Access Network
  • WLAN Wireless Local Area Networks
  • the memory 83 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM), or other information that can store information and instructions.
  • ROM read-only memory
  • RAM random access memory
  • Type of dynamic storage device or Electrostatic Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, optical disc Storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other medium accessed by the computer, but is not limited to this.
  • EEPROM Electrostatic Erasable Programmable Read-Only Memory
  • CD-ROM Compact Disc Read-Only Memory
  • optical disc Storage including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.
  • the memory 83 is used to store application code for executing the solution of the present invention, and the application code for executing the solution of the present invention is stored in a memory and controlled by the processor 81 for execution.
  • the processor 81 is configured to execute an application stored in the memory 83.
  • a tunnel type for a transmission tunnel traversing the firewall for the medium to be transmitted where the tunnel type includes at least a transport layer secure TLS tunnel type and datagram transmission.
  • the tunnel type includes at least a transport layer secure TLS tunnel type and datagram transmission.
  • the network side is configured to allocate a second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and establish a transmission tunnel between the first port number and the second port number;
  • the processor 81 sends the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, specifically for performing:
  • the tunnel type is a second port number of the network side of the transmission tunnel corresponding to the tunnel type, and the second port number is sent to the media gateway and the user terminal;
  • the user terminal establishes a transmission tunnel between the first port number and the second port number by negotiating with the media gateway.
  • the processor 81 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for performing:
  • the user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting real-time transmission. Controlling the public address of the port assignment of the protocol RTCP packet;
  • the user terminal When the user terminal cannot receive the address collection response of the UDP bearer returned by the STUN server, it determines that the tunnel type of the transport tunnel for traversing the firewall for the media to be transmitted is the TLS tunnel type.
  • the processor 81 establishes a transmission tunnel between the first port number and the second port number, specifically for performing:
  • the user terminal If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
  • the processor 81 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for performing:
  • the user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting the real-time transmission protocol.
  • the user terminal When receiving the address collection response returned by the STUN server, the user terminal further sends a STUN connectivity detection request of the media path to the media port corresponding to the media gateway by using the media port of the user terminal, where the STUN connectivity detection is performed. Determining whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
  • the user terminal determines that the tunnel type of the transmission tunnel for traversing the firewall is the DTLS tunnel type.
  • the processor 81 establishes a transmission tunnel that includes the first port number and the second port number, specifically for performing:
  • the user terminal If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
  • the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
  • the tunnel type is a TLS tunnel type
  • the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet;
  • the tunnel type is a DTLS tunnel type
  • the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
  • the port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
  • the processor 81 is further configured to decapsulate the received media data packet to obtain a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
  • the packet in the UDP protocol packet header The port number included, the data packet of the media is sent to the media processing unit.
  • embodiments of the present invention can be provided as a method, apparatus (device), or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed are a media transmission method and device. The method comprises: a user terminal determines, according to a STUN detection result, the tunnel type of a transmission tunnel to be established for media to be transmitted to traverse firewalls, assigns, according to the determined tunnel type, a first port number of the user terminal side to a transmission tunnel corresponding to the tunnel type, and sends the tunnel type, the first port number and payload format information of a tunnel data packet to a network side, so that the network side assigns, according to the tunnel type, a second port number of the network side to the transmission tunnel corresponding to the tunnel type and establishes a transmission tunnel between the first port number and the second port number; and receives a data packet of the media that is transmitted by the network side through the established transmission tunnel and that is encapsulated according to the payload format information of the tunnel data packet, which not only can traverse all types of firewalls but also effectively improves the media transmission efficiency.

Description

一种媒体传输方法和设备Media transmission method and device
本申请要求了2014年11月7日提交的、申请号为201410623767.X、发明名称为“一种媒体传输方法和设备”的中国申请的优先权,以及2014年10月31日提交的、申请号为201410616529.6、发明名称为“一种媒体传输方法和设备”的中国申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese application filed on November 7, 2014 with application number 201410623767.X, the invention name is "a media transmission method and equipment", and the application filed on October 31, 2014. The priority of the Chinese Patent Application No. 201410616529.6, entitled "A Media Transmission Method and Apparatus", the entire contents of which is incorporated herein by reference.
技术领域Technical field
本发明涉及IP通信技术领域,尤其涉及一种媒体传输方法和设备。The present invention relates to the field of IP communication technologies, and in particular, to a media transmission method and device.
背景技术Background technique
在VoIP(Voice ove IP;IP承载语音)通信系统中,语音数据和视频媒体数据通常采用RTP(Real-Time Transport Protocol;实时传输协议)进行实时传输,并使用RTCP(Real-Time Transport Control Protocol;实时传输控制协议)对RTP数据包提供可靠性传输管理机制。RTP数据包和RTCP数据包依靠用户数据协议(User Datagram Protocol;UDP)传输。而在RTP数据包和RTCP数据包分别采用不同的端口传输时,要求用于传输RTCP数据包的UDP端口号比用于传输RTP数据包的UDP端口号大1、且用于传输RTCP数据包的UDP端口号为奇数。In a VoIP (Voice ove IP) communication system, voice data and video media data are usually transmitted in real time using RTP (Real-Time Transport Protocol), and RTCP (Real-Time Transport Control Protocol; The Real-Time Transport Control Protocol) provides a reliable transport management mechanism for RTP packets. RTP packets and RTCP packets are transmitted by User Datagram Protocol (UDP). When the RTP data packet and the RTCP data packet are respectively transmitted by different ports, the UDP port number required for transmitting the RTCP data packet is larger than the UDP port number used for transmitting the RTP data packet, and is used for transmitting the RTCP data packet. The UDP port number is an odd number.
在企业网或者局域网应用场景中,出于网络安全方面的考虑,企业网或者局域网与公网之间部署防火墙。防火墙除了提供网络地址转换之外,还常常会对允许通过的报文类型和开放的端口范围进行限制。在实际应用中,由于防火墙的限制,导致RTP数据包和RTCP数据包不能正常进行。In the enterprise network or LAN application scenario, for the sake of network security, a firewall is deployed between the enterprise network or the local area network and the public network. In addition to providing network address translation, firewalls often limit the types of packets allowed and the range of open ports. In practical applications, RTP packets and RTCP packets cannot be performed normally due to firewall limitations.
因此在VoIP客户端与网络侧之间VoIP通信时,需要具备穿越防火墙的能力。对于如何穿越防火墙的问题,提出了几种不同的穿越方式。Therefore, when VoIP communication between the VoIP client and the network side, it is necessary to have the ability to traverse the firewall. Several different ways of traversing are proposed for how to traverse the firewall.
例如:交互式连接建立(Interactive Connectivity Establishment;ICE)是一个协议族,包含STUN(Session Traversal Utilities for NAT,网络地址转换会话 传输应用程序)协议、TURN(Traversal Using Relay Network Address Translation;通过Relay方式穿越NAT)协议,用于解决各种NAT穿越问题。For example, Interactive Connectivity Establishment (ICE) is a protocol family that includes STUN (Session Traversal Utilities for NAT). The transmission application protocol, TURN (Traversal Using Relay Network Address Translation) protocol, is used to solve various NAT traversal problems.
在采用ICE/STUN协议穿越防火墙时,可以将通信双方用于传输RTP数据包和RTCP数据包的端口复用在同一个端口上,也就是说媒体网关将RTP/RTCP的端口固定地分配为80,媒体流以RTP/RTCP over TCP的形式从防火墙的443或80端口穿越。这样虽然能够支持VoIP通信中的媒体流和信令分离传输、且使用标准的ICE客户端,但是在实际应用中,这种方式只能保证穿越部分防火墙,例如:具有HTTP(Hyper Text Transport Protocol,超文本传输协议)代理功能的防火墙就无法穿越。因为具有HTTP代理功能的防火墙只允许HTTP类型的报文通过,具有HTTP代理功能的防火墙能够识别出IP(Internetwork Protocol,网际协议)包承载的上层协议数据包是不是HTTP协议数据包,如果不是HTTP协议数据包,则直接丢弃数据包。而采用RTCP/RTP协议数据包复用同一个端口,利用TCP(Transmission Control Protocol,传输控制协议)连接方式穿越防火墙时,具有HTTP代理功能防火墙容易识别该数据包为非HTTP数据包而丢弃,造成媒体的数据包无法穿越防火墙。When the ICE/STUN protocol is used to traverse the firewall, the ports used by the communication parties to transmit RTP data packets and RTCP data packets can be multiplexed on the same port, that is, the media gateway fixedly allocates the RTP/RTCP ports to 80. The media stream traverses from the 443 or 80 port of the firewall in the form of RTP/RTCP over TCP. In this way, although it can support media stream and signaling separation transmission in VoIP communication, and use a standard ICE client, in practice, this method can only guarantee to traverse part of the firewall, for example, has HTTP (Hyper Text Transport Protocol, Hypertext Transfer Protocol) The proxy function of the firewall cannot be traversed. Because the firewall with the HTTP proxy function only allows HTTP-type packets to pass, the firewall with the HTTP proxy function can identify whether the upper-layer protocol packets carried by the IP (Internetwork Protocol) packet are HTTP protocol packets, if not HTTP. Protocol packets, which directly drop packets. When the RTCP/RTP protocol packet is used to multiplex the same port and the TCP (Transmission Control Protocol) connection is used to traverse the firewall, the HTTP proxy function firewall can easily identify the packet as a non-HTTP packet and discard it. Media packets cannot traverse the firewall.
进一步地,提出了ICE/TURN解决方案,在VoIP客户端与网络侧之间部署TURN服务器作为媒体中继服务器,TURN服务器除了支持从协议默认端口3478端口接收终端发送的TURN请求之外,还支持从443端口和80端口接收TURN请求。媒体通过RTP/RTCP over UDP over TURN over TCP方式从80端口,或者通过RTP/RTCP over UDP over TURN over TLS方式从443穿越防火墙,达到TURN服务器,由TURN服务器将媒体转发给对端。Further, an ICE/TURN solution is proposed, in which a TURN server is deployed between the VoIP client and the network side as a media relay server, and the TURN server supports the TURN request sent by the terminal from the protocol default port 3478 port. Receive TURN requests from ports 443 and 80. The media traverses the firewall from the 443 through the RTP/RTCP over UDP over TURN over TCP method, or through the RTP/RTCP over UDP over TURN over TLS mode to reach the TURN server, and the TURN server forwards the media to the peer end.
这种方式虽然能够解决穿越所有防火墙的问题,但是依然存在以下问题:Although this method can solve the problem of crossing all firewalls, the following problems still exist:
1、系统中增加TURN服务器,造成媒体的数据包传输时延;1. The TURN server is added to the system, causing the data packet transmission delay of the media;
2、在媒体的数据包传输过程中,媒体的数据包封装次数过多,出现媒体的数据包的报头封装冗余,影响媒体传输效率;2. In the process of data packet transmission of the media, the number of data packets encapsulated by the media is too many, and the header of the media data packet is redundant, which affects the efficiency of media transmission;
3、TURN服务器和用户终端之间的TURN握手信令复杂,且每一个媒体 都要进行单独握手协商建立中继通道,增加了媒体的数据包传输复杂度。3. TURN handshake signaling between the TURN server and the user terminal is complex, and each media A separate handshake negotiation is required to establish a relay channel, which increases the complexity of data packet transmission of the medium.
发明内容Summary of the invention
有鉴于此,本发明实施例提供了一种媒体传输方法和设备,用于解决目前VoIP通信系统的媒体在穿越防火墙的过程中存在的传输复杂以及传输效率低等问题。In view of this, the embodiments of the present invention provide a media transmission method and device, which are used to solve the problems of complex transmission and low transmission efficiency of the media of the current VoIP communication system in the process of traversing the firewall.
根据本发明的第一方面,提供了一种媒体传输方法,包括:According to a first aspect of the present invention, a media transmission method is provided, comprising:
用户终端根据网络地址转换会话传输应用程序STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,其中,所述隧道类型至少包含了传输层安全TLS隧道类型、数据报传输层安全DTLS隧道类型中的一种或者多种;The user terminal determines, according to the detection result of the network address translation session transmission application STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer secure TLS tunnel type and data. Reporting one or more of the transport layer security DTLS tunnel types;
所述用户终端根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;The user terminal allocates a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type according to the determined tunnel type, and loads the tunnel type, the first port number, and the tunnel data packet. The format information is sent to the network side, so that the network side allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and establishes between the first port number and the second port number. Transmission tunnel
所述用户终端接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。Receiving, by the user terminal, a data packet of a media encapsulated according to the load format information of the tunnel data packet that is transmitted by the network side through the established transmission tunnel.
结合本发明的第一方面可能的实施方式,在第一种可能的实施方式中,所述用户终端将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,包括:With reference to a possible implementation manner of the first aspect of the present invention, in a first possible implementation, the user terminal sends the tunnel type, the first port number, and payload format information of a tunnel data packet to a network side. ,include:
所述用户终端将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息携带在会话描述协议SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,并将所述第二端口号发送给媒体网关和所述用户终端; Transmitting, by the user terminal, the tunnel type, the first port number, and the load format information of the tunnel data packet in a session description protocol SDP message to the IP bearer voice VoIP signaling server, where the VoIP signaling server is configured according to the The tunnel type is a second port number of the network side of the transmission tunnel corresponding to the tunnel type, and the second port number is sent to the media gateway and the user terminal;
所述用户终端通过与所述媒体网关协商,在所述第一端口号和所述第二端口号之间建立传输隧道。The user terminal establishes a transmission tunnel between the first port number and the second port number by negotiating with the media gateway.
结合本发明的第一方面可能的实施方式,或者结合本发明的第一方面的第一种可能的实施方式,在第二种可能的实施方式中,所述用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,包括:With reference to the possible implementation manners of the first aspect of the present invention, or the first possible implementation manner of the first aspect of the present invention, in the second possible implementation manner, the user terminal determines according to the detection result of the STUN Establish a tunnel type for the transport tunnel to traverse the firewall for the media to be transmitted, including:
所述用户终端向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;The user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting real-time transmission. Controlling the public address of the port assignment of the protocol RTCP packet;
所述用户终端在无法接收到STUN服务器返回的由UDP承载的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。When the user terminal cannot receive the address collection response of the UDP bearer returned by the STUN server, it determines that the tunnel type of the transport tunnel for traversing the firewall for the media to be transmitted is the TLS tunnel type.
结合本发明的第一方面可能的实施方式,或者结合本发明的第一方面的第一种可能的实施方式,或者结合本发明的第一方面的第二种可能的实施方式,在第三种可能的实施方式中,所述用户终端在所述第一端口号和所述第二端口号之间建立传输隧道,具体包括:In conjunction with a possible embodiment of the first aspect of the invention, or a first possible embodiment of the first aspect of the invention, or a second possible embodiment of the first aspect of the invention, in the third In a possible implementation manner, the user terminal establishes a transmission tunnel between the first port number and the second port number, and specifically includes:
若所述用户终端确定的隧道类型为TLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立TLS隧道。If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
结合本发明的第一方面可能的实施方式,或者结合本发明的第一方面的第一种可能的实施方式,在第四种可能的实施方式中,用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,包括:With reference to the possible implementation manners of the first aspect of the present invention, or the first possible implementation manner of the first aspect of the present invention, in the fourth possible implementation manner, the user terminal determines to wait according to the detection result of the STUN. The transmitted media establishes the tunnel type for the transport tunnel that traverses the firewall, including:
用户终端向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公 用地址;The user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol. Port assignment of RTCP packets Use address
所述用户终端在接收到STUN服务器返回的地址收集响应时,进一步通过所述用户终端的媒体端口向媒体网关对应的媒体端口发送媒体路径的STUN连通性检测请求,其中,所述STUN连通性检测请求用以确定用户终端发送的媒体的数据包是否可以直接到达所述媒体网关对应的媒体端口;When receiving the address collection response returned by the STUN server, the user terminal further sends a STUN connectivity detection request of the media path to the media port corresponding to the media gateway by using the media port of the user terminal, where the STUN connectivity detection is performed. Determining whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
所述用户终端在尚未接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。When the user terminal has not received the STUN connectivity detection response sent by the media gateway, the user terminal determines that the tunnel type of the transmission tunnel for traversing the firewall is the DTLS tunnel type.
结合本发明的第一方面可能的实施方式,或者结合本发明的第一方面的第一种可能的实施方式,或者结合本发明的第一方面的第四种可能的实施方式,在第五种可能的实施方式中,所述用户终端建立包含了所述第一端口号和所述第二端口号的传输隧道,具体包括:In conjunction with a possible embodiment of the first aspect of the invention, or a first possible embodiment of the first aspect of the invention, or a fourth possible embodiment of the first aspect of the invention, in the fifth In a possible implementation manner, the user terminal establishes a transmission tunnel that includes the first port number and the second port number, and specifically includes:
若所述用户终端确定的隧道类型为DTLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立DTLS隧道。If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
结合本发明的第一方面可能的实施方式,或者结合本发明的第一方面的第一种可能的实施方式,或者结合本发明的第一方面的第二种可能的实施方式,或者结合本发明的第一方面的第三种可能的实施方式,或者结合本发明的第一方面的第四种可能的实施方式,或者结合本发明的第一方面的第五种可能的实施方式,在第六种可能的实施方式中,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:In conjunction with a possible embodiment of the first aspect of the invention, or a first possible embodiment of the first aspect of the invention, or a second possible embodiment of the first aspect of the invention, or in combination with the invention A third possible implementation of the first aspect, or a fourth possible implementation of the first aspect of the invention, or a fifth possible implementation of the first aspect of the invention, in the sixth In a possible implementation manner, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
若隧道类型为TLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在TLS隧道数据包中;或If the tunnel type is a TLS tunnel type, the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet; or
若隧道类型为DTLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在DTLS隧道数据包中。 If the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
结合本发明的第一方面的第六种可能的实施方式,在第七种可能的实施方式中,所述UDP协议数据包报头中包含的端口号分别为所述用户终端分配的媒体端口、所述媒体网关分配的媒体端口。With reference to the sixth possible implementation manner of the first aspect of the present invention, in a seventh possible implementation, the port number included in the UDP protocol packet header is respectively a media port and a location allocated by the user terminal. The media port assigned by the media gateway.
结合本发明的第一方面的第六种可能的实施方式,或者结合本发明的第一方面的第七种可能的实施方式,在第八种可能的实施方式中,所述媒体传输方法还包括:With reference to the sixth possible implementation manner of the first aspect of the present invention, or the seventh possible implementation manner of the first aspect of the present invention, in the eighth possible implementation manner, the media transmission method further includes :
所述用户终端对接收到的所述媒体数据包进行解封装,获取TLS隧道数据包/DTLS隧道数据包中的媒体的数据包;The user terminal decapsulates the received media data packet, and acquires a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
根据所述TLS隧道数据包/DTLS隧道数据包中UDP协议数据包报头中包含的端口号,将所述媒体的数据包发送给媒体处理单元。And transmitting, according to the port number included in the UDP protocol packet header in the TLS tunnel data packet/DTLS tunnel data packet, the data packet of the media to the media processing unit.
根据本发明的第二方面,提供了一种媒体传输设备,包括:According to a second aspect of the present invention, a media transmission device is provided, comprising:
类型确定模块,用于根据网络地址转换会话传输应用程序STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,其中,所述隧道类型至少包含了传输层安全TLS隧道类型、数据报传输层安全DTLS隧道类型中的一种或者多种;a type determining module, configured to determine, according to a detection result of the network address translation session transmission application STUN, a tunnel type for a transmission tunnel traversing a firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer security TLS One or more of tunnel type, datagram transport layer security DTLS tunnel type;
隧道建立模块,用于根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;a tunnel establishment module, configured to allocate, according to the determined tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and the tunnel type, the first port number, and the tunnel data packet The load format information is sent to the network side, so that the network side allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, where the first port number and the second port number are Establish a transmission tunnel;
数据包接收模块,用于接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。And a data packet receiving module, configured to receive, by the network side, a data packet of the media encapsulated according to the load format information of the tunnel data packet that is transmitted by using the established transmission tunnel.
结合本发明的第二方面可能的实施方式,在第一种可能的实施方式中,所述隧道建立模块将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,具体用于:With reference to a possible implementation manner of the second aspect of the present invention, in a first possible implementation, the tunnel establishment module sends the tunnel type, the first port number, and load format information of a tunnel data packet to a network. Side, specifically for:
将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息携带在会 话描述协议SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,并将所述第二端口号发送给媒体网关和所述用户终端;Carrying the tunnel type, the first port number, and the load format information of the tunnel data packet at the conference The voice description protocol SDP message is sent to the IP bearer voice VoIP signaling server, and the VoIP signaling server allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and the second port number is The port number is sent to the media gateway and the user terminal;
通过与所述媒体网关协商,在所述第一端口号和所述第二端口号之间建立传输隧道。A transmission tunnel is established between the first port number and the second port number by negotiating with the media gateway.
结合本发明的第二方面可能的实施方式,或者结合本发明的第二方面的第一种可能的实施方式,在第二种可能的实施方式中,所述类型确定模块根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于:In conjunction with the possible implementation of the second aspect of the present invention, or in combination with the first possible implementation of the second aspect of the present invention, in the second possible implementation, the type determining module is based on the detection result of the STUN. Determining the tunnel type for the transport tunnel to traverse the firewall for the media to be transmitted, specifically for:
向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;Sending an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol RTCP data. The public address of the port assignment of the packet;
在无法接收到STUN服务器返回的由UDP承载的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。When the UDP bearer address collection response returned by the STUN server cannot be received, it is determined that the tunnel type for the transport tunnel traversing the firewall for the media to be transmitted is the TLS tunnel type.
结合本发明的第二方面可能的实施方式,或者结合本发明的第二方面的第一种可能的实施方式,或者结合本发明的第二方面的第二种可能的实施方式,在第三种可能的实施方式中,所述隧道建立模块在所述第一端口号和所述第二端口号之间建立传输隧道,具体用于:In conjunction with a possible embodiment of the second aspect of the invention, or a first possible embodiment of the second aspect of the invention, or a second possible embodiment of the second aspect of the invention, in the third In a possible implementation, the tunnel establishment module establishes a transmission tunnel between the first port number and the second port number, specifically for:
若所述用户终端确定的隧道类型为TLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立TLS隧道。If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
结合本发明的第二方面可能的实施方式,或者结合本发明的第二方面的第一种可能的实施方式,在第四种可能的实施方式中,所述类型确定模块根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于:In conjunction with the possible implementation of the second aspect of the present invention, or in combination with the first possible implementation of the second aspect of the present invention, in a fourth possible implementation, the type determining module is based on the detection result of the STUN. Determining the tunnel type for the transport tunnel to traverse the firewall for the media to be transmitted, specifically for:
向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包 的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;Sending an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet Port and a public address for the port assignment of the Real-Time Transport Control Protocol RTCP packet;
在接收到STUN服务器返回的地址收集响应时,进一步通过所述用户终端的媒体端口向媒体网关对应的媒体端口发送媒体路径的STUN连通性检测请求,其中,所述STUN连通性检测请求用以确定用户终端发送的媒体的数据包是否可以直接到达所述媒体网关对应的媒体端口;Upon receiving the address collection response returned by the STUN server, the STUN connectivity detection request of the media path is further sent to the media port corresponding to the media gateway by the media port of the user terminal, where the STUN connectivity detection request is used to determine Whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
在尚未接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。When the STUN connectivity detection response sent by the media gateway has not been received, it is determined that the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a DTLS tunnel type.
结合本发明的第二方面可能的实施方式,或者结合本发明的第二方面的第一种可能的实施方式,或者结合本发明的第二方面的第四种可能的实施方式,在第五种可能的实施方式中,所述隧道建立模块建立包含了所述第一端口号和所述第二端口号的传输隧道,具体用于:In conjunction with a possible embodiment of the second aspect of the invention, or a first possible embodiment of the second aspect of the invention, or a fourth possible embodiment of the second aspect of the invention, in the fifth In a possible implementation, the tunnel establishment module establishes a transmission tunnel that includes the first port number and the second port number, specifically for:
若所述用户终端确定的隧道类型为DTLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立DTLS隧道。If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
结合本发明的第二方面可能的实施方式,或者结合本发明的第二方面的第一种可能的实施方式,或者结合本发明的第二方面的第二种可能的实施方式,或者结合本发明的第二方面的第三种可能的实施方式,或者结合本发明的第二方面的第四种可能的实施方式,或者结合本发明的第二方面的第五种可能的实施方式,在第六种可能的实施方式中,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:In conjunction with a possible embodiment of the second aspect of the invention, or a first possible embodiment of the second aspect of the invention, or a second possible embodiment of the second aspect of the invention, or in combination with the invention A third possible implementation of the second aspect, or a fourth possible implementation of the second aspect of the invention, or a fifth possible implementation of the second aspect of the invention, in the sixth In a possible implementation manner, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
若隧道类型为TLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在TLS隧道数据包中;或If the tunnel type is a TLS tunnel type, the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet; or
若隧道类型为DTLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在DTLS隧道数据包中。If the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
结合本发明的第二方面的第六种可能的实施方式,在第七种可能的实施方 式中,所述UDP协议数据包报头中包含的端口号分别为所述用户终端分配的媒体端口、所述媒体网关分配的媒体端口。In conjunction with the sixth possible implementation of the second aspect of the invention, in a seventh possible implementation The port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
结合本发明的第二方面的第六种可能的实施方式,或者结合本发明的第二方面的第七种可能的实施方式,在第八种可能的实施方式中,所述媒体传输设备还包括:解析模块,其中:With reference to the sixth possible implementation manner of the second aspect of the present invention, or the seventh possible implementation manner of the second aspect of the present invention, in the eighth possible implementation manner, the media transmission device further includes : Parsing module, where:
所述解析模块,用于对接收到的所述媒体数据包进行解封装,获取TLS隧道数据包/DTLS隧道数据包中的媒体的数据包;The parsing module is configured to decapsulate the received media data packet, and obtain a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
根据所述TLS隧道数据包/DTLS隧道数据包中UDP协议数据包报头中包含的端口号,将所述媒体的数据包发送给媒体处理单元。And transmitting, according to the port number included in the UDP protocol packet header in the TLS tunnel data packet/DTLS tunnel data packet, the data packet of the media to the media processing unit.
本发明有益效果如下:The beneficial effects of the present invention are as follows:
本发明实施例用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。这样IP数据包在穿越防火墙时,防火墙无法获知上层协议数据包类型,同时本发明实施例的方式在不增加额外网元和节点的情形下,直接与媒体网关之间建立传输隧道,不仅能够穿越所有类型的防火墙,而且有效地避免了媒体传输中出现的时延问题,提升了媒体传输效率。In the embodiment of the present invention, the user terminal determines, according to the detection result of the STUN, the tunnel type of the transmission tunnel used to traverse the firewall for the media to be transmitted, and allocates the user terminal to the transmission tunnel corresponding to the tunnel type according to the determined tunnel type. a first port number of the side, and sending the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, so that the network side is the transmission tunnel corresponding to the tunnel type according to the tunnel type. Allocating a second port number on the network side, establishing a transmission tunnel between the first port number and the second port number; receiving the tunnel data packet that is transmitted by the network side through the established transmission tunnel The payload format information encapsulates the packets of the media. In this way, when the IP data packet traverses the firewall, the firewall cannot know the type of the upper layer protocol packet, and the method of the embodiment of the present invention directly establishes a transmission tunnel with the media gateway without adding additional network elements and nodes, which can not only traverse All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提 下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention, A person of ordinary skill in the art, without premise of creative labor Further drawings can also be obtained from these figures.
图1为本发明实施例一提供的一种媒体传输方法的流程示意图;FIG. 1 is a schematic flowchart diagram of a media transmission method according to Embodiment 1 of the present invention;
图2为穿越防火墙时TLS隧道数据包格式的示意图;2 is a schematic diagram of a TLS tunnel data packet format when traversing a firewall;
图3为穿越防火墙时DTLS隧道数据包格式的示意图;3 is a schematic diagram of a DTLS tunnel data packet format when traversing a firewall;
图4为本发明实施例二提供的一种媒体传输方法的流程示意图;4 is a schematic flowchart of a media transmission method according to Embodiment 2 of the present invention;
图5为本发明实施例三提供的一种媒体传输方法的流程示意图;FIG. 5 is a schematic flowchart diagram of a media transmission method according to Embodiment 3 of the present invention;
图6为本发明实施例四提供的一种媒体传输方法的流程示意图;FIG. 6 is a schematic flowchart diagram of a media transmission method according to Embodiment 4 of the present invention;
图7为本发明实施例五提供的一种媒体传输设备的结构示意图;FIG. 7 is a schematic structural diagram of a media transmission device according to Embodiment 5 of the present invention;
图8为本发明实施例六提供的一种媒体传输设备的结构示意图。FIG. 8 is a schematic structural diagram of a media transmission device according to Embodiment 6 of the present invention.
具体实施方式detailed description
为了实现本发明的目的,本发明实施例提供了一种媒体传输方法和设备,用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷(英文:Payload)格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。这样IP数据包在穿越防火墙时,防火墙无法获知上层协议数据包类型,同时本发明实施例的方式在不增加额外网元和节点的情形下,直接与媒体网关之间建立传输隧道,不仅能够穿越所有类型的防火墙,而且有效地避免了媒体传输中出现的时延问题,提升了媒体传输效率。In order to achieve the object of the present invention, an embodiment of the present invention provides a media transmission method and device. The user terminal determines, according to the detection result of the STUN, a tunnel type for a transmission tunnel traversing a firewall for the media to be transmitted, according to the determined Assigning, by the tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and storing the tunnel type, the first port number, and the payload of the tunnel data packet (English: Payload) format information Sending to the network side, the network side allocates a second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and establishes a transmission tunnel between the first port number and the second port number. Receiving, by the network side, the data packet of the media encapsulated according to the payload format information of the tunnel data packet transmitted by the established transmission tunnel. In this way, when the IP data packet traverses the firewall, the firewall cannot know the type of the upper layer protocol packet, and the method of the embodiment of the present invention directly establishes a transmission tunnel with the media gateway without adding additional network elements and nodes, which can not only traverse All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
需要说明的是,本发明实施例中描述的媒体的数据包包括:RTP数据包和/或RTCP数据包。It should be noted that the data packet of the media described in the embodiment of the present invention includes: an RTP data packet and/or an RTCP data packet.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以 存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。The term "and/or" in this article is merely an association describing the associated object, indicating that There are three kinds of relationships, for example, A and/or B, which can indicate that there are three cases in which A exists separately, and A and B exist simultaneously, and B exists alone. In addition, the character "/" in this article generally indicates that the contextual object is an "or" relationship.
下面结合说明书附图对本发明各个实施例作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。The embodiments of the present invention are further described in detail below with reference to the accompanying drawings. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
实施例一:Embodiment 1:
如图1所示,为本发明实施例一提供的一种媒体传输方法的流程示意图。所述方法可以如下所述。FIG. 1 is a schematic flowchart diagram of a media transmission method according to Embodiment 1 of the present invention. The method can be as follows.
步骤101:用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型。Step 101: The user terminal determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted.
其中,所述隧道类型至少包含了传输层安全(Transport Layer Security;TLS)隧道类型、数据报传输层安全(Datagram Transport Layer Security;DTLS)隧道类型中的一种或者多种。The tunnel type includes at least one of a transport layer security (TLS) tunnel type and a datagram transport layer security (DTLS) tunnel type.
在步骤101中,用户终端发起VoIP会话,运行ICE客户端,从而启动ICE/STUN穿越防火墙流程。In step 101, the user terminal initiates a VoIP session and runs the ICE client to initiate the ICE/STUN traversal firewall process.
用户终端为待传输的RTP数据包和RTCP数据包随机分配一对端口号P1和P2,其中,RTP端口号数为偶数,且比RTCP的端口号小1。The user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted, wherein the RTP port number is an even number and is one less than the port number of the RTCP.
用户终端向STUN服务器发送地址收集请求。The user terminal sends an address collection request to the STUN server.
其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址。The address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
需要说明的是,用户终端向STUN服务器发送由UDP(User Datagram Protocol,用户数据包协议)承载的地址收集请求。It should be noted that the user terminal sends an address collection request carried by the UDP (User Datagram Protocol) to the STUN server.
具体地,用户终端分别通过P1端口和P2端口向STUN服务器发送由UDP 承载的地址分配请求(即STUN allocate)或者STUN绑定请求(即STUN Binding)(在本发明中,为了叙述方便,STUN地址分配请求和STUN绑定请求可以被统称为地址收集请求)。Specifically, the user terminal sends the UDP to the STUN server through the P1 port and the P2 port respectively. The bearer address allocation request (ie STUN allocate) or the STUN bind request (ie STUN Binding) (in the present invention, for convenience of description, the STUN address allocation request and the STUN binding request may be collectively referred to as an address collection request).
STUN服务器获取该地址收集请求的源地址,该源地址即防火墙为发送地址收集请求的用户终端的端口分配的公网地址,STUN服务器通过地址收集响应将该公网地址发送给用户终端,使得用户终端获知防火墙为其端口分配的公网地址。The STUN server obtains the source address of the address collection request. The source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request. The STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
情形一:Situation 1:
由于用户终端发送的地址收集请求由UDP承载、STUN服务器向用户终端发送的地址收集响应也由UDP承载,一旦防火墙限制UDP数据包通过、或者防火墙端口3478(STUN默认的协议端口)没有开放,防火墙将用户终端发送的地址收集请求丢弃,使得STUN服务器无法接收到用户终端发送的地址收集请求,用户终端也无法接收到STUN服务器发送的地址收集响应。The address collection response sent by the user terminal by the UDP bearer and the STUN server to the user terminal is also carried by the UDP. Once the firewall restricts the UDP packet from passing, or the firewall port 3478 (the default protocol port of the STUN) is not open, the firewall The address collection request sent by the user terminal is discarded, so that the STUN server cannot receive the address collection request sent by the user terminal, and the user terminal cannot receive the address collection response sent by the STUN server.
此时,用户终端确定防火墙禁止VoIP媒体传输,需要为待传输的媒体建立用于穿越防火墙的传输隧道。At this time, the user terminal determines that the firewall prohibits VoIP media transmission, and needs to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
在这种情形下,用户终端确定防火墙限制传输UDP数据包,需要为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。In this case, the user terminal determines that the firewall restricts the transmission of the UDP data packet, and the tunnel type that needs to establish a transmission tunnel for the medium to be transmitted for traversing the firewall is a TLS tunnel type.
情形二:Case 2:
由于STUN服务器返回的由UDP承载的地址收集响应,若防火墙尚未限制UDP数据包通过、或者防火墙端口3478(STUN默认的协议端口)开放,用户终端接收到STUN服务器返回的地址收集响应,获取防火墙分别为P1端口和P2端口分配的公用地址(又被称为reflexive地址)。The response is collected by the UDP-hosted address returned by the STUN server. If the firewall has not restricted the UDP packet passing, or the firewall port 3478 (the default protocol port of the STUN) is open, the user terminal receives the address collection response returned by the STUN server, and obtains the firewall respectively. A public address (also known as a reflexive address) assigned to a P1 port and a P2 port.
用户终端继续执行ICE/STUN穿越防火墙流程:The user terminal continues to execute the ICE/STUN traversal firewall process:
用户终端向VoIP信令服务器发送SDP(Session Description Protocol;会话描述协议)消息,其中,所述SDP消息中包含了reflexive地址。The user terminal sends an SDP (Session Description Protocol) message to the VoIP signaling server, where the SDP message includes a reflexive address.
VoIP信令服务器将接收到的SDP消息和ICE信息发送给媒体网关,并随 机为P1端口和P2端口分配对应的网络侧媒体端口(即P3端口和P4端口)。The VoIP signaling server sends the received SDP message and ICE information to the media gateway, and The device allocates corresponding network side media ports (ie, P3 port and P4 port) for the P1 port and the P2 port.
需要说明的是,这里的网络侧媒体端口可以是指媒体网关对应的媒体端口。It should be noted that the network side media port herein may refer to a media port corresponding to the media gateway.
VoIP信令服务器向用户终端返回SDP响应消息,其中,所述SDP响应消息包含了分配的网络侧媒体端口(即P3端口和P4端口)。The VoIP signaling server returns an SDP response message to the user terminal, wherein the SDP response message includes the allocated network side media ports (ie, P3 port and P4 port).
用户终端进一步地通过用户终端的媒体端口向媒体网关对应的媒体端口发送媒体路径的STUN连通性检测(STUN Connectivity check)请求,其中,所述STUN连通性检测请求用以确定用户终端发送的媒体是否可以直接到达所述媒体网关对应的媒体端口,即用户终端检查从本端媒体端口到媒体网关对应的媒体端口之间的路径是否可通。The user terminal further sends a STUN Connectivity check request of the media path to the media port corresponding to the media gateway through the media port of the user terminal, where the STUN connectivity detection request is used to determine whether the media sent by the user terminal is The user can directly access the media port corresponding to the media gateway, that is, the user terminal checks whether the path between the local media port and the media port corresponding to the media gateway is reachable.
若用户终端与媒体网关之间的防火墙没有开通通信双方的协议端口,用户终端将无法接收到所述媒体网关发送的STUN连通性检测响应,此时,用户终端确定为待传输的媒体建立用于穿越防火墙的传输隧道。If the firewall between the user terminal and the media gateway does not open the protocol port of the communication party, the user terminal cannot receive the STUN connectivity detection response sent by the media gateway. At this time, the user terminal determines to establish the media to be transmitted for use. A transmission tunnel that traverses the firewall.
或者说,由于用户终端与媒体网关之间的防火墙具备DPI(Deep Packet Inspection;深度数据包检测)功能,可以允许STUN连通性检测请求通过,但是不允许RTP/RTCP数据包通过,使得用户终端依然无法接收到来自媒体网关的媒体数据包,此时,用户终端确定为待传输的媒体建立用于穿越防火墙的传输隧道。In other words, because the firewall between the user terminal and the media gateway has the DPI (Deep Packet Inspection) function, the STUN connectivity detection request can be allowed to pass, but the RTP/RTCP data packet is not allowed to pass, so that the user terminal remains. The media data packet from the media gateway cannot be received. At this time, the user terminal determines to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
在这种情形下,用户终端需要为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。In this case, the tunnel type that the user terminal needs to establish a transport tunnel for traversing the firewall for the medium to be transmitted is a DTLS tunnel type.
综上所述,若用户终端向STUN服务器发送由UDP承载的地址收集请求,在无法接收到STUN服务器返回的由UDP承载的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。In summary, if the user terminal sends an address collection request that is carried by the UDP to the STUN server, and fails to receive the address collection response of the UDP bearer returned by the STUN server, it is determined that the transmission for the media to be transmitted is established for traversing the firewall. The tunnel type of the tunnel is the TLS tunnel type.
若用户终端向STUN服务器发送由UDP承载的地址收集请求,在接收到STUN服务器返回的由UDP承载的地址收集响应时,按照现有技术规范,分别通过P1和P2端口向媒体网关对应的媒体端口发送STUN连通性检测请求, 在尚未接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。If the user terminal sends an address collection request by the UDP to the STUN server, and receives the response from the UDP bearer returned by the STUN server, the media port corresponding to the media gateway through the P1 and P2 ports respectively according to the existing technical specifications. Send a STUN connectivity check request, When the STUN connectivity detection response sent by the media gateway has not been received, it is determined that the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a DTLS tunnel type.
步骤102:所述用户终端根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号。Step 102: The user terminal allocates a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type according to the determined tunnel type.
在步骤102中,用户终端在确定建立用于穿越防火墙的传输隧道时,即采用隧道数据包封装RTP/RTCP over UDP数据包的方式穿越防火墙,此时为确定的所述隧道类型对应的传输隧道分配用户终端侧的第一端口号。In step 102, the user terminal traverses the firewall by using the tunnel data packet to encapsulate the RTP/RTCP over UDP data packet when determining to establish a transmission tunnel for traversing the firewall. In this case, the transmission tunnel corresponding to the determined tunnel type is determined. The first port number on the user terminal side is assigned.
若确定的隧道类型为TLS隧道类型,则用户终端侧的第一端口号为TLS隧道类型分配用户终端侧TLS客户端的端口号;If the determined tunnel type is a TLS tunnel type, the first port number on the user terminal side is a port number of the TLS tunnel type assigned to the user terminal side TLS client;
若确定的隧道类型为DTLS隧道类型,则用户终端侧的第一端口号为TLS隧道类型分配用户终端侧DTLS客户端的端口号。If the determined tunnel type is the DTLS tunnel type, the first port number on the user terminal side is the port number of the DTLS client allocated to the user terminal side for the TLS tunnel type.
步骤103:所述用户终端将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道。Step 103: The user terminal sends the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, so that the network side allocates the transmission tunnel corresponding to the tunnel type according to the tunnel type. A second port number on the network side, establishing a transmission tunnel between the first port number and the second port number.
在步骤103中,所述用户终端将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息携带在SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,并将所述第二端口号发送给媒体网关和所述用户终端。In step 103, the user terminal carries the tunnel type, the first port number, and the payload format information of the tunnel data packet in an SDP message and sends the information to the IP bearer voice VoIP signaling server, which is determined by the VoIP signaling server. The tunnel type is a second port number on the network side of the transmission tunnel corresponding to the tunnel type, and the second port number is sent to the media gateway and the user terminal.
所述用户终端还可以将所述用户终端的IP地址发送给VoIP信令服务器。The user terminal may also send the IP address of the user terminal to the VoIP signaling server.
VoIP信令服务器还可以将认证参数发送给所述用户终端,所述认证参数用于在与所述媒体网关建立传输隧道时对所述媒体网关进行认证。The VoIP signaling server may also send an authentication parameter to the user terminal, where the authentication parameter is used to authenticate the media gateway when establishing a transmission tunnel with the media gateway.
需要说明的是,隧道数据包的载荷格式是指RTP协议数据包/RTCP协议数据包如何承载在隧道数据包中,隧道数据包的载荷格式信息是指SDP携带的特定标识或者属性行,用于通知接收方如何将待发送的媒体的数据包封装在隧道数据包中。 It should be noted that the payload format of the tunnel data packet refers to how the RTP protocol data packet/RTCP protocol data packet is carried in the tunnel data packet, and the payload format information of the tunnel data packet refers to a specific identifier or attribute line carried by the SDP, and is used for Notify the receiver how to encapsulate the data packets of the media to be sent in the tunnel data packet.
情形一:Situation 1:
具体地,VoIP信令服务器在接收到用户终端发送的SDP消息,根据SDP消息中包含的所述隧道类型确定采用TLS隧道方式穿越的防火墙时,固定分配TLS协议默认端口号443作为TLS隧道网络侧的端口,同时随机分配RTP协议数据包/RTCP协议数据包的端口号为P4/P5;并产生用于在建立TLS传输隧道的握手协商过程中用户终端对媒体网关进行认证的认证参数,例如:认证参数可以为媒体网关数字证书指纹或者预共享密钥。Specifically, the VoIP signaling server receives the SDP message sent by the user terminal, and determines the TLS protocol default port number 443 as the TLS tunnel network side when determining the firewall traversed by the TLS tunnel according to the tunnel type included in the SDP message. Port, at the same time, randomly assigns the port number of the RTP protocol packet/RTCP protocol packet to P4/P5; and generates an authentication parameter for the user terminal to authenticate the media gateway during the handshake negotiation process of establishing the TLS transmission tunnel, for example: The authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
此外,VoIP信令服务器通过SDP响应消息将分配的TLS传输隧道网络侧的端口号和建立TLS隧道的认证参数发送给用户终端。In addition, the VoIP signaling server sends the port number of the allocated TLS transmission tunnel network side and the authentication parameter for establishing the TLS tunnel to the user terminal through the SDP response message.
同时,VoIP信令服务器将建立TLS传输隧道的网络侧端口(即第二端口号)和隧道数据包的载荷格式信息发给媒体网关。At the same time, the VoIP signaling server sends the network side port (ie, the second port number) of the TLS transmission tunnel and the payload format information of the tunnel data packet to the media gateway.
所述用户终端和所述媒体网关根据现有TLS协议,协商在第一端口号和第二端口号之间建立TLS传输隧道。The user terminal and the media gateway negotiate to establish a TLS transmission tunnel between the first port number and the second port number according to the existing TLS protocol.
这里需要说明的是,在用户终端与媒体网关之间协商建立TLS传输隧道时,只需要执行单边认证即可,即用户终端对媒体网关进行认证,因为根据现有ICE协议,在建立TLS传输隧道之后,用户终端通过TLS传输隧道发送STUN连通性检测请求,此时,媒体网关采用ICE短期凭证认证机制(short-term credential)对用户终端进行认证。It should be noted that when a TLS transmission tunnel is established between the user terminal and the media gateway, only one-side authentication is required, that is, the user terminal authenticates the media gateway because the TLS transmission is established according to the existing ICE protocol. After the tunnel, the user terminal sends a STUN connectivity check request through the TLS transport tunnel. At this time, the media gateway authenticates the user terminal by using the ICE short-term credential mechanism.
情形二:Case 2:
具体地,VoIP信令服务器在接收到用户终端发送的SDP消息,根据SDP消息中包含的所述隧道类型确定采用DTLS隧道方式穿越的防火墙时,固定分配STUN协议默认端口号3478作为DTLS隧道网络侧的端口,并在建立DTLS传输隧道的握手协商过程中用户终端对媒体网关进行认证的认证参数,例如:认证参数可以为媒体网关数字证书指纹或者预共享密钥。Specifically, the VoIP signaling server receives the SDP message sent by the user terminal, and determines the default port number 3478 of the STUN protocol as the DTLS tunnel network side when determining the firewall that traverses the DTLS tunnel mode according to the tunnel type included in the SDP message. The authentication parameter of the user terminal to authenticate the media gateway during the handshake negotiation process of establishing the DTLS transmission tunnel. For example, the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
此外,VoIP信令服务器通过SDP响应消息将DTLS隧道网络侧的端口号(即第二端口号)和建立隧道的认证参数发送给用户终端。 In addition, the VoIP signaling server sends the port number (ie, the second port number) of the DTLS tunnel network side and the authentication parameter for establishing the tunnel to the user terminal through the SDP response message.
同时,VoIP信令服务器将建立DTLS隧道的网络侧端口和隧道数据包的载荷格式信息发给媒体网关。At the same time, the VoIP signaling server sends the network format port of the DTLS tunnel and the payload format information of the tunnel data packet to the media gateway.
所述用户终端和所述媒体网关根据现有DTLS协议,协商在第一端口号和第二端口号之间建立DTLS传输隧道。The user terminal and the media gateway negotiate to establish a DTLS transmission tunnel between the first port number and the second port number according to the existing DTLS protocol.
步骤104:所述用户终端接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。Step 104: The user terminal receives a data packet of a media that is encapsulated by the network side and is encapsulated according to load format information of the tunnel data packet.
其中,所述媒体的数据包中包含RTP协议数据包/RTCP协议数据包和UDP协议报头,即RTP/RTCP over UDP数据包,该UDP协议报头中包含的端口号为SDP中携带的通信双方的RTP/RTCP端口。The data packet of the media includes an RTP protocol data packet/RTCP protocol data packet and a UDP protocol header, that is, an RTP/RTCP over UDP data packet, and the port number included in the UDP protocol header is the communication party carried in the SDP. RTP/RTCP port.
可选的,在本发明实施例中,隧道传输的媒体的数据包即可以是采用加密形式也可以采用非加密形式封装。Optionally, in the embodiment of the present invention, the data packet of the tunneled media may be encapsulated in an encrypted form or a non-encrypted form.
具体的,根据现有协议,TLS和DTLS对承载的数据包进行封装的方式有两种,一种是采用正常的加密算法(如AES,3DES等算法)对数据进行加密,另一种是采用不加密的方式进行对数据进行明文封装。按照现有TLS/DTLS协议,即使采用明文封装方式承载数据,通信双方也要进行与采用加密封装方式一样的TLS/DTLS握手协商过程,只不过是双方协商出来的加密算法为空算法(null)。所谓空算法实际上就是不对数据进行加密,且无论是采用哪种封装方式,数据包的格式是一样的。另外由于防火墙不会对TLS/DTLS握手过程进行协议逻辑解析,无法知道TLS/DTLS将采用哪种加密算法进行加密,默认载荷部分的数据已经被加密,这样防火墙无法获知TLS/DTLS隧道承载的数据包协议类型。因此,用户终端只要能够和媒体网关建立TLS/DTLS隧道,无论采用哪种加密算法,都不影响TLS/DTLS隧道承载的媒体数据包穿越防火墙。Specifically, according to the existing protocol, TLS and DTLS encapsulate the carried data packets in two ways. One is to encrypt data by using a normal encryption algorithm (such as AES, 3DES, etc.), and the other is to adopt Data is encapsulated in plain text without encryption. According to the existing TLS/DTLS protocol, even if the data is carried in the plaintext encapsulation mode, the two parties must perform the same TLS/DTLS handshake negotiation process as the encryption encapsulation method, except that the encryption algorithm negotiated by both parties is null (null). . The so-called null algorithm does not actually encrypt the data, and the format of the packet is the same regardless of the encapsulation method. In addition, since the firewall does not perform protocol logic analysis on the TLS/DTLS handshake process, it cannot be known which encryption algorithm is used for encryption by TLS/DTLS. The data of the default payload part has been encrypted, so that the firewall cannot know the data carried by the TLS/DTLS tunnel. Package protocol type. Therefore, as long as the user terminal can establish a TLS/DTLS tunnel with the media gateway, no matter which encryption algorithm is used, the media data packets carried by the TLS/DTLS tunnel do not affect the firewall.
在步骤104中,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:In step 104, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
若隧道类型为TLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为隧道数据包的载荷格式信息 封装在TLS隧道数据包中;或If the tunnel type is TLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are used as the payload format information of the tunnel packet. Encapsulated in a TLS tunnel packet; or
若隧道类型为DTLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为隧道数据包的载荷格式信息封装在DTLS隧道数据包中。If the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
所述UDP协议数据包报头中包含的端口号分别为所述用户终端分配的媒体端口、所述媒体网关分配的媒体端口。The port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
可选地,所述媒体传输方法还包括:Optionally, the media transmission method further includes:
所述用户终端对接收到的所述媒体数据包进行解封装,获取TLS隧道数据包/DTLS隧道数据包中的媒体的数据包,并根据TLS隧道数据包/DTLS隧道数据包中UDP协议数据包报头中包含的端口号,将所述媒体的数据包发送给媒体处理单元。The user terminal decapsulates the received media data packet, acquires a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet, and according to a UDP protocol data packet in a TLS tunnel data packet/DTLS tunnel data packet The port number included in the header sends the data packet of the media to the media processing unit.
如图2所示,为穿越防火墙时TLS隧道数据包格式的示意图。As shown in Figure 2, it is a schematic diagram of the TLS tunnel packet format when traversing the firewall.
图2所示的为TLS隧道数据包。从图2中可以看出,TLS报文包含了隧道数据包头、隧道数据包载荷和TLS报尾。其中,隧道数据包头中包含的TCP的端口号为TLS传输隧道的源端口号和目的端口号。若媒体的数据包由用户终端发给媒体网关时,该隧道数据包的源端口号为第一端口号,目的端口为第二端口号;若媒体的数据包由媒体网关发送给用户终端时,该隧道数据包的源端口号为第二端口号,目的端口号为穿越防火墙为用户终端分配的公网地址对应的端口号,在STUN连通性检测阶段,媒体网关通过STUN连通性检测(例如:TLS握手请求消息或者STUN连通性检测请求消息)获取到防火墙分配给该用户终端的公网地址。Figure 2 shows the TLS tunnel packet. As can be seen from Figure 2, the TLS message contains the tunnel packet header, the tunnel packet payload, and the TLS trailer. The port number of the TCP included in the tunnel packet header is the source port number and destination port number of the TLS transport tunnel. If the data packet of the media is sent by the user terminal to the media gateway, the source port number of the tunnel data packet is the first port number, and the destination port is the second port number; if the media data packet is sent by the media gateway to the user terminal, The source port number of the tunnel packet is the second port number, and the destination port number is the port number corresponding to the public network address assigned to the user terminal through the firewall. In the STUN connectivity detection phase, the media gateway passes the STUN connectivity check (for example: The TLS handshake request message or the STUN connectivity check request message acquires a public network address assigned to the user terminal by the firewall.
和正常的VoIP会议一样,通信双方通过SDP消息交换对端的媒体端口号,隧道数据包载荷中包含的UDP报头的端口号为SDP中携带的通信双方的媒体端口号,若媒体的数据包由用户终端发给媒体网关时,该UDP报头的源端口号为P1/P2,目的端口号为P3/P4;若媒体的数据包由媒体网关发送给用户终端时,该UDP报头的源端口号为P3/P4,目的端口为P1/P2。 As with the normal VoIP conference, the communication parties exchange the media port number of the peer end through the SDP message. The port number of the UDP header included in the tunnel packet payload is the media port number of the communication parties carried in the SDP. If the media packet is used by the user. When the terminal sends the media gateway to the media gateway, the source port number of the UDP header is P1/P2, and the destination port number is P3/P4. If the media packet is sent by the media gateway to the user terminal, the source port number of the UDP header is P3. /P4, the destination port is P1/P2.
TLS报尾部分为TLS载荷部分的完整性校验值,根据TLS协议,该值用于验证载荷部分数据是否被修改过。The TLS trailer part is the integrity check value of the TLS payload part. According to the TLS protocol, this value is used to verify whether the payload part data has been modified.
这里需要指出的是,无论TLS采用哪种加密算法,即使是空(null)算法,数据包的格式都不变。It should be pointed out here that no matter which encryption algorithm is used by TLS, even the null algorithm does not change the format of the data packet.
由于隧道数据包载荷部分被封装在TLS报头和报尾之间,因此防火墙无法知道隧道数据包承载的媒体的数据包的类型。Since the tunnel packet payload portion is encapsulated between the TLS header and the trailer, the firewall cannot know the type of packet of the media carried by the tunnel packet.
如图3所示,为穿越防火墙时DTLS隧道数据包格式的示意图。As shown in Figure 3, it is a schematic diagram of the DTLS tunnel packet format when traversing the firewall.
图3所示的为DTLS隧道数据包。从图3中可以看出,DTLS报文包含了隧道数据包头、隧道数据包载荷和DTLS报尾。其中,隧道数据包头中包含的UDP的端口号为DTLS传输隧道的源端口号和目的端口。若媒体的数据包由用户终端发给媒体网关时,该隧道数据包的源端口号为第一端口号,目的端口号为第二端口号;若媒体的数据包由媒体网关发送给用户终端时,该隧道数据包的源端口号为第二端口号,目的端口号为穿越防火墙为用户终端分配的公网地址对应的端口号,在STUN连通性检测阶段,媒体网关通过STUN连通性检测(例如:DTLS握手请求消息或者STUN连通性检测消息)获取到防火墙分配给该用户终端的公网地址。Figure 3 shows the DTLS tunnel packet. As can be seen from Figure 3, the DTLS message contains the tunnel packet header, the tunnel packet payload, and the DTLS trailer. The port number of the UDP included in the tunnel packet header is the source port number and destination port of the DTLS transmission tunnel. If the data packet of the media is sent by the user terminal to the media gateway, the source port number of the tunnel data packet is the first port number, and the destination port number is the second port number; if the media data packet is sent by the media gateway to the user terminal The source port number of the tunnel data packet is the second port number, and the destination port number is the port number corresponding to the public network address allocated by the firewall for the user terminal. In the STUN connectivity detection phase, the media gateway passes the STUN connectivity detection (for example, The DTLS handshake request message or the STUN connectivity check message acquires a public network address assigned to the user terminal by the firewall.
隧道数据包载荷中包含的UDP报头的端口号为SDP携带的通信双方的媒体端口号,若媒体的数据包由用户终端发给媒体网关时,该端口号为P1/P2;若媒体的数据报文由媒体网关发送给用户终端时,该端口号为P3/P4。The port number of the UDP header included in the tunnel packet payload is the media port number of the communication parties carried by the SDP. If the media packet is sent by the user terminal to the media gateway, the port number is P1/P2; if the media datagram When the text is sent to the user terminal by the media gateway, the port number is P3/P4.
DTLS报尾部分为TLS载荷部分的完整性校验值,根据DTLS协议,该值用于验证载荷部分数据是否被修改过。The DTLS trailer part is the integrity check value of the TLS payload part. According to the DTLS protocol, this value is used to verify whether the payload part data has been modified.
这里需要指出的是,无论DTLS采用哪种加密算法,即使是空(null)算法,数据包的格式都不变。由于隧道数据包载荷部分被封装在DTLS报头和DTLS报尾之间,因此防火墙无法知道隧道数据包承载的媒体的数据包的类型。It should be pointed out here that no matter which encryption algorithm is used by DTLS, even the null algorithm does not change the format of the data packet. Since the tunnel packet payload portion is encapsulated between the DTLS header and the DTLS trailer, the firewall cannot know the type of packet of the media carried by the tunnel packet.
通过本发明实施例一的方案,用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,根据确定的所述隧道 类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。这样IP数据包在穿越防火墙时,防火墙无法获知上层协议数据包类型,同时本发明实施例的方式在不增加额外网元和节点的情形下,直接与媒体网关之间建立传输隧道,不仅能够穿越所有类型的防火墙,而且有效地避免了媒体传输中出现的时延问题,提升了媒体传输效率。According to the solution of the first embodiment of the present invention, the user terminal determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, according to the determined tunnel. a type, the first port number on the user terminal side is allocated to the transmission tunnel corresponding to the tunnel type, and the tunnel type, the first port number, and the load format information of the tunnel data packet are sent to the network side, so that the network side And assigning, according to the tunnel type, a second port number of the network side to the transmission tunnel corresponding to the tunnel type, establishing a transmission tunnel between the first port number and the second port number; and receiving the network side to establish The data packet of the media that is transmitted by the transport tunnel and encapsulated according to the payload format information of the tunnel data packet. In this way, when the IP data packet traverses the firewall, the firewall cannot know the type of the upper layer protocol packet, and the method of the embodiment of the present invention directly establishes a transmission tunnel with the media gateway without adding additional network elements and nodes, which can not only traverse All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
实施例二:Embodiment 2:
如图4所示,为本发明实施例二提供的一种媒体传输方法的流程示意图。所述方法可以如下所述。FIG. 4 is a schematic flowchart diagram of a media transmission method according to Embodiment 2 of the present invention. The method can be as follows.
步骤401:用户终端发起VoIP会话,运行ICE客户端。Step 401: The user terminal initiates a VoIP session and runs the ICE client.
在步骤401中,用户终端启动ICE/STUN穿越防火墙流程。In step 401, the user terminal initiates the ICE/STUN traversal firewall process.
步骤402:用户终端为待传输的RTP数据包和RTCP数据包随机分配一对端口号P1和P2。Step 402: The user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted.
其中,RTP端口号数为偶数,且比RTCP的端口号小1。The RTP port number is an even number and is one less than the port number of the RTCP.
步骤403:用户终端向STUN服务器发送地址收集请求。Step 403: The user terminal sends an address collection request to the STUN server.
其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址。The address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
需要说明的是,用户终端向STUN服务器发送由UDP(User Datagram Protocol,用户数据包协议)承载的地址收集请求。It should be noted that the user terminal sends an address collection request carried by the UDP (User Datagram Protocol) to the STUN server.
具体地,用户终端分别通过P1端口和P2端口向STUN服务器发送由UDP承载的地址分配请求(即STUN allocate)或者STUN绑定请求(即STUN Binding)(在本发明中,为了叙述方便,地址分配请求和STUN绑定请求可以 被统称为地址收集请求)。Specifically, the user terminal sends an address allocation request (ie, STUN allocate) or a STUN binding request (that is, STUN Binding) carried by the UDP to the STUN server through the P1 port and the P2 port, respectively (in the present invention, for the convenience of description, address allocation) Request and STUN binding request can Collectively referred to as address collection requests).
STUN服务器获取该地址收集请求的源地址,该源地址即防火墙为发送地址收集请求的用户终端的端口分配的公网地址,STUN服务器通过地址收集响应将该公网地址发送给用户终端,使得用户终端获知防火墙为其端口分配的公网地址。The STUN server obtains the source address of the address collection request. The source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request. The STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
步骤404:用户终端判断是否能够接收到STUN服务器返回的地址收集响应,若接收到,则执行步骤409;若没有接收到,则执行步骤405。Step 404: The user terminal determines whether the address collection response returned by the STUN server can be received. If yes, step 409 is performed; if not, step 405 is performed.
步骤405:用户终端确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。Step 405: The user terminal determines that the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a TLS tunnel type.
步骤406:用户终端根据确定的TLS隧道类型,为TLS隧道类型对应的传输隧道分配用户终端侧TLS客户端的端口号。Step 406: The user terminal allocates a port number of the user terminal side TLS client to the transmission tunnel corresponding to the TLS tunnel type according to the determined TLS tunnel type.
需要说明的是,这里的用户终端侧TLS客户端的端口号也可以被称为用户终端侧的第一端口号。It should be noted that the port number of the TLS client on the user terminal side herein may also be referred to as the first port number on the user terminal side.
步骤407:所述用户终端将所述隧道类型、所述用户终端侧TLS客户端的端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的端口号,在所述用户终端侧TLS客户端的端口号和所述网络侧的端口号之间建立传输隧道。Step 407: The user terminal sends the tunnel type, the port number of the user terminal side TLS client, and the load format information of the tunnel data packet to the network side, so that the network side corresponds to the tunnel type according to the tunnel type. The transmission tunnel allocates a port number on the network side, and establishes a transmission tunnel between the port number of the TLS client on the user terminal side and the port number on the network side.
需要说明的是,这里的网络侧的端口号也可以被称为网络侧的第二端口号。It should be noted that the port number on the network side herein may also be referred to as a second port number on the network side.
在步骤407中,所述用户终端将所述隧道类型、所述用户终端侧TLS客户端的端口号和隧道数据包的载荷格式信息携带在SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型,为所述隧道类型对应的传输隧道分配网络侧的端口号,并将所述网络侧的端口号发送给媒体网关和所述用户终端。In step 407, the user terminal carries the tunnel type, the port number of the user terminal side TLS client, and the payload format information of the tunnel data packet in an SDP message and sends the message to the IP bearer voice VoIP signaling server by VoIP. The signaling server allocates a port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and sends the port number of the network side to the media gateway and the user terminal.
所述用户终端还可以将所述用户终端的IP地址发送给VoIP信令服务器。The user terminal may also send the IP address of the user terminal to the VoIP signaling server.
VoIP信令服务器还可以将认证参数发送给所述用户终端,所述认证参数用 于在与所述媒体网关建立传输隧道时对所述媒体网关进行认证。The VoIP signaling server may further send an authentication parameter to the user terminal, where the authentication parameter is used. The media gateway is authenticated when establishing a transmission tunnel with the media gateway.
具体地,VoIP信令服务器在接收到用户终端发送的SDP消息,根据SDP消息中包含的所述隧道类型确定采用TLS隧道方式穿越的防火墙时,固定分配TLS协议默认端口号443作为TLS隧道网络侧的端口,同时随机分配RTP/RTCP协议数据包的端口号为P4/P5;并产生用于在建立TLS传输隧道的握手协商过程中用户终端对媒体网关进行认证的认证参数,例如:认证参数可以为媒体网关数字证书指纹或者预共享密钥。Specifically, the VoIP signaling server receives the SDP message sent by the user terminal, and determines the TLS protocol default port number 443 as the TLS tunnel network side when determining the firewall traversed by the TLS tunnel according to the tunnel type included in the SDP message. Port, the port number of the RTP/RTCP protocol data packet is randomly assigned to be P4/P5; and the authentication parameter for authenticating the media gateway by the user terminal during the handshake negotiation process of establishing the TLS transmission tunnel, for example, the authentication parameter may be A digital certificate fingerprint or pre-shared key for the media gateway.
此外,VoIP信令服务器通过SDP响应消息将分配的TLS传输隧道网络侧的端口号和建立TLS隧道的认证参数发送给用户终端。In addition, the VoIP signaling server sends the port number of the allocated TLS transmission tunnel network side and the authentication parameter for establishing the TLS tunnel to the user terminal through the SDP response message.
同时,VoIP信令服务器将建立TLS传输隧道的网络侧的端口和隧道数据包的载荷格式信息发给媒体网关。At the same time, the VoIP signaling server sends the port format of the network side of the TLS transmission tunnel and the payload format information of the tunnel data packet to the media gateway.
所述用户终端和所述媒体网关根据现有TLS协议,协商在所述用户终端侧TLS客户端的端口号和所述网络侧的端口号之间建立TLS传输隧道。The user terminal and the media gateway negotiate to establish a TLS transmission tunnel between the port number of the TLS client on the user terminal side and the port number on the network side according to the existing TLS protocol.
这里需要说明的是,在用户终端与媒体网关之间协商建立TLS传输隧道时,只需要执行单边认证即可,即用户终端对媒体网关进行认证,因为根据现有ICE协议,在建立TLS传输隧道之后,用户终端通过TLS传输隧道发送STUN连通性检测请求,此时,媒体网关采用ICE短期凭证认证机制(short-term credential)对用户终端进行认证。It should be noted that when a TLS transmission tunnel is established between the user terminal and the media gateway, only one-side authentication is required, that is, the user terminal authenticates the media gateway because the TLS transmission is established according to the existing ICE protocol. After the tunnel, the user terminal sends a STUN connectivity check request through the TLS transport tunnel. At this time, the media gateway authenticates the user terminal by using the ICE short-term credential mechanism.
步骤408:所述用户终端接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。Step 408: The user terminal receives a data packet of a media that is encapsulated by the network side and is encapsulated according to the load format information of the tunnel data packet.
在步骤408中,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:In step 408, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
在隧道类型为TLS隧道类型时,将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为隧道数据包的载荷格式信息封装在TLS隧道数据包中。When the tunnel type is the TLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the TLS tunnel packet as the payload format information of the tunnel packet.
用户终端通过TLS传输隧道发送STUN连通性检检测请求,媒体网关采 用短期凭证机制对用户终端执行认证。用户终端在接收到STUN连通性检测响应之后,通过update SDP offer消息通知媒体网关,确定采用TLS传输隧道穿越防火墙。用户终端和媒体网关按照图2的TLS隧道数据包格式,通过TLS传输隧道,将RTP/RTCP over UDP协议数据包发送到对端。The user terminal sends a STUN connectivity check request through the TLS transport tunnel, and the media gateway adopts The short-term credential mechanism is used to perform authentication on the user terminal. After receiving the STUN connectivity detection response, the user terminal notifies the media gateway by using the update SDP offer message to determine to traverse the firewall by using the TLS transmission tunnel. The user terminal and the media gateway send the RTP/RTCP over UDP protocol data packet to the peer end according to the TLS tunnel data packet format of FIG. 2 through the TLS transport tunnel.
步骤409:用户终端接收到STUN服务器返回的地址收集响应,获取防火墙分别为P1端口和P2端口分配的公用地址。Step 409: The user terminal receives the address collection response returned by the STUN server, and obtains the public address assigned by the firewall to the P1 port and the P2 port respectively.
用户终端向VoIP信令服务器发送SDP(Session Description Protocol;会话描述协议)消息,其中,所述SDP消息中包含了该公用地址。The user terminal sends an SDP (Session Description Protocol) message to the VoIP signaling server, where the public address is included in the SDP message.
VoIP信令服务器将接收到的SDP消息和ICE信息发送给媒体网关,并随机为P1端口和P2端口分配网络侧对应的媒体端口(即P3端口和P4端口)。The VoIP signaling server sends the received SDP message and ICE information to the media gateway, and randomly allocates the media ports (ie, P3 port and P4 port) corresponding to the network side to the P1 port and the P2 port.
VoIP信令服务器向用户终端返回SDP响应消息,其中,所述SDP响应消息包含了分配的网络侧对应的媒体端口(即P3端口和P4端口)。The VoIP signaling server returns an SDP response message to the user terminal, where the SDP response message includes the media port corresponding to the allocated network side (ie, the P3 port and the P4 port).
需要说明的是,这里的网络侧媒体端口可以是指媒体网关对应的媒体端口。It should be noted that the network side media port herein may refer to a media port corresponding to the media gateway.
步骤410:用户终端通过媒体端口P1/P2向媒体网关对应的媒体端口P3/P4发送媒体路径的STUN连通性检测请求。Step 410: The user terminal sends a STUN connectivity detection request of the media path to the media port P3/P4 corresponding to the media gateway through the media port P1/P2.
其中,所述STUN连通性检测(STUN Connectivity check)请求用以确定用户终端发送的媒体是否可以直接到达所述媒体网关对应的媒体端口,即用户终端检查从本端媒体端口到媒体网关对应的媒体端口之间的路径是否可通。The STUN Connectivity check (STUN Connectivity check) request is used to determine whether the media sent by the user terminal can directly reach the media port corresponding to the media gateway, that is, the user terminal checks the media corresponding to the media gateway from the local media port to the media gateway. Whether the path between the ports is accessible.
步骤411:用户终端在无法接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。Step 411: When the user terminal cannot receive the STUN connectivity detection response sent by the media gateway, determine that the tunnel type of the transmission tunnel used for traversing the firewall is the DTLS tunnel type.
在步骤411中,若用户终端与媒体网关之间的防火墙没有开通通信双方的协议端口,用户终端将无法接收到所述媒体网关发送的STUN连通性检测响应,此时,用户终端确定为待传输的媒体建立用于穿越防火墙的传输隧道。In step 411, if the firewall between the user terminal and the media gateway does not open the protocol port of the communication party, the user terminal cannot receive the STUN connectivity detection response sent by the media gateway. At this time, the user terminal determines that the user terminal is to be transmitted. The media establishes a transport tunnel for traversing the firewall.
或者说,由于用户终端与媒体网关之间的防火墙具备DPI(Deep Packet  Inspection;深度报文检测)功能,可以允许STUN连通性检测请求通过,但是不允许RTP协议数据包/RTCP协议数据包通过,使得用户终端依然无法接收到来自媒体网关的媒体的数据包,此时,用户终端确定为待传输的媒体建立用于穿越防火墙的传输隧道。Or, because the firewall between the user terminal and the media gateway has DPI (Deep Packet) Inspection; deep packet inspection) function, which allows the STUN connectivity detection request to pass, but does not allow the RTP protocol packet/RTCP protocol packet to pass, so that the user terminal still cannot receive the data packet from the media gateway. The user terminal determines to establish a transport tunnel for traversing the firewall for the media to be transmitted.
步骤412:用户终端根据确定的DTLS隧道类型,为DTLS隧道类型分配用户终端侧DTLS客户端的端口号。Step 412: The user terminal allocates a port number of the DTLS client of the user terminal to the DTLS tunnel type according to the determined DTLS tunnel type.
需要说明的是,这里的用户终端侧DTLS客户端的端口号也可以被称为用户终端侧的第一端口号。It should be noted that the port number of the DTLS client on the user terminal side herein may also be referred to as the first port number on the user terminal side.
步骤413:所述用户终端将所述隧道类型、所述用户终端侧DTLS客户端的端口号和载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的端口号,在所述用户终端侧DTLS客户端的端口号和所述网络侧的端口号之间建立传输隧道。Step 413: The user terminal sends the tunnel type, the port number and the payload format information of the user terminal side DTLS client to the network side, so that the network side allocates the transmission tunnel corresponding to the tunnel type according to the tunnel type. A port number on the network side establishes a transmission tunnel between the port number of the DTLS client on the user terminal side and the port number on the network side.
在步骤413中,VoIP信令服务器在接收到用户终端发送的SDP消息,根据SDP消息中包含的所述隧道类型确定采用DTLS隧道方式穿越的防火墙时,固定分配STUN协议默认端口号3478作为DTLS隧道网络侧的端口,并在建立DTLS传输隧道的握手协商过程中用户终端对媒体网关进行认证的认证参数,例如:认证参数可以为媒体网关数字证书指纹或者预共享密钥。In step 413, the VoIP signaling server receives the SDP message sent by the user terminal, and determines the default port number 3478 of the STUN protocol as the DTLS tunnel when determining the firewall traversed by the DTLS tunnel according to the tunnel type included in the SDP message. The authentication parameter of the user terminal to authenticate the media gateway during the handshake negotiation process of the DTLS transmission tunnel. For example, the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
此外,VoIP信令服务器通过SDP响应消息将DTLS隧道网络侧的端口号和建立隧道的认证参数发送给用户终端。In addition, the VoIP signaling server sends the port number of the DTLS tunnel network side and the authentication parameter for establishing the tunnel to the user terminal through the SDP response message.
同时,VoIP信令服务器将建立DTLS隧道的网络侧端口和隧道数据包的载荷格式信息发给媒体网关。At the same time, the VoIP signaling server sends the network format port of the DTLS tunnel and the payload format information of the tunnel data packet to the media gateway.
所述用户终端和所述媒体网关根据现有DTLS协议,协商在所述用户终端侧DTLS客户端的端口号和所述网络侧的端口号之间建立DTLS传输隧道。The user terminal and the media gateway negotiate to establish a DTLS transmission tunnel between the port number of the DTLS client on the user terminal side and the port number on the network side according to the existing DTLS protocol.
步骤414:所述用户终端接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。Step 414: The user terminal receives a data packet of a media that is encapsulated by the network side and is encapsulated according to the load format information of the tunnel data packet.
在步骤414中,通过以下方式按照所述隧道数据包的载荷格式信息封装媒 体的数据包:In step 414, the media is encapsulated according to the payload format information of the tunnel data packet in the following manner. Volume packet:
在隧道类型为DTLS隧道类型时,将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述DTLS隧道类型对应的隧道数据包的载荷格式信息封装在DTLS隧道数据包中。When the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS as the payload format information of the tunnel packet corresponding to the DTLS tunnel type. In the tunnel packet.
可选地,用户终端通过DTLS传输隧道发送STUN连通性检检测请求,媒体网关采用短期凭证机制对用户终端执行认证。用户终端在接收到STUN连通性检测响应之后,通过update SDP offer消息通知媒体网关,确定采用DTLS传输隧道穿越防火墙。用户终端和媒体网关按照图3的封装格式,通过DTLS传输隧道,将RTP/RTCP over UDP协议数据包发送到对端。Optionally, the user terminal sends the STUN connectivity check request through the DTLS transmission tunnel, and the media gateway performs the authentication on the user terminal by using the short-term credential mechanism. After receiving the STUN connectivity detection response, the user terminal notifies the media gateway through the update SDP offer message, and determines to use the DTLS transmission tunnel to traverse the firewall. The user terminal and the media gateway send the RTP/RTCP over UDP protocol data packet to the peer end through the DTLS transmission tunnel according to the encapsulation format of FIG. 3.
这样IP报文在穿越防火墙时,防火墙无法获知上层协议数据包类型,同时本发明实施例的方式在不增加额外网元和节点的情形下,直接与媒体网关之间建立传输隧道,不仅能够穿越所有类型的防火墙,而且有效地避免了媒体传输中出现的时延问题,提升了媒体传输效率。When the IP packet traverses the firewall, the firewall cannot know the packet type of the upper layer protocol. In the embodiment of the present invention, a transmission tunnel is directly established between the IP gateway and the node without adding additional network elements and nodes. All types of firewalls, and effectively avoid the delay problem in media transmission, improve the efficiency of media transmission.
实施例三:Embodiment 3:
如图5所示,为本发明实施例三提供的一种媒体传输方法的流程示意图。所述方法可以如下所述。As shown in FIG. 5, it is a schematic flowchart of a media transmission method according to Embodiment 3 of the present invention. The method can be as follows.
步骤501:用户终端发起VoIP会话,运行ICE客户端。Step 501: The user terminal initiates a VoIP session and runs the ICE client.
在步骤501中,用户终端启动ICE/STUN穿越防火墙流程。In step 501, the user terminal initiates the ICE/STUN traversal firewall process.
步骤502:用户终端为待传输的RTP数据包和RTCP数据包随机分配一对端口号P1和P2。Step 502: The user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted.
其中,RTP端口号数为偶数,且比RTCP的端口号小1。The RTP port number is an even number and is one less than the port number of the RTCP.
步骤503:用户终端向STUN服务器发送地址收集请求。Step 503: The user terminal sends an address collection request to the STUN server.
其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址。The address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
需要说明的是,用户终端向STUN服务器发送由UDP(User Datagram  Protocol,用户数据包协议)承载的地址收集请求。It should be noted that the user terminal sends UDP (User Datagram) to the STUN server. Protocol, User Datagram Protocol) The address collection request carried.
具体地,用户终端分别通过P1端口和P2端口向STUN服务器发送由UDP承载的地址分配请求(即STUN allocate)或者STUN绑定请求(即STUN Binding)(在本发明中,为了叙述方便,地址分配请求和STUN绑定请求可以被统称为地址收集请求)。Specifically, the user terminal sends an address allocation request (ie, STUN allocate) or a STUN binding request (that is, STUN Binding) carried by the UDP to the STUN server through the P1 port and the P2 port, respectively (in the present invention, for the convenience of description, address allocation) Request and STUN binding requests can be collectively referred to as address collection requests).
STUN服务器获取该地址收集请求的源地址,该源地址即防火墙为发送地址收集请求的用户终端的端口分配的公网地址,STUN服务器通过地址收集响应将该公网地址发送给用户终端,使得用户终端获知防火墙为其端口分配的公网地址。The STUN server obtains the source address of the address collection request. The source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request. The STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
步骤504:用户终端在无法接收到STUN服务器返回的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。Step 504: When the user terminal cannot receive the address collection response returned by the STUN server, determine that the tunnel type used for the transmission tunnel to traverse the firewall is TLS tunnel type.
由于用户终端发送的地址收集请求由UDP承载,一旦防火墙限制UDP报文通过、或者防火墙端口3478(STUN默认的协议端口)没有开放,防火墙将用户终端发送的地址收集请求丢弃,使得STUN服务器无法接收到用户终端发送的地址收集请求,用户终端也无法接收到STUN服务器发送的地址收集响应。The address collection request sent by the user terminal is received by the UDP. Once the firewall restricts the UDP packet from passing through, or the firewall port 3478 (the default protocol port of the STUN) is not open, the firewall discards the address collection request sent by the user terminal, so that the STUN server cannot receive the packet. The address collection request sent by the user terminal does not receive the address collection response sent by the STUN server.
此时,用户终端确定防火墙禁止VoIP媒体传输,需要为待传输的媒体建立用于穿越防火墙的传输隧道。At this time, the user terminal determines that the firewall prohibits VoIP media transmission, and needs to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
在这种情形下,用户终端确定防火墙限制传输UDP报文,需要为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。In this case, the user terminal determines that the firewall restricts the transmission of UDP packets, and the tunnel type that needs to establish a transmission tunnel for traversing the firewall for the media to be transmitted is a TLS tunnel type.
步骤505:用户终端根据确定的TLS隧道类型,为TLS隧道类型对应的传输隧道分配用户终端侧TLS客户端的端口号。Step 505: The user terminal allocates a port number of the user terminal side TLS client to the transmission tunnel corresponding to the TLS tunnel type according to the determined TLS tunnel type.
步骤506:用户终端通过SDP消息将所述隧道类型、所述用户终端侧TLS客户端的端口号和隧道数据包的载荷格式信息发送给VoIP信令服务器,使得VoIP信令服务器确定采用TLS隧道方式穿越的防火墙。 Step 506: The user terminal sends the tunnel type, the port number of the user terminal side TLS client, and the payload format information of the tunnel data packet to the VoIP signaling server by using the SDP message, so that the VoIP signaling server determines to adopt the TLS tunnel mode to traverse Firewall.
需要说明的是,SDP消息中还可以携带用户终端的IP地址(即用户终端的私有地址)。It should be noted that the SDP message may also carry the IP address of the user terminal (that is, the private address of the user terminal).
在步骤506中,SDP消息中携带所述隧道类型、所述用户终端侧TLS客户端的端口号和媒体封装格式的方式包括但不限于:In step 506, the manner in which the SDP message carries the tunnel type, the port number of the user terminal side TLS client, and the media encapsulation format includes but is not limited to:
第一种方式:The first way:
定义一个SDP属性行,该SDP属性行用于描述穿越防火墙的隧道类型、用户终端侧TLS客户端的端口号、媒体封装格式信息。An SDP attribute line is defined. The SDP attribute line is used to describe the tunnel type that traverses the firewall, the port number of the TLS client on the user terminal side, and the media encapsulation format information.
例如:采用的格式为a=traversal:<用户终端侧TLS客户端的端口号><隧道类型><隧道数据包的载荷格式信息>。For example, the format used is a=traversal:<port number of the TLS client on the user terminal side><tunnel type><load format information of the tunnel packet>.
本实施例中可以具体描述为a=traversal:P3 TLS-tunnel UDP-included,表明用户终端侧TLS客户端的端口号为P1,采用TLS隧道类型,隧道数据包的载荷格式信息为RTP协议数据包/RTCP协议数据包加上UDP报头作为TLS隧道数据包的载荷。In this embodiment, it can be specifically described as a=traversal: P3 TLS-tunnel UDP-included, indicating that the port number of the TLS client on the user terminal side is P1, and the TLS tunnel type is adopted, and the payload format information of the tunnel data packet is the RTP protocol data packet/ The RTCP protocol packet plus the UDP header is used as the payload of the TLS tunnel packet.
第二种方式:The second way:
对SDP消息中的candidate属性行进行扩展,增加标识位,描述该candidate的路径为隧道类型、隧道数据包的载荷格式信息。The candidate attribute line in the SDP message is extended, and the identifier bit is added, and the path describing the candidate is the tunnel type and the payload format information of the tunnel data packet.
例如:采用a=host candidate:<现有协议参数><隧道类型><隧道数据包的载荷格式信息>。本实例具体可以描述为a=candidate:TCP P3 host candidate TLS-tunnel UDP-included。For example: use a=host candidate:<existing protocol parameter><tunnel type><load format information of tunnel packet>. This example can be specifically described as a=candidate: TCP P3 host candidate TLS-tunnel UDP-included.
步骤507:VoIP信令服务器在接收到用户终端发送的SDP消息,根据SDP消息中包含的所述隧道类型确定采用TLS隧道方式穿越的防火墙时,固定分配TLS协议默认端口号443作为TLS隧道服务器端(也即网络侧)的端口,同时随机分配RTP/RTCP协议数据包的端口号为P4/P5。Step 507: When the VoIP signaling server receives the SDP message sent by the user terminal, and determines the firewall traversed by the TLS tunnel according to the tunnel type included in the SDP message, the TLS protocol default port number 443 is fixedly allocated as the TLS tunnel server end. (that is, the network side) port, and the port number of the RTP/RTCP protocol packet randomly assigned at the same time is P4/P5.
可选地,VoIP信令服务器产生用于在建立TLS传输隧道的握手协商过程中用户终端对媒体网关进行认证的认证参数,例如:认证参数可以为媒体网关数字证书指纹或者预共享密钥。 Optionally, the VoIP signaling server generates an authentication parameter used by the user terminal to authenticate the media gateway in the handshake negotiation process of establishing the TLS transmission tunnel. For example, the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
步骤508:VoIP信令服务器通过SDP响应消息将分配的TLS传输隧道网络侧的端口号和建立TLS隧道的认证参数发送给用户终端。Step 508: The VoIP signaling server sends the port number of the allocated TLS transmission tunnel network side and the authentication parameter for establishing the TLS tunnel to the user terminal by using an SDP response message.
同时,VoIP信令服务器将建立TLS传输隧道的网络侧端口和隧道数据包的载荷格式信息发给媒体网关。At the same time, the VoIP signaling server sends the network side port of the TLS transmission tunnel and the payload format information of the tunnel data packet to the media gateway.
步骤509:所述用户终端和所述媒体网关根据现有TLS协议,协商在所述用户终端侧TLS客户端的端口号和所述网络侧的端口号之间建立TLS传输隧道。Step 509: The user terminal and the media gateway negotiate to establish a TLS transmission tunnel between the port number of the TLS client on the user terminal side and the port number on the network side according to the existing TLS protocol.
媒体网关根据获取的防火墙为用户终端分配的公网地址和VoIP信令服务器发送的用户终端的私有地址,建立用户终端的私有地址和防火墙为其分配的公网地址之间的映射关系。The media gateway establishes a mapping relationship between the private address of the user terminal and the public network address assigned by the firewall according to the public network address allocated by the firewall for the user terminal and the private address of the user terminal sent by the VoIP signaling server.
需要说明的是,后续媒体网关发送给用户终端的媒体数据报文中隧道报文对应的目的端口号为该公网地址对应的端口号。It should be noted that the destination port number corresponding to the tunnel packet in the media data packet sent by the subsequent media gateway to the user terminal is the port number corresponding to the public network address.
步骤510:所述用户终端接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。Step 510: The user terminal receives the data packet of the media encapsulated according to the load format information of the tunnel data packet that is transmitted by the network side through the established transmission tunnel.
具体地,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:Specifically, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
在隧道类型为TLS隧道类型时,将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述TLS隧道类型对应的隧道数据包的载荷格式信息封装在TLS隧道数据包中。When the tunnel type is the TLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the TLS protocol as the payload format information of the tunnel packet corresponding to the TLS tunnel type. In the tunnel packet.
用户终端通过TLS传输隧道发送STUN连通性检检测请求,媒体网关采用短期凭证机制对用户终端执行认证。用户终端在接收到STUN连通性检测响应之后,通过update SDP offer消息通知媒体网关,确定采用TLS传输隧道穿越防火墙。用户终端和媒体网关按照图2的TLS隧道数据包格式,通过TLS传输隧道,将RTP/RTCP over UDP协议数据包发送到对端。The user terminal sends a STUN connectivity check request through the TLS transport tunnel, and the media gateway performs short-term credential mechanism to perform authentication on the user terminal. After receiving the STUN connectivity detection response, the user terminal notifies the media gateway by using the update SDP offer message to determine to traverse the firewall by using the TLS transmission tunnel. The user terminal and the media gateway send the RTP/RTCP over UDP protocol data packet to the peer end according to the TLS tunnel data packet format of FIG. 2 through the TLS transport tunnel.
实施例四:Embodiment 4:
如图6所示,为本发明实施例四提供的一种媒体传输方法的流程示意图。 所述方法可以如下所述。FIG. 6 is a schematic flowchart diagram of a media transmission method according to Embodiment 4 of the present invention. The method can be as follows.
步骤601:用户终端发起VoIP会话,运行ICE客户端。Step 601: The user terminal initiates a VoIP session and runs the ICE client.
在步骤601中,用户终端启动ICE/STUN穿越防火墙流程。In step 601, the user terminal initiates the ICE/STUN traversal firewall process.
步骤602:用户终端为待传输的RTP数据包和RTCP数据包随机分配一对端口号P1和P2。Step 602: The user terminal randomly allocates a pair of port numbers P1 and P2 for the RTP data packet and the RTCP data packet to be transmitted.
其中,RTP端口号数为偶数,且比RTCP的端口号小1。The RTP port number is an even number and is one less than the port number of the RTCP.
步骤603:用户终端向STUN服务器发送地址收集请求。Step 603: The user terminal sends an address collection request to the STUN server.
其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址。The address collection request is used to obtain a public address that is used by the firewall to transmit a real-time transport protocol RTP data packet and a port for transmitting a real-time transport control protocol RTCP data packet.
需要说明的是,用户终端向STUN服务器发送由UDP(User Datagram Protocol,用户数据包协议)承载的地址收集请求。It should be noted that the user terminal sends an address collection request carried by the UDP (User Datagram Protocol) to the STUN server.
具体地,用户终端分别通过P1端口和P2端口向STUN服务器发送由UDP封装的地址分配请求(即STUN allocate)或者STUN绑定请求(即STUN Binding)(在本发明中,为了叙述方便,地址分配请求和STUN绑定请求可以被统称为地址收集请求)。Specifically, the user terminal sends an UDP-encapsulated address allocation request (ie, STUN allocate) or a STUN binding request (that is, STUN Binding) to the STUN server through the P1 port and the P2 port, respectively (in the present invention, for the convenience of description, address allocation) Request and STUN binding requests can be collectively referred to as address collection requests).
STUN服务器获取该地址收集请求的源地址,该源地址即防火墙为发送地址收集请求的用户终端的端口分配的公网地址,STUN服务器通过地址收集响应将该公网地址发送给用户终端,使得用户终端获知防火墙为其端口分配的公网地址。The STUN server obtains the source address of the address collection request. The source address is the public network address assigned by the firewall to the port of the user terminal that sends the address collection request. The STUN server sends the public network address to the user terminal through the address collection response, so that the user The terminal knows the public network address assigned by the firewall to its port.
步骤604:用户终端接收到STUN服务器返回的地址收集响应,获取防火墙分别为P1端口和P2端口分配的公用地址。Step 604: The user terminal receives the address collection response returned by the STUN server, and obtains a public address assigned by the firewall to the P1 port and the P2 port respectively.
用户终端向VoIP信令服务器发送SDP(Session Description Protocol;会话描述协议)消息,其中,所述SDP消息中包含了该公用地址。The user terminal sends an SDP (Session Description Protocol) message to the VoIP signaling server, where the public address is included in the SDP message.
VoIP信令服务器将接收到的SDP消息和ICE信息发送给媒体网关,并随机为P1端口和P2端口分配网络侧对应的媒体端口(即P3端口和P4端口)。 The VoIP signaling server sends the received SDP message and ICE information to the media gateway, and randomly allocates the media ports (ie, P3 port and P4 port) corresponding to the network side to the P1 port and the P2 port.
VoIP信令服务器向用户终端返回SDP响应消息,其中,所述SDP响应消息包含了分配的网络侧对应的媒体端口(即P3端口和P4端口)。The VoIP signaling server returns an SDP response message to the user terminal, where the SDP response message includes the media port corresponding to the allocated network side (ie, the P3 port and the P4 port).
需要说明的是,这里的网络侧媒体端口可以是指媒体网关对应的媒体端口。It should be noted that the network side media port herein may refer to a media port corresponding to the media gateway.
步骤605:用户终端通过媒体端口P1/P2向媒体网关对应的媒体端口P3/P4发送媒体路径的STUN连通性检测请求。Step 605: The user terminal sends a STUN connectivity detection request of the media path to the media port P3/P4 corresponding to the media gateway through the media port P1/P2.
其中,所述STUN连通性检测(STUN Connectivity check)请求用以确定用户终端发送的媒体是否可以直接到达所述媒体网关对应的媒体端口,即用户终端检查从本端媒体端口到媒体网关对应的媒体端口之间的路径是否可通。The STUN Connectivity check (STUN Connectivity check) request is used to determine whether the media sent by the user terminal can directly reach the media port corresponding to the media gateway, that is, the user terminal checks the media corresponding to the media gateway from the local media port to the media gateway. Whether the path between the ports is accessible.
步骤606:用户终端在无法接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。Step 606: When the user terminal cannot receive the STUN connectivity detection response sent by the media gateway, determine that the tunnel type of the transmission tunnel used for traversing the firewall is the DTLS tunnel type.
在步骤606中,若用户终端与媒体网关之间的防火墙没有开通通信双方的协议端口,用户终端将无法接收到所述媒体网关发送的STUN连通性检测响应,此时,用户终端确定为待传输的媒体建立用于穿越防火墙的传输隧道。In step 606, if the firewall between the user terminal and the media gateway does not open the protocol port of the communication party, the user terminal cannot receive the STUN connectivity detection response sent by the media gateway. At this time, the user terminal determines that the user terminal is to be transmitted. The media establishes a transport tunnel for traversing the firewall.
或者说,由于用户终端与媒体网关之间的防火墙具备DPI(Deep Packet Inspection;深度报文检测)功能,可以允许STUN连通性检测请求通过,但是不允许RTP协议数据包/RTCP协议数据包通过,使得用户终端依然无法接收到来自媒体网关的媒体的数据包,此时,用户终端确定为待传输的媒体建立用于穿越防火墙的传输隧道。In other words, because the firewall between the user terminal and the media gateway has the DPI (Deep Packet Inspection) function, the STUN connectivity detection request can be allowed to pass, but the RTP protocol packet/RTCP protocol packet is not allowed to pass. The user terminal still cannot receive the data packet of the media from the media gateway. At this time, the user terminal determines to establish a transmission tunnel for traversing the firewall for the media to be transmitted.
步骤607:用户终端根据确定的DTLS隧道类型,为DTLS隧道类型分配用户终端侧DTLS客户端的端口号。Step 607: The user terminal allocates a port number of the DTLS client of the user terminal to the DTLS tunnel type according to the determined DTLS tunnel type.
需要说明的是,这里的用户终端侧DTLS客户端的端口号也可以被称为用户终端侧的第一端口号。It should be noted that the port number of the DTLS client on the user terminal side herein may also be referred to as the first port number on the user terminal side.
步骤608:用户终端通过SDP消息将所述隧道类型、所述用户终端侧DTLS客户端的端口号和隧道数据包的载荷格式信息发送给VoIP信令服务器,使得 VoIP信令服务器确定采用DTLS隧道方式穿越的防火墙。Step 608: The user terminal sends, by using an SDP message, the tunnel type, the port number of the DTLS client on the user terminal side, and the payload format information of the tunnel data packet to the VoIP signaling server, so that The VoIP signaling server determines the firewall that traverses through the DTLS tunnel.
在步骤608中,SDP携带所述隧道类型、所述用户终端侧DTLS客户端的端口号和隧道数据包的载荷格式信息的方式包括但不限于:In step 608, the manner in which the SDP carries the tunnel type, the port number of the DTLS client on the user terminal side, and the payload format information of the tunnel data packet includes, but is not limited to:
第一种方式:The first way:
定义一个SDP属性行,该SDP属性行用于描述隧道类型、用户终端侧DTLS客户端的端口号、隧道数据包的载荷格式信息。An SDP attribute line is defined. The SDP attribute line is used to describe the tunnel type, the port number of the DTLS client on the user terminal side, and the payload format information of the tunnel data packet.
例如:采用的格式为a=traversal:<本端分配的DTLS端口号><隧道类型><隧道数据包的载荷格式信息>。For example, the format used is a=traversal: <the DTLS port number assigned by the local end><tunnel type><load format information of the tunnel packet>.
本实施例中可以具体描述为a=traversal:P5 DTLS-tunnel UDP-included,表明DTLS客户端端口号为P5,采用DTLS隧道类型,隧道数据包的载荷格式信息为RTP协议数据包/RTCP协议数据包加上UDP报头作为DTLS隧道数据包的载荷。In this embodiment, it can be specifically described as a=traversal: P5 DTLS-tunnel UDP-included, indicating that the DTLS client port number is P5, and the DTLS tunnel type is adopted, and the payload format information of the tunnel data packet is RTP protocol data packet/RTCP protocol data. The packet is added with the UDP header as the payload of the DTLS tunnel packet.
第二种方式:The second way:
对SDP消息中的candidate属性行进行扩展,增加标识位,描述该candidate的路径为隧道类型、隧道数据包的载荷格式信息。The candidate attribute line in the SDP message is extended, and the identifier bit is added, and the path describing the candidate is the tunnel type and the payload format information of the tunnel data packet.
例如:采用a=host candidate:<现有协议参数><隧道类型><隧道数据包的载荷格式信息>。本实例具体可以描述为a=candidate:TCP P5 host candidate TLS-tunnel UDP-included。For example: use a=host candidate:<existing protocol parameter><tunnel type><load format information of tunnel packet>. This example can be specifically described as a=candidate: TCP P5 host candidate TLS-tunnel UDP-included.
步骤609:VoIP信令服务器在接收到用户终端发送的SDP消息,根据SDP消息中包含的所述隧道类型确定采用DTLS隧道方式穿越的防火墙时,固定分配STUN协议默认端口号3478作为DTLS隧道网络侧的端口。Step 609: The VoIP signaling server receives the SDP message sent by the user terminal, and determines the default port number 3478 of the STUN protocol as the DTLS tunnel network side when determining the firewall traversed by the DTLS tunnel mode according to the tunnel type included in the SDP message. Port.
可选地,VoIP信令服务器产生在建立DTLS传输隧道的握手协商过程中用户终端对媒体网关进行认证的认证参数,例如:认证参数可以为媒体网关数字证书指纹或者预共享密钥。Optionally, the VoIP signaling server generates an authentication parameter that the user terminal authenticates the media gateway during the handshake negotiation process of establishing the DTLS transmission tunnel. For example, the authentication parameter may be a media gateway digital certificate fingerprint or a pre-shared key.
此外,VoIP信令服务器通过SDP响应消息将DTLS隧道网络侧的端口号和建立隧道的认证参数发送给用户终端。 In addition, the VoIP signaling server sends the port number of the DTLS tunnel network side and the authentication parameter for establishing the tunnel to the user terminal through the SDP response message.
同时,VoIP信令服务器将建立DTLS隧道的网络侧端口和隧道数据包的载荷格式信息发给媒体网关。At the same time, the VoIP signaling server sends the network format port of the DTLS tunnel and the payload format information of the tunnel data packet to the media gateway.
步骤610:所述用户终端和所述媒体网关根据现有DTLS协议,协商在所述用户终端侧DTLS客户端的端口号和所述网络侧的端口号之间建立DTLS传输隧道。Step 610: The user terminal and the media gateway negotiate to establish a DTLS transmission tunnel between the port number of the DTLS client on the user terminal side and the port number on the network side according to the existing DTLS protocol.
其中,在用户终端与媒体网关之间协商建立DTLS传输隧道时,只需要执行单边认证即可,即用户终端对媒体网关进行认证,因为根据现有ICE协议,在建立DTLS传输隧道之后,用户终端通过DTLS传输隧道发送STUN连通性检测请求,此时,媒体网关采用ICE短期凭证认证机制(short-term credential)对用户终端进行认证。When the DTLS transmission tunnel is established between the user terminal and the media gateway, only the unilateral authentication needs to be performed, that is, the user terminal authenticates the media gateway, because after the DTLS transmission tunnel is established according to the existing ICE protocol, the user The terminal sends a STUN connectivity detection request through the DTLS transmission tunnel. At this time, the media gateway authenticates the user terminal by using an ICE short-term credential mechanism.
需要说明的是,所谓short-term credential实际上就是使用用户终端发送STUN连通性检测请求携带的STUN账号密码进行认证。It should be noted that the so-called short-term credential is actually using the STUN account password carried by the user terminal to send the STUN connectivity detection request for authentication.
媒体网关获取的防火墙为用户终端中的隧道客户端分配的公网地址和VoIP信令服务器发送的所述的隧道客户端私有地址,建立用户终端的私有地址和防火墙为其分配的公网地址之间的映射关系。。The firewall obtained by the media gateway is the public network address allocated by the tunnel client in the user terminal and the private address of the tunnel client sent by the VoIP signaling server, and the private address of the user terminal and the public network address assigned by the firewall are established. The mapping relationship between. .
步骤611:用户终端通过DTLS传输隧道发送STUN连通性检检测请求,在接收到STUN连通性检测响应之后,通过update SDP offer消息通知媒体网关,确定采用DTLS传输隧道穿越防火墙。Step 611: The user terminal sends a STUN connectivity check request through the DTLS transmission tunnel. After receiving the STUN connectivity detection response, the user terminal is notified by the update SDP offer message to determine that the DTLS transmission tunnel is used to traverse the firewall.
步骤612:所述用户终端接收所述网络侧通过建立的DTLS隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。Step 612: The user terminal receives a data packet of a media that is encapsulated by the network side through the established DTLS tunnel and encapsulated according to the payload format information of the tunnel data packet.
在步骤612中,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:In step 612, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
在隧道类型为DTLS隧道类型时,将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述DTLS隧道类型对应的隧道数据包的载荷格式信息封装在DTLS隧道数据包中。When the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS as the payload format information of the tunnel packet corresponding to the DTLS tunnel type. In the tunnel packet.
用户终端和媒体网关按照图3的封装格式,通过DTLS传输隧道,将 RTP/RTCP over UDP协议数据包发送到对端。The user terminal and the media gateway transmit the tunnel through DTLS according to the encapsulation format of FIG. RTP/RTCP over UDP protocol packets are sent to the peer.
实施例五:Embodiment 5:
如图7所示,为本发明实施例五提供的一种媒体传输设备的结构示意图,所述媒体传输设备包括:类型确定模块71、隧道建立模块72和数据包接收模块73,其中:FIG. 7 is a schematic structural diagram of a media transmission device according to Embodiment 5 of the present invention. The media transmission device includes: a type determining module 71, a tunnel establishing module 72, and a data packet receiving module 73, where:
类型确定模块71,用于根据网络地址转换会话传输应用程序STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,其中,所述隧道类型至少包含了传输层安全TLS隧道类型、数据报传输层安全DTLS隧道类型中的一种或者多种;The type determining module 71 is configured to determine, according to the detection result of the network address translation session transmission application STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer security. One or more of the TLS tunnel type and the datagram transport layer security DTLS tunnel type;
隧道建立模块72,用于根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;The tunnel establishment module 72 is configured to allocate, according to the determined tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and use the tunnel type, the first port number, and the tunnel data. The load format information of the packet is sent to the network side, so that the network side allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, where the first port number and the second port number are Establish a transmission tunnel between them;
数据包接收模块73,用于接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。The data packet receiving module 73 is configured to receive, by the network side, the data packet of the media encapsulated according to the load format information of the tunnel data packet that is transmitted by using the established tunnel.
具体地,所述隧道建立模块72将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,具体用于:Specifically, the tunnel establishment module 72 sends the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, specifically for:
将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息携带在会话描述协议SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,并将所述第二端口号发送给媒体网关和所述用户终端;Transmitting the tunnel type, the first port number, and the load format information of the tunnel data packet in a session description protocol SDP message to the IP bearer voice VoIP signaling server, where the VoIP signaling server is based on the tunnel type The transmission tunnel corresponding to the tunnel type allocates a second port number on the network side, and sends the second port number to the media gateway and the user terminal;
通过与所述媒体网关协商,在所述第一端口号和所述第二端口号之间建立传输隧道。A transmission tunnel is established between the first port number and the second port number by negotiating with the media gateway.
具体地,所述类型确定模块71根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于: Specifically, the type determining module 71 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for:
向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;Sending an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol RTCP data. The public address of the port assignment of the packet;
在无法接收到STUN服务器返回的由UDP承载的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。When the UDP bearer address collection response returned by the STUN server cannot be received, it is determined that the tunnel type for the transport tunnel traversing the firewall for the media to be transmitted is the TLS tunnel type.
具体地,所述隧道建立模块72在所述第一端口号和所述第二端口号之间建立传输隧道,具体用于:Specifically, the tunnel establishment module 72 establishes a transmission tunnel between the first port number and the second port number, specifically for:
若所述用户终端确定的隧道类型为TLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立TLS隧道。If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
具体地,所述类型确定模块71根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于:Specifically, the type determining module 71 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for:
向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;Sending an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol RTCP data. The public address of the port assignment of the packet;
在接收到STUN服务器返回的地址收集响应时,进一步通过所述用户终端的媒体端口向媒体网关对应的媒体端口发送媒体路径的STUN连通性检测请求,其中,所述STUN连通性检测请求用以确定用户终端发送的媒体的数据包是否可以直接到达所述媒体网关对应的媒体端口;Upon receiving the address collection response returned by the STUN server, the STUN connectivity detection request of the media path is further sent to the media port corresponding to the media gateway by the media port of the user terminal, where the STUN connectivity detection request is used to determine Whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
在尚未接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。When the STUN connectivity detection response sent by the media gateway has not been received, it is determined that the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a DTLS tunnel type.
具体地,所述隧道建立模块72建立包含了所述第一端口号和所述第二端口号的传输隧道,具体用于:Specifically, the tunnel establishment module 72 establishes a transmission tunnel that includes the first port number and the second port number, specifically for:
若所述用户终端确定的隧道类型为DTLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立DTLS隧道。If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
可选地,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包: Optionally, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
若隧道类型为TLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在TLS隧道数据包中;或If the tunnel type is a TLS tunnel type, the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet; or
若隧道类型为DTLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在DTLS隧道数据包中。If the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
所述UDP协议数据包报头中包含的端口号分别为所述用户终端分配的媒体端口、所述媒体网关分配的媒体端口。The port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
可选地,所述媒体传输设备还包括:解析模块74,其中:Optionally, the media transmission device further includes: a parsing module 74, where:
所述解析模块74,用于对接收到的所述媒体数据包进行解封装,获取TLS隧道数据包/DTLS隧道数据包中的媒体的数据包;The parsing module 74 is configured to decapsulate the received media data packet, and obtain a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
根据所述TLS隧道数据包/DTLS隧道数据包中UDP协议数据包报头中包含的端口号,将所述媒体的数据包发送给媒体处理单元。And transmitting, according to the port number included in the UDP protocol packet header in the TLS tunnel data packet/DTLS tunnel data packet, the data packet of the media to the media processing unit.
需要说明的是,本发明实施例五所述的媒体传输设备可以通过硬件方式实现,也可以通过软件方式实现,这里不做限定。It should be noted that the media transmission device in the fifth embodiment of the present invention may be implemented in a hardware manner or in a software manner, which is not limited herein.
实施例六:Example 6:
如图8所示,为本发明实施例六提供的一种媒体传输设备的结构示意图。所述媒体传输设备具备本发明实例一至本发明实施例四的功能,所述媒体传输设备可以采用通用计算机系统结构,计算机系统可具体是基于处理器的计算机。所述媒体传输设备实体包括至少一个处理器81,通信总线82,存储器83以及至少一个通信接口84。FIG. 8 is a schematic structural diagram of a media transmission device according to Embodiment 6 of the present invention. The media transmission device has the functions of the first embodiment of the present invention to the fourth embodiment of the present invention. The media transmission device may adopt a general computer system structure, and the computer system may be a processor-based computer. The media transport device entity includes at least one processor 81, a communication bus 82, a memory 83, and at least one communication interface 84.
处理器81可以是一个通用中央处理器(CPU),微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制本发明方案程序执行的集成电路。The processor 81 can be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present invention.
其中,所述通信总线82可包括一通路,在上述组件之间传送信息。所述通信接口84,使用任何收发器一类的装置,用于与其他设备或通信网络通信, 如以太网,无线接入网(RAN),无线局域网(Wireless Local Area Networks,WLAN)等。Wherein, the communication bus 82 can include a path for transferring information between the components. The communication interface 84, using any device such as a transceiver, for communicating with other devices or communication networks, Such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.
存储器83,可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。这些存储器通过总线与处理器相连接。The memory 83 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM), or other information that can store information and instructions. Type of dynamic storage device, or Electrostatic Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, optical disc Storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other medium accessed by the computer, but is not limited to this. These memories are connected to the processor via a bus.
其中,所述存储器83用于存储执行本发明方案的应用程序代码,执行本发明方案的应用程序代码保存在存储器中,并由处理器81来控制执行。所述处理器81用于执行所述存储器83中存储的应用程序。The memory 83 is used to store application code for executing the solution of the present invention, and the application code for executing the solution of the present invention is stored in a memory and controlled by the processor 81 for execution. The processor 81 is configured to execute an application stored in the memory 83.
在一种可能的实施方式中,当上述应用程序被所述处理器81执行时,实现如下功能:In a possible implementation manner, when the application is executed by the processor 81, the following functions are implemented:
根据网络地址转换会话传输应用程序STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,其中,所述隧道类型至少包含了传输层安全TLS隧道类型、数据报传输层安全DTLS隧道类型中的一种或者多种;Determining, according to the detection result of the network address translation session transmission application STUN, a tunnel type for a transmission tunnel traversing the firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer secure TLS tunnel type and datagram transmission. One or more of the layers of secure DTLS tunnel types;
根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;Assigning, by the determined tunnel type, a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type, and sending the tunnel type, the first port number, and the load format information of the tunnel data packet to The network side, the network side is configured to allocate a second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and establish a transmission tunnel between the first port number and the second port number;
接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的 载荷格式信息封装的媒体的数据包。Receiving, by the network side, the tunnel data packet that is transmitted through the established transmission tunnel The data packet of the media packaged by the payload format information.
在一种可能的实施方式中,所述处理器81将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,具体用于执行:In a possible implementation, the processor 81 sends the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, specifically for performing:
所述用户终端将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息携带在会话描述协议SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,并将所述第二端口号发送给媒体网关和所述用户终端;Transmitting, by the user terminal, the tunnel type, the first port number, and the load format information of the tunnel data packet in a session description protocol SDP message to the IP bearer voice VoIP signaling server, where the VoIP signaling server is configured according to the The tunnel type is a second port number of the network side of the transmission tunnel corresponding to the tunnel type, and the second port number is sent to the media gateway and the user terminal;
所述用户终端通过与所述媒体网关协商,在所述第一端口号和所述第二端口号之间建立传输隧道。The user terminal establishes a transmission tunnel between the first port number and the second port number by negotiating with the media gateway.
在一种可能的实施方式中,所述处理器81根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于执行:In a possible implementation manner, the processor 81 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for performing:
所述用户终端向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;The user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting real-time transmission. Controlling the public address of the port assignment of the protocol RTCP packet;
所述用户终端在无法接收到STUN服务器返回的由UDP承载的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。When the user terminal cannot receive the address collection response of the UDP bearer returned by the STUN server, it determines that the tunnel type of the transport tunnel for traversing the firewall for the media to be transmitted is the TLS tunnel type.
在一种可能的实施方式中,所述处理器81在所述第一端口号和所述第二端口号之间建立传输隧道,具体用于执行:In a possible implementation, the processor 81 establishes a transmission tunnel between the first port number and the second port number, specifically for performing:
若所述用户终端确定的隧道类型为TLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立TLS隧道。If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
在一种可能的实施方式中,所述处理器81根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于执行:In a possible implementation manner, the processor 81 determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the media to be transmitted, specifically for performing:
用户终端向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议 RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;The user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting the real-time transmission protocol. The port of the RTP packet and the public address of the port for transmitting the real-time transport control protocol RTCP packet;
所述用户终端在接收到STUN服务器返回的地址收集响应时,进一步通过所述用户终端的媒体端口向媒体网关对应的媒体端口发送媒体路径的STUN连通性检测请求,其中,所述STUN连通性检测请求用以确定用户终端发送的媒体的数据包是否可以直接到达所述媒体网关对应的媒体端口;When receiving the address collection response returned by the STUN server, the user terminal further sends a STUN connectivity detection request of the media path to the media port corresponding to the media gateway by using the media port of the user terminal, where the STUN connectivity detection is performed. Determining whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
所述用户终端在尚未接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。When the user terminal has not received the STUN connectivity detection response sent by the media gateway, the user terminal determines that the tunnel type of the transmission tunnel for traversing the firewall is the DTLS tunnel type.
在一种可能的实施方式中,所述处理器81建立包含了所述第一端口号和所述第二端口号的传输隧道,具体用于执行:In a possible implementation, the processor 81 establishes a transmission tunnel that includes the first port number and the second port number, specifically for performing:
若所述用户终端确定的隧道类型为DTLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立DTLS隧道。If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
具体地,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:Specifically, the data packet of the media is encapsulated according to the payload format information of the tunnel data packet by:
若隧道类型为TLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在TLS隧道数据包中;或If the tunnel type is a TLS tunnel type, the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet; or
若隧道类型为DTLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在DTLS隧道数据包中。If the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
具体地,所述UDP协议数据包报头中包含的端口号分别为所述用户终端分配的媒体端口、所述媒体网关分配的媒体端口。Specifically, the port number included in the UDP protocol packet header is respectively a media port allocated by the user terminal and a media port allocated by the media gateway.
在一种可能的实施方式中,所述处理器81,还用于对接收到的所述媒体数据包进行解封装,获取TLS隧道数据包/DTLS隧道数据包中的媒体的数据包;In a possible implementation manner, the processor 81 is further configured to decapsulate the received media data packet to obtain a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
根据所述TLS隧道数据包/DTLS隧道数据包中UDP协议数据包报头中包 含的端口号,将所述媒体的数据包发送给媒体处理单元。According to the UDP tunnel packet/DTLS tunnel packet, the packet in the UDP protocol packet header The port number included, the data packet of the media is sent to the media processing unit.
本实施例中,应用程序被处理器执行时,媒体传输设备的处理,以及与其他网元之间的交互方法可以参考上述方法实施例。这里不再详细描述。In this embodiment, when the application is executed by the processor, the processing of the media transmission device, and the interaction method with other network elements, reference may be made to the foregoing method embodiment. It will not be described in detail here.
本领域的技术人员应明白,本发明的实施例可提供为方法、装置(设备)、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, apparatus (device), or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、装置(设备)和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus, and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。 While the preferred embodiment of the invention has been described, it will be understood that Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。 It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims (18)

  1. 一种媒体传输方法,其特征在于,包括:A media transmission method, comprising:
    用户终端根据网络地址转换会话传输应用程序STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,其中,所述隧道类型至少包含了传输层安全TLS隧道类型、数据报传输层安全DTLS隧道类型中的一种或者多种;The user terminal determines, according to the detection result of the network address translation session transmission application STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer secure TLS tunnel type and data. Reporting one or more of the transport layer security DTLS tunnel types;
    所述用户终端根据确定的所述隧道类型,为所述隧道类型对应的传输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;The user terminal allocates a first port number on the user terminal side to the transmission tunnel corresponding to the tunnel type according to the determined tunnel type, and loads the tunnel type, the first port number, and the tunnel data packet. The format information is sent to the network side, so that the network side allocates the second port number of the network side to the transmission tunnel corresponding to the tunnel type according to the tunnel type, and establishes between the first port number and the second port number. Transmission tunnel
    所述用户终端接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。Receiving, by the user terminal, a data packet of a media encapsulated according to the load format information of the tunnel data packet that is transmitted by the network side through the established transmission tunnel.
  2. 如权利要求1所述的媒体传输方法,其特征在于,所述用户终端将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,包括:The media transmission method according to claim 1, wherein the user terminal sends the tunnel type, the first port number, and the payload format information of the tunnel data packet to the network side, including:
    所述用户终端将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息携带在会话描述协议SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,并将所述第二端口号发送给媒体网关和所述用户终端;Transmitting, by the user terminal, the tunnel type, the first port number, and the load format information of the tunnel data packet in a session description protocol SDP message to the IP bearer voice VoIP signaling server, where the VoIP signaling server is configured according to the The tunnel type is a second port number of the network side of the transmission tunnel corresponding to the tunnel type, and the second port number is sent to the media gateway and the user terminal;
    所述用户终端通过与所述媒体网关协商,在所述第一端口号和所述第二端口号之间建立传输隧道。The user terminal establishes a transmission tunnel between the first port number and the second port number by negotiating with the media gateway.
  3. 如权利要求1或2所述的媒体传输方法,其特征在于,所述用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,包括: The medium transmission method according to claim 1 or 2, wherein the user terminal determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, including:
    所述用户终端向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;The user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting real-time transmission. Controlling the public address of the port assignment of the protocol RTCP packet;
    所述用户终端在无法接收到STUN服务器返回的由UDP承载的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。When the user terminal cannot receive the address collection response of the UDP bearer returned by the STUN server, it determines that the tunnel type of the transport tunnel for traversing the firewall for the media to be transmitted is the TLS tunnel type.
  4. 如权利要求1至3任一所述的媒体传输方法,其特征在于,所述用户终端在所述第一端口号和所述第二端口号之间建立传输隧道,具体包括:The media transmission method according to any one of claims 1 to 3, wherein the user terminal establishes a transmission tunnel between the first port number and the second port number, which specifically includes:
    若所述用户终端确定的隧道类型为TLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立TLS隧道。If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
  5. 如权利要求1或2所述的媒体传输方法,其特征在于,用户终端根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,包括:The medium transmission method according to claim 1 or 2, wherein the user terminal determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, including:
    用户终端向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;The user terminal sends an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol. The public address of the port assignment of the RTCP packet;
    所述用户终端在接收到STUN服务器返回的地址收集响应时,进一步通过所述用户终端的媒体端口向媒体网关对应的媒体端口发送媒体路径的STUN连通性检测请求,其中,所述STUN连通性检测请求用以确定用户终端发送的媒体的数据包是否可以直接到达所述媒体网关对应的媒体端口;When receiving the address collection response returned by the STUN server, the user terminal further sends a STUN connectivity detection request of the media path to the media port corresponding to the media gateway by using the media port of the user terminal, where the STUN connectivity detection is performed. Determining whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
    所述用户终端在尚未接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。When the user terminal has not received the STUN connectivity detection response sent by the media gateway, the user terminal determines that the tunnel type of the transmission tunnel for traversing the firewall is the DTLS tunnel type.
  6. 如权利要求1或2或5所述的媒体传输方法,其特征在于,所述用户 终端建立包含了所述第一端口号和所述第二端口号的传输隧道,具体包括:A media transmission method according to claim 1 or 2 or 5, wherein said user The terminal establishes a transmission tunnel that includes the first port number and the second port number, and specifically includes:
    若所述用户终端确定的隧道类型为DTLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立DTLS隧道。If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
  7. 如权利要求1至6任一所述的媒体传输方法,其特征在于,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:The media transmission method according to any one of claims 1 to 6, wherein the data packet of the medium is encapsulated according to the payload format information of the tunnel data packet by:
    若隧道类型为TLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在TLS隧道数据包中;或If the tunnel type is a TLS tunnel type, the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet; or
    若隧道类型为DTLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在DTLS隧道数据包中。If the tunnel type is a DTLS tunnel type, the RTP protocol packet/RTCP protocol packet and the UDP protocol packet header included in the media packet are encapsulated in the DTLS tunnel packet as the payload format information of the tunnel packet.
  8. 如权利要求7所述的媒体传输方法,其特征在于,所述UDP协议数据包报头中包含的端口号分别为所述用户终端分配的媒体端口、所述媒体网关分配的媒体端口。The media transmission method according to claim 7, wherein the port number included in the UDP protocol packet header is a media port allocated by the user terminal and a media port allocated by the media gateway.
  9. 如权利要求7或8所述的媒体传输方法,其特征在于,所述媒体传输方法还包括:The media transmission method according to claim 7 or 8, wherein the media transmission method further comprises:
    所述用户终端对接收到的所述媒体数据包进行解封装,获取TLS隧道数据包/DTLS隧道数据包中的媒体的数据包;The user terminal decapsulates the received media data packet, and acquires a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
    根据所述TLS隧道数据包/DTLS隧道数据包中UDP协议数据包报头中包含的端口号,将所述媒体的数据包发送给媒体处理单元。And transmitting, according to the port number included in the UDP protocol packet header in the TLS tunnel data packet/DTLS tunnel data packet, the data packet of the media to the media processing unit.
  10. 一种媒体传输设备,其特征在于,包括:A media transmission device, comprising:
    类型确定模块,用于根据网络地址转换会话传输应用程序STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,其中,所述隧道类型至少包含了传输层安全TLS隧道类型、数据报传输层安全DTLS隧道类型中的一种或者多种;a type determining module, configured to determine, according to a detection result of the network address translation session transmission application STUN, a tunnel type for a transmission tunnel traversing a firewall for the medium to be transmitted, where the tunnel type includes at least a transport layer security TLS One or more of tunnel type, datagram transport layer security DTLS tunnel type;
    隧道建立模块,用于根据确定的所述隧道类型,为所述隧道类型对应的传 输隧道分配用户终端侧的第一端口号,并将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,使网络侧根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,在所述第一端口号和所述第二端口号之间建立传输隧道;a tunnel establishment module, configured to transmit, according to the determined tunnel type, the tunnel type The transmission tunnel allocates a first port number on the user terminal side, and sends the tunnel type, the first port number, and the load format information of the tunnel data packet to the network side, so that the network side is the tunnel according to the tunnel type. a transmission tunnel corresponding to the type of the second port number on the network side, and establishing a transmission tunnel between the first port number and the second port number;
    数据包接收模块,用于接收所述网络侧通过建立的所述传输隧道传输的、按照所述隧道数据包的载荷格式信息封装的媒体的数据包。And a data packet receiving module, configured to receive, by the network side, a data packet of the media encapsulated according to the load format information of the tunnel data packet that is transmitted by using the established transmission tunnel.
  11. 如权利要求10所述的媒体传输设备,其特征在于,所述隧道建立模块将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息发送给网络侧,具体用于:The media transmission device according to claim 10, wherein the tunnel establishment module sends the tunnel type, the first port number, and the payload format information of the tunnel data packet to the network side, specifically for:
    将所述隧道类型、所述第一端口号和隧道数据包的载荷格式信息携带在会话描述协议SDP消息中发送给IP承载语音VoIP信令服务器,由VoIP信令服务器根据所述隧道类型为所述隧道类型对应的传输隧道分配网络侧的第二端口号,并将所述第二端口号发送给媒体网关和所述用户终端;Transmitting the tunnel type, the first port number, and the load format information of the tunnel data packet in a session description protocol SDP message to the IP bearer voice VoIP signaling server, where the VoIP signaling server is based on the tunnel type The transmission tunnel corresponding to the tunnel type allocates a second port number on the network side, and sends the second port number to the media gateway and the user terminal;
    通过与所述媒体网关协商,在所述第一端口号和所述第二端口号之间建立传输隧道。A transmission tunnel is established between the first port number and the second port number by negotiating with the media gateway.
  12. 如权利要求10或11所述的媒体传输设备,其特征在于,所述类型确定模块根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于:The medium transmission device according to claim 10 or 11, wherein the type determining module determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, specifically for:
    向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;Sending an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol RTCP data. The public address of the port assignment of the packet;
    在无法接收到STUN服务器返回的由UDP承载的地址收集响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为TLS隧道类型。When the UDP bearer address collection response returned by the STUN server cannot be received, it is determined that the tunnel type for the transport tunnel traversing the firewall for the media to be transmitted is the TLS tunnel type.
  13. 如权利要求10至12任一所述的媒体传输设备,其特征在于,所述隧道建立模块在所述第一端口号和所述第二端口号之间建立传输隧道,具体用于: The media transmission device according to any one of claims 10 to 12, wherein the tunnel establishment module establishes a transmission tunnel between the first port number and the second port number, specifically for:
    若所述用户终端确定的隧道类型为TLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立TLS隧道。If the tunnel type determined by the user terminal is a TLS tunnel type, the user terminal establishes a TLS tunnel between the first port number and the second port number.
  14. 如权利要求10或11所述的媒体传输设备,其特征在于,所述类型确定模块根据STUN的探测结果,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型,具体用于:The medium transmission device according to claim 10 or 11, wherein the type determining module determines, according to the detection result of the STUN, a tunnel type for establishing a transmission tunnel for traversing the firewall for the medium to be transmitted, specifically for:
    向STUN服务器发送由用户数据报协议UDP承载的地址收集请求,其中,所述地址收集请求用于获取防火墙分别为用于传输实时传输协议RTP数据包的端口和用于传输实时传输控制协议RTCP数据包的端口分配的公用地址;Sending an address collection request carried by the user datagram protocol UDP to the STUN server, where the address collection request is used to obtain a firewall for transmitting a real-time transport protocol RTP data packet and for transmitting a real-time transmission control protocol RTCP data. The public address of the port assignment of the packet;
    在接收到STUN服务器返回的地址收集响应时,进一步通过所述用户终端的媒体端口向媒体网关对应的媒体端口发送媒体路径的STUN连通性检测请求,其中,所述STUN连通性检测请求用以确定用户终端发送的媒体的数据包是否可以直接到达所述媒体网关对应的媒体端口;Upon receiving the address collection response returned by the STUN server, the STUN connectivity detection request of the media path is further sent to the media port corresponding to the media gateway by the media port of the user terminal, where the STUN connectivity detection request is used to determine Whether the data packet of the media sent by the user terminal can directly reach the media port corresponding to the media gateway;
    在尚未接收到所述媒体网关发送的STUN连通性检测响应时,确定为待传输的媒体建立用于穿越防火墙的传输隧道的隧道类型为DTLS隧道类型。When the STUN connectivity detection response sent by the media gateway has not been received, it is determined that the tunnel type of the transmission tunnel for traversing the firewall for the media to be transmitted is a DTLS tunnel type.
  15. 如权利要求10或11或14所述的媒体传输设备,其特征在于,所述隧道建立模块建立包含了所述第一端口号和所述第二端口号的传输隧道,具体用于:The media transmission device according to claim 10 or 11 or 14, wherein the tunnel establishment module establishes a transmission tunnel including the first port number and the second port number, specifically for:
    若所述用户终端确定的隧道类型为DTLS隧道类型,则所述用户终端在所述第一端口号和所述第二端口号之间建立DTLS隧道。If the tunnel type determined by the user terminal is a DTLS tunnel type, the user terminal establishes a DTLS tunnel between the first port number and the second port number.
  16. 如权利要求10至15任一所述的媒体传输设备,其特征在于,通过以下方式按照所述隧道数据包的载荷格式信息封装媒体的数据包:The media transmission device according to any one of claims 10 to 15, wherein the data packet of the medium is encapsulated according to the payload format information of the tunnel data packet by:
    若隧道类型为TLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式信息封装在TLS隧道数据包中;或If the tunnel type is a TLS tunnel type, the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are encapsulated in the TLS tunnel data packet as the payload format information of the tunnel data packet; or
    若隧道类型为DTLS隧道类型,则将媒体的数据包中包含的RTP协议数据包/RTCP协议数据包与UDP协议数据包报头作为所述隧道数据包的载荷格式 信息封装在DTLS隧道数据包中。If the tunnel type is a DTLS tunnel type, the RTP protocol data packet/RTCP protocol data packet and the UDP protocol data packet header included in the data packet of the media are used as the payload format of the tunnel data packet. The information is encapsulated in a DTLS tunnel packet.
  17. 如权利要求16所述的媒体传输设备,其特征在于,所述UDP协议数据包报头中包含的端口号分别为所述用户终端分配的媒体端口、所述媒体网关分配的媒体端口。The media transmission device according to claim 16, wherein the port number included in the UDP protocol packet header is a media port allocated by the user terminal and a media port allocated by the media gateway.
  18. 如权利要求16或17所述的媒体传输设备,其特征在于,所述媒体传输设备还包括:解析模块,其中:The media transmission device according to claim 16 or 17, wherein the media transmission device further comprises: a parsing module, wherein:
    所述解析模块,用于对接收到的所述媒体数据包进行解封装,获取TLS隧道数据包/DTLS隧道数据包中的媒体的数据包;The parsing module is configured to decapsulate the received media data packet, and obtain a data packet of a media in a TLS tunnel data packet/DTLS tunnel data packet;
    根据所述TLS隧道数据包/DTLS隧道数据包中UDP协议数据包报头中包含的端口号,将所述媒体的数据包发送给媒体处理单元。 And transmitting, according to the port number included in the UDP protocol packet header in the TLS tunnel data packet/DTLS tunnel data packet, the data packet of the media to the media processing unit.
PCT/CN2015/092103 2014-10-31 2015-10-16 Media transmission method and device WO2016066027A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201410616529.6 2014-10-31
CN201410616529 2014-10-31
CN201410623767.XA CN105635076B (en) 2014-10-31 2014-11-07 A kind of media transmission method and equipment
CN201410623767.X 2014-11-07

Publications (1)

Publication Number Publication Date
WO2016066027A1 true WO2016066027A1 (en) 2016-05-06

Family

ID=55856585

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/092103 WO2016066027A1 (en) 2014-10-31 2015-10-16 Media transmission method and device

Country Status (2)

Country Link
CN (1) CN105635076B (en)
WO (1) WO2016066027A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9998299B2 (en) * 2016-07-20 2018-06-12 Oracle International Corporation Efficient transport of encapsulated media traffic over restrictive networks
US10015097B2 (en) * 2016-08-19 2018-07-03 Oracle International Corporation Fast access telecommunication tunnel cloning
CN110266902B (en) * 2019-05-27 2021-04-02 国家计算机网络与信息安全管理中心 VoIP signaling and media data association system and method
CN114338153B (en) * 2021-12-28 2023-07-25 杭州迪普科技股份有限公司 IPSec negotiation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1819134B1 (en) * 2006-02-13 2008-11-12 Samsung Electronics Co.,Ltd. Symmetric network adress translation system using STUN technique and method for implementing the same
CN102685141A (en) * 2012-05-22 2012-09-19 北京邮电大学 Fusion traversing method based on voice accessibility in VoIP (Voice over Internet Protocol)
CN103392316A (en) * 2013-01-11 2013-11-13 华为技术有限公司 Method of traversing firewall, client, and media traversing server

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101883056B (en) * 2010-07-23 2013-03-20 华南理工大学 Method for realizing NAT (Network Address Translation) traversal on basis of UDT (UDP (User Datagram Protocol)-based Data Transfer) and TCP (Transmission Control Protocol) transfer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1819134B1 (en) * 2006-02-13 2008-11-12 Samsung Electronics Co.,Ltd. Symmetric network adress translation system using STUN technique and method for implementing the same
CN102685141A (en) * 2012-05-22 2012-09-19 北京邮电大学 Fusion traversing method based on voice accessibility in VoIP (Voice over Internet Protocol)
CN103392316A (en) * 2013-01-11 2013-11-13 华为技术有限公司 Method of traversing firewall, client, and media traversing server

Also Published As

Publication number Publication date
CN105635076A (en) 2016-06-01
CN105635076B (en) 2019-08-20

Similar Documents

Publication Publication Date Title
KR101680955B1 (en) Multi-tunnel virtual private network
US11848961B2 (en) HTTPS request enrichment
US9813380B2 (en) Method, apparatus, and network system for terminal to traverse private network to communicate with server in IMS core network
US8725885B1 (en) Securely establishing ice relay connections
US8914522B2 (en) Systems and methods for facilitating a peer to peer route via a gateway
EP2839384B1 (en) Redundancy for real time communications
US10313397B2 (en) Methods and devices for access control of data flows in software defined networking system
US9350711B2 (en) Data transmission method, system, and apparatus
US11388145B2 (en) Tunneling data traffic and signaling over secure etls over wireless local area networks
WO2016066027A1 (en) Media transmission method and device
CN112751816B (en) Tunnel establishment method, device, equipment and computer readable storage medium
WO2023274146A1 (en) Remote access method, electronic device, and storage medium
JP2011077887A (en) Packet transfer system, packet transfer method, communication apparatus and packet transfer program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15854777

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15854777

Country of ref document: EP

Kind code of ref document: A1