[go: up one dir, main page]

WO2012034309A1 - Method, terminal and system for file transfers between session initiation protocol (sip) terminals in network address translation (nat) network - Google Patents

Method, terminal and system for file transfers between session initiation protocol (sip) terminals in network address translation (nat) network Download PDF

Info

Publication number
WO2012034309A1
WO2012034309A1 PCT/CN2010/078797 CN2010078797W WO2012034309A1 WO 2012034309 A1 WO2012034309 A1 WO 2012034309A1 CN 2010078797 W CN2010078797 W CN 2010078797W WO 2012034309 A1 WO2012034309 A1 WO 2012034309A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
server
channel
destination terminal
source
Prior art date
Application number
PCT/CN2010/078797
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 WO2012034309A1 publication Critical patent/WO2012034309A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • H04L61/2564NAT traversal for a higher-layer protocol, e.g. for session initiation protocol [SIP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal
    • H04L61/2589NAT traversal over a relay server, e.g. traversal using relay for network address translation [TURN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1101Session protocols
    • H04L65/1104Session initiation protocol [SIP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/52Network services specially adapted for the location of the user terminal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]

Definitions

  • the present invention relates to the field of communications, and in particular, to a method, a terminal, and a system for transferring files between SIP terminals in an IMS service NAT network. Background technique
  • file transfer is one of the must-have features available to users.
  • the file transfer function provides a way to transfer files between different users in real time, which is a good way to share documents, pictures and multimedia files.
  • IPv4, Internet Protocol v4 Internet Protocol
  • NAT Network Address Translation
  • a NAT network device allows multiple hosts on the same NAT network device to share a public network (usually the network behind the same NAT network device is called the private network and the network in front of the NAT network device is called the public network).
  • a private IP address communicates with other hosts on the public network through a NAT network device.
  • direct interworking between hosts in the private network behind different NAT network devices is not possible.
  • the file transfer mechanism of the SIP terminal is based on the Session Initiation Protocol (SIP), the Message Session Relay Protocol (MSRP), and the Session Discription Protocol (SDP). That is, each SIP terminal performs session negotiation through an invite (session message), and media information negotiation through SDP. If the session negotiation is successful, between the file sender (source terminal) and the server, the server and the file receiver ( The destination channel is respectively established with a transmission channel; after that, the file is first transmitted from the sender to the server by using the MSRP protocol, and then transferred from the server. To the recipient.
  • SIP Session Initiation Protocol
  • MSRP Message Session Relay Protocol
  • SDP Session Discription Protocol
  • the main purpose of the present invention is to provide a method, a terminal and a system for file transmission between SIP terminals in a NAT network, which can improve file transmission efficiency between SIP terminals and save network resources.
  • the invention provides a method for transferring files between SIP terminals in a NAT network, comprising: the source terminal establishes a TCP direct communication channel with a transmission control protocol between the destination terminal and the destination terminal;
  • the source terminal performs file transmission with the destination terminal through the established TCP direct connection channel.
  • the source terminal establishes a TCP direct connection channel with the destination terminal by using the server: the source terminal sends a NAT address and a port, and a file transmission request carrying the file identifier to the destination terminal through the server;
  • a TCP direct communication channel is established by using a NAT address and a port of each of the source terminal and the destination terminal.
  • the source terminal After the source terminal establishes a TCP direct connection channel with the destination terminal through the server, the source terminal further includes:
  • the source terminal establishes a source MSRP channel with the server
  • the source terminal performs file transmission with the destination terminal through the source MSRP channel and the destination MSRP channel between the destination terminal and the server.
  • the specific configuration of the source MSRP channel between the source terminal and the server includes: Sending, by the server, a session request message to the destination terminal by using a server;
  • the source terminal After the destination MSRP channel between the destination terminal and the server is successfully established, the source terminal receives the response message from the destination terminal that is fed back by the server;
  • the remote terminal establishes a source MSRP channel with the server according to the response message.
  • the present invention also provides a terminal for transferring files between SIP terminals in a NAT network, including a direct connection channel establishment module and a first file transmission module, where:
  • a direct channel establishing module configured to establish a TCP direct connection channel with the destination terminal through the server
  • the first file transmission module is configured to perform file transmission with the destination terminal through the established TCP direct connection channel.
  • the direct channel establishing module includes a first sending unit, a first receiving unit, and a first establishing unit, where:
  • a first sending unit configured to send, by using the server, a NAT address and a port of the terminal, and a file transmission request carrying a file identifier to the destination terminal;
  • a first receiving unit configured to receive a NAT address and a port of the destination terminal that is sent by the destination terminal by using the server, and a response message that is sent by the destination terminal to agree to receive a file
  • a first establishing unit configured to pass the terminal The TCP direct connection channel is established with the respective NAT address and port of the destination terminal.
  • the terminal further includes an MSRP channel establishment module and a second file transmission module, where: the through channel establishment module is further configured to notify the MSRP channel establishment module when the TCP direct connection channel fails to be established;
  • An MSRP channel establishing module configured to establish a source MSRP channel with the server when receiving a TCP direct channel establishment failure notification
  • a second file transmission module configured to pass the source MSRP channel and the destination terminal
  • the destination MSRP channel between the servers performs file transfer with the destination terminal.
  • the MSRP channel establishment module includes a second sending unit, a second receiving unit, and a second establishing unit, where:
  • a second sending unit configured to send a session request message to the destination terminal by using the server
  • a second receiving unit configured to receive a response message that is sent back by the server after the destination MSRP channel between the destination terminal and the server is successfully established
  • a second establishing unit configured to establish a source MSRP channel with the server according to the response message.
  • the present invention also provides a system for transferring files between SIP terminals in a NAT network, including: a source terminal, a server, and a destination terminal, wherein the source terminal and the destination terminal are respectively connected to the server through a NAT network device;
  • a source terminal configured to establish, by using the server, a TCP direct connection channel with the destination terminal; and perform file transmission with the destination terminal by using the TCP direct connection channel;
  • a server configured to establish, by the NAT network device, the TCP direct connection channel between the source terminal and the destination terminal by using the source terminal;
  • the destination terminal is configured to establish, by the server, the TCP direct communication channel with the source terminal, and perform file transmission with the source terminal by using the TCP direct connection channel.
  • the server is further configured to receive a file transfer request that is sent by the source terminal and that carries the file identifier, and obtain a NAT address and a port of the source terminal; forward the file transfer request to the destination terminal, and simultaneously use the source Sending a NAT address and a port of the terminal to the destination terminal; and forwarding a response message of the consent receiving file fed back by the destination terminal to the source terminal, and sending the NAT address and port of the destination terminal to the source terminal.
  • the server is an application server AS.
  • the invention provides a method, a terminal and a system for transferring files between SIP terminals in a NAT network, and dynamically selects a channel for file transmission based on the network topology structure of the SIP terminal, that is, when two SIPs When the terminal is in a private network behind different NAT network devices, a traversal is established between the two SIP terminals.
  • the TCP direct connection channel of the NAT network so that the two-way file transmission between the two SIP terminals is realized without using the MSRP channel of the server relay, thereby effectively utilizing the network topology structure, improving the file transmission rate and reducing the file transmission rate.
  • the occupation of the network bandwidth further reduces the load on the server, and the file transmission mode provided by the present invention supports breakpoint retransmission.
  • the server can still switch to the server-transferred MSRP channel for file transmission, which makes the file transmission mode selective and flexible.
  • FIG. 1 is a flow chart of a first embodiment of a method for transferring files between SIP terminals in a NAT network according to the present invention
  • FIG. 2 is a flow chart of file transmission between a TCP direct connection channel and a destination terminal in a first embodiment of a method for transferring file between SIP terminals in a NAT network according to the present invention
  • FIG. 3 is a flow chart showing a second embodiment of a method for transferring files between SIP terminals in a NAT network according to the present invention
  • FIG. 4 is a flowchart of a source MSRP channel established between a source terminal and a server in a second embodiment of a method for transferring file between SIP terminals in a NAT network according to the present invention
  • FIG. 5 is a schematic structural diagram of a first embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention
  • FIG. 6 is a schematic structural diagram of a direct connection channel establishment module in a first embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention
  • FIG. 7 is a schematic structural diagram of a second embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention.
  • FIG. 8 is a schematic structural diagram of an MSRP channel establishment module in a second embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention
  • FIG. 9 is a diagram of a first embodiment of a system for transferring files between SIP terminals in a NAT network according to the present invention. Schematic diagram. detailed description
  • the solution of the embodiment of the present invention is to dynamically enable a TCP (Transmission Control Protocol) direct connection channel or an MSRP channel to perform file transmission according to the network topology SIP terminal.
  • TCP Transmission Control Protocol
  • MSRP Mobile Radio Service
  • a first embodiment of the present invention provides a method for file transfer between SIP terminals in a NAT network, including:
  • Step 101 The source terminal establishes a Transmission Control Protocol (TCP) direct connection channel with the destination terminal through the server.
  • TCP Transmission Control Protocol
  • Step 102 Perform file transmission with the destination terminal through the TCP direct connection channel.
  • the operating environment of the method of the present invention shown in Figure 1 is based on the network topology in which the SIP terminal is located in the IMS environment.
  • the SIP terminals are connected to the application server (hereinafter referred to as the server) through the respective NAT network devices.
  • the server application server
  • most of the SIP terminals in the IMS environment use the MSRP channel mode of the server to transfer files.
  • Transmission which does not effectively support file transfer for SIP terminals in different subnets, that is, the SIP terminals in the private network behind different NAT network devices can only transmit files through the MSRP channel relayed by the server.
  • the file transfer method has the disadvantage of occupying a large amount of network bandwidth for a long time when transferring large files, and the transfer speed is extremely susceptible to server performance and network bandwidth.
  • two SIP terminals that need to perform file transmission in the private network behind different NAT network devices are respectively referred to as a source terminal and a destination terminal, and in order to directly perform file transmission between the source terminal and the destination terminal, Establish a TCP direct connection channel between the source terminal and the destination terminal.
  • the source terminal and the destination terminal can implement file transmission without passing through the MSRP channel of the server transit, thereby effectively utilizing the network topology and improving the network topology.
  • File transfer The rate reduces the occupation of network bandwidth and reduces the load on the server.
  • step 101 in FIG. 1 includes:
  • Step 1021 The source terminal sends its own NAT address and port, and a file transfer request carrying the file identifier to the destination terminal through the server.
  • Step 1022 After receiving the file transmission request, the destination terminal sends its own NAT address and port through the server, and a response message to the source terminal that agrees to receive the file.
  • Step 1023 Establish a TCP direct connection channel through the NAT address and port of the source terminal and the destination terminal.
  • the source terminal and the destination terminal are connected to the server through respective NAT network devices (hereinafter referred to as source NAT and destination NAT respectively), that is, the source terminal is behind the source NAT, and the destination terminal is behind the destination NAT.
  • the source terminal and the destination terminal exchange file transfer information and their respective NAT addresses and ports through the server.
  • the process of establishing a TCP direct connection channel between the source terminal and the destination terminal is specifically as follows:
  • the source terminal needs to send the file transmission request to the destination terminal.
  • the server needs to start two port listening, that is, primary listening and auxiliary listening; and each terminal needs to keep in touch with the server's main listening. .
  • the source terminal sends a file transfer request to the secondary listening port of the server.
  • the file transfer request includes a file identifier, and the server obtains the NAT address and port of the source terminal after the source NAT is converted.
  • the server forwards the file transmission request sent by the source terminal to the destination terminal through the primary listening port, and sends the source terminal to the destination terminal through the source NAT-transformed NAT address and port.
  • the destination terminal forwards the response message agreeing to receive the file to the source terminal through the primary listening port of the server.
  • the destination terminal actively establishes a connection to the secondary listening port of the server, and forwards the NAT address and port of the destination terminal through the destination NAT to the source terminal through the server.
  • the destination terminal attempts to connect to the NAT address and port of the source terminal, and the connection is in the normal situation.
  • the source NAT will record the source address and port of the connection, ready for the next real connection, the so-called hole punching, that is, the destination terminal makes a hole to the source terminal, so that The next time the source terminal can connect to the NAT address and port that the destination terminal just used.
  • the destination terminal starts monitoring on the local port, and sends a notification to the source terminal to receive the file through the server.
  • the server sends a notification to the source terminal that the destination terminal is ready to receive the file, and sends the NAT address and port of the destination terminal that has been translated by the destination NAT to the source terminal.
  • the source terminal tries to connect to the NAT address and port of the destination terminal. Because the destination terminal has tried to connect to the NAT address and port of the source terminal in the above steps, and the source NAT records the information of the connection, when the source terminal actively connects to the destination terminal, The destination NAT considers that the connection request is a valid connection request, and allows the connection to pass, so that the TCP direct connection channel between the source terminal and the destination terminal is successfully established.
  • the source terminal and the destination terminal can use the TCP direct connection channel for high-speed file transmission, and the file transmission mode not only supports breakpoint resume transmission, but also realizes two-way file transmission.
  • the server may be an application server (AS) or another application server.
  • AS application server
  • another application server may be an application server (AS) or another application server.
  • a TCP direct connection channel traversing the NAT network is established between the two SIP terminals, and the MSRP channel of the server is not required to be transited.
  • the two-way file transmission between the two SIP terminals is realized, thereby effectively utilizing the network topology structure, improving the file transmission rate, reducing the occupation of the network bandwidth, further reducing the load of the server, and supporting the file transmission mode. http.
  • a method for file transfer between SIP terminals in a NAT network including:
  • Step 301 The source terminal establishes a TCP direct connection channel with the destination terminal through the server. If the establishment is successful, the process proceeds to step 302; otherwise, the process proceeds to step 303.
  • Step 302 The source terminal performs file transmission with the destination terminal through the TCP direct connection channel, and ends. This process.
  • Step 303 The source terminal establishes a source MSRP channel with the server.
  • Step 304 The source terminal performs file transmission with the destination terminal through the source MSRP channel and the destination MSRP channel between the destination terminal and the server.
  • the steps 301 and 302 are the same as the steps 101 and 102 of the embodiment shown in FIG. 1.
  • the step S302 is the same as the step 102 of the foregoing embodiment, and details are not described herein again.
  • the second embodiment adds a step of performing file transmission by the source terminal and the destination terminal through the MSRP channel relayed by the server when the TCP direct connection channel between the source terminal and the destination terminal fails to be established.
  • the normal communication between the source terminal and the destination terminal is further ensured.
  • the specific implementation of the source MSRP channel between the source terminal and the server in step 303 includes the following steps:
  • Step 3031 The source terminal sends a session request message to the destination terminal through the server.
  • Step 3032 After the destination MSRP channel between the destination terminal and the server is successfully established, the server feeds back a response message from the destination terminal to the source terminal.
  • Step 3033 The source terminal establishes a source MSRP channel with the server according to the response message.
  • the process of switching to the MSRP channel of the server for file transmission is specifically as follows:
  • the source terminal sends a session message invite ( sdpl ) to the server, and the server forwards the invite (sdpr) to the destination terminal; after receiving the invite (sdpr), the destination terminal sends a response 200 OK (sdp2) to the server; the server receives the destination terminal. After the response 200OK ( sdp2 ), the confirmation message (ACK) is sent to the destination terminal;
  • the destination terminal actively sends a link establishment request to the server; the MSRP channel between the destination terminal and the server is successfully established; Then, the server sends a 200 OK (sdp2) to the source terminal; the source terminal sends an acknowledgement message ACK to the server; the source terminal actively sends a link establishment request to the server; the MSRP channel between the source terminal and the server is successfully established;
  • the source terminal starts to send the file content to the server; the server forwards the file content to the destination terminal; the source terminal sends the file content successfully; and the destination terminal receives the file content successfully.
  • the source terminal and the destination terminal after the source terminal and the destination terminal successfully transmit the file through the MSRP channel relayed by the server, the source terminal and the destination terminal respectively release the MSRP channel and the session between the server and the server.
  • the source terminal and the destination terminal are in different NAT environments. Therefore, when the source terminal and the destination terminal perform file transmission, first try to establish a TCP direct connection channel through the NAT, if the TCP is straight. If the channel is successfully established, the file is transmitted through the TCP direct connection channel. If the TCP direct connection channel cannot be established, the MSRP channel of the server relay is enabled, and the file is transmitted through the MSRP channel of the server transit.
  • the second embodiment provides a method for dynamically enabling a TCP direct connection channel or an MSRP channel for file transmission according to a network topology SIP terminal, that is, when two SIP terminals are in a private network behind different NAT network devices, in the two SIPs
  • a TCP direct connection channel traversing the NAT network is established between the terminals, and the two-way file transmission between the two SIP terminals can be realized without using the MSRP channel relayed by the server, thereby effectively utilizing the network topology structure and improving file transmission.
  • the rate reduces the occupation of the network bandwidth, further reduces the load on the server, and the file transmission mode supports breakpoint retransmission.
  • the MSRP channel that is transferred to the server can still be switched to perform file transmission, so that the file transmission mode is selective and flexible.
  • a schematic structural diagram of a first embodiment of a terminal for file transfer between SIP terminals in a NAT network includes: a direct connection channel establishing module 501 and a first file transmission module 502, wherein:
  • the direct connection channel establishing module 501 is configured to establish a TCP between the destination terminal and the destination terminal through the server.
  • the first file transmission module 502 is configured to perform file transmission with the destination terminal through the TCP direct connection channel.
  • the direct connection channel establishing module 501 includes:
  • the first sending unit 5011 is configured to send, by using a server, a NAT address and a port of the terminal, and a file transmission request carrying the file identifier to the destination terminal;
  • the first receiving unit 5012 is configured to receive a NAT address and a port of the destination terminal sent by the destination terminal, and a response message of the consent receiving file fed back by the destination terminal.
  • the first establishing unit 5013 is configured to pass the source terminal and the destination.
  • the TCP direct connection channel is established by the terminal's respective NAT address and port.
  • the source terminal and the destination terminal are both SIP terminals in the IMS environment, and the SIP terminals are connected to the application server (hereinafter referred to as the server) through the respective NAT network devices.
  • the SIP terminals in the IMS environment are mostly single.
  • the file transfer is performed by using the MSRP channel mode of the server. This is not effective for file transfer of SIP terminals in different subnets. That is, SIP terminals in the private network behind different NAT network devices can only transit through the server.
  • the MSRP channel performs file transfer. This file transfer method has the disadvantage of occupying a large amount of network bandwidth for a long time when transferring large files, and the transfer speed is highly susceptible to server performance and network bandwidth.
  • a TCP direct connection channel between the terminal and the destination terminal needs to be established, and the TCP directly connects the channel, the terminal and the The destination terminal can implement file transmission without using the MSRP channel relayed by the server, thereby effectively utilizing the network topology structure, increasing the file transmission rate, reducing the occupation of the network bandwidth, and reducing the load on the server.
  • the terminal is referred to as a source terminal in this embodiment as an example to describe the relationship between the source terminal and the destination terminal.
  • TCP direct connection channel establishment process First, the source terminal needs to send the file transmission request to the destination terminal. To this end, the server needs to start two port listening, that is, primary listening and auxiliary listening; and each terminal needs to keep in touch with the server's main listening. .
  • the source terminal sends a file transfer request to the secondary listening port of the server.
  • the file transfer request includes a file identifier, and the server obtains the NAT address and port of the source terminal after the source NAT is translated.
  • the server forwards the file transfer request sent by the source terminal to the destination terminal through the primary listening port, and sends the source terminal to the destination terminal through the source NAT-transformed NAT address and port.
  • the destination terminal forwards the response message agreeing to receive the file to the source terminal through the primary listening port of the server.
  • the destination terminal actively establishes a connection to the secondary listening port of the server, and forwards the NAT address and port of the destination terminal through the destination NAT to the source terminal through the server.
  • the destination terminal attempts to connect to the source terminal's NAT address and port.
  • the connection will fail normally, but the source NAT will record the source address and port of the connection, ready for the next real connection.
  • the so-called hole punching that is, the destination terminal makes a hole to the source terminal, so that the next source terminal can connect to the NAT address and port that the destination terminal just used.
  • the destination terminal starts monitoring on the local port, and sends a notification to the source terminal to receive the file through the server.
  • the server sends a notification to the source terminal that the destination terminal is ready to receive the file, and sends the destination NAT-transformed NAT address and port to the source terminal.
  • the source terminal tries to connect to the NAT address and port of the destination terminal.
  • the destination terminal attempts to connect to the NAT address and port of the source terminal, and the source NAT records the information of the connection. Therefore, when the source terminal actively connects to the destination terminal, The destination NAT considers that the connection request is a valid connection request, and allows the connection to pass, so that the TCP direct connection channel between the source terminal and the destination terminal is successfully established.
  • the source terminal and the destination terminal can use the TCP direct connection channel for high-speed file transmission, and the file transmission mode not only supports breakpoint continuous transmission, but also realizes two-way file transmission.
  • the server may be an application server AS, or may be another application server.
  • a TCP direct connection channel traversing the NAT network is established between the two SIP terminals, and the MSRP channel that is transited by the server is not required.
  • the two-way file transmission between the two SIP terminals can be realized, thereby effectively utilizing the network topology structure, improving the file transmission rate, reducing the occupation of the network bandwidth, further reducing the load of the server, and the file transmission mode. Support for breakpoints.
  • a schematic structural diagram of a second embodiment of a terminal for file transfer between SIP terminals in a NAT network includes: a direct connection channel establishment module 701 and a connection with the direct connection channel establishment module 701 a file transmission module 702, an MSRP channel establishment module 703, and a second file transmission module 704 connected to the MSRP channel establishment module 703, wherein: a direct connection channel establishment module 701 is configured to establish a TCP direct connection with the destination terminal through the server. When the TCP direct connection channel fails to be established, the MSRP channel establishment module 703 is notified; the first file transmission module 702 is configured to perform file transmission with the destination terminal through the TCP direct connection channel;
  • the MSRP channel establishing module 703 is configured to establish a source MSRP channel with the server when receiving a notification of a TCP direct channel establishment failure.
  • the second file transmission module 704 is configured to perform file transmission between the source MSRP channel and the destination MSRP channel and the destination terminal between the destination terminal and the server.
  • the direct connection channel establishment module 701 has the same functional structure as the direct connection channel establishment module 501 in FIG. 5, and details are not described herein again.
  • the MSRP channel establishment module 703 includes:
  • the second sending unit 7031 is configured to send a session request message to the destination terminal by using the server.
  • the second receiving unit 7032 is configured to receive a response message that is sent back by the server after the destination MSRP channel between the destination terminal and the server is successfully established.
  • the second establishing unit 7033 is configured to establish a source MSRP channel with the server according to the response message.
  • the present embodiment further solves the problem that when the TCP direct connection channel between the source terminal and the destination terminal fails to be established, the source terminal and the destination terminal perform file transmission through the MSRP channel relayed by the server. This ensures proper communication between the source terminal and the destination terminal.
  • an embodiment of the present invention provides a system for file transmission between SIP terminals in a NAT network, including: a source terminal 901, a server 902, and a destination terminal 903, and the source terminal 901 and the destination terminal 902 respectively pass through a NAT network device.
  • the server 902 is connected to the server 902.
  • the source terminal 901 is connected to the server 902 through the source NAT network device 9012.
  • the destination terminal 902 is connected to the server 902 through the destination NAT network device 9023.
  • the source terminal 901 is configured to establish a TCP direct connection channel with the destination terminal 903 through the server 902; and perform file transmission with the destination terminal 902 through the TCP direct connection channel;
  • the server 902 is configured to establish, by using the NAT network device, the source terminal 901 to establish a TCP direct connection channel between the source terminal 901 and the destination terminal 903.
  • the destination terminal 903 is configured to establish a TCP direct channel with the source terminal 901 through the server 902; and perform file transmission with the source terminal 901 through the TCP direct connection channel.
  • the server 902 is further configured to receive the file transfer request that carries the file identifier sent by the source terminal 901, and obtain the NAT address and port of the source terminal 901; forward the file transfer request to the destination terminal 903, and simultaneously source the source The NAT address and port of the terminal 901 are sent to the destination terminal 903; and the response message of the consent receiving file fed back by the destination terminal 903 is forwarded to the source terminal 901, and the NAT address and port of the destination terminal 903 are sent to the source terminal 901.
  • the server 902 of this embodiment may be an application server AS; the source terminal 901 may be the terminal described in the above embodiment.
  • Embodiments of the present invention dynamically select file transmission based on a network topology in which a SIP terminal is located
  • the channel that is, when the two SIP terminals are in the private network behind different NAT network devices, the TCP direct connection channel that traverses the NAT network is established between the two SIP terminals, and the MSRP channel that is transited by the server does not need to be implemented.
  • Two-way file transfer between the two SIP terminals thereby effectively utilizing the network topology structure, improving the file transfer rate, reducing the occupation of the network bandwidth, further reducing the load on the server, and the file transfer mode supports breakpoints.
  • the above TCP direct connection channel fails to be established, the file transfer can still be switched to the MSRP channel of the server relay, so that the file transmission mode is selective and flexible.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Multimedia (AREA)
  • Telephonic Communication Services (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed are a method, terminal and system for file transfers between Session Initiation Protocol (SIP) terminals in a Network Address Translation (NAT) network, wherein the method includes: a source terminal establishes a Transmission Control Protocol (TCP) direct connection channel with a destination terminal through a server (101); and the source terminal performs file transfers with the destination terminal through the TCP direct connection channel (102). With the present invention, the file transfer channel is dynamically selected based on the topology architecture of the network where the SIP terminals locate, and when two SIP terminals locate in different private networks behind NAT network devices, the bidirectional file transfers between two SIP terminals can be realized through the TCP direct connection channel with no need of a Message Session Relay Protocol (MSRP) channel with the transfer of a server, thus effectively utilizing the network topology architecture, increasing the file transfer rate, reducing the bandwidth occupancy, and furthermore reducing server loads. When the above TCP direct connection channel is established unsuccessfully, file transfers can be performed by switching to the MSRP channel with the transfer of the server, thus enabling the file transfer manner with selectivity and flexibility.

Description

NAT网络中 SIP终端间文件传输的方法、 终端及系统 技术领域  Method, terminal and system for file transmission between SIP terminals in NAT network
本发明涉及通信领域,尤其涉及一种 IMS业务 NAT网络中 SIP终端间 文件传输的方法、 终端及系统。 背景技术  The present invention relates to the field of communications, and in particular, to a method, a terminal, and a system for transferring files between SIP terminals in an IMS service NAT network. Background technique
在 IP多媒体子系统( IMS, IP Multimedia Subsystem ) 业务中, 文件传 输功能是提供给用户使用的必备功能之一。 文件传输功能提供了一种不同 用户之间即时传输文件的方式, 能够很好的实现文档、 图片以及多媒体文 件的共享。  In the IP Multimedia Subsystem (IMS) business, file transfer is one of the must-have features available to users. The file transfer function provides a way to transfer files between different users in real time, which is a good way to share documents, pictures and multimedia files.
随着 Internet 的迅速发展, 而互联网协议的第四版 ( IPv4 , Internet Protocol v4 ) 地址数量的限制, 网絡地址翻译 ( NAT , Network Address Translation )设备得到广泛应用。 NAT网络设备允许处于同一 NAT网络设 备后的多台主机共享一个公网(通常将处于同一 NAT网络设备后的网絡称 为私网, 处于 NAT网络设备前的网络称为公网) IP 地址。 一个私网 IP 地 址通过 NAT 网络设备与公网的其他主机进行通信。 但是, 处在不同 NAT 网络设备后的私网内的主机之间无法实现直接互通。  With the rapid development of the Internet and the limitation of the number of addresses of the fourth edition (IPv4, Internet Protocol v4) of the Internet Protocol, Network Address Translation (NAT) devices are widely used. A NAT network device allows multiple hosts on the same NAT network device to share a public network (usually the network behind the same NAT network device is called the private network and the network in front of the NAT network device is called the public network). A private IP address communicates with other hosts on the public network through a NAT network device. However, direct interworking between hosts in the private network behind different NAT network devices is not possible.
目前, SIP终端的文件传输机制均是基于会话初始化协议( SIP, Session Initiation Protocol ) 和消息会话中继协议 ( MSRP, Message Session Relay Protocol )以及会话 4 述协议(SDP, Session Discription Protocol )进行文件 传输, 即,各 SIP终端之间通过 invite (会话消息)进行会话协商,通过 SDP 进行媒体信息协商, 若会话协商成功, 则在文件发送方 (源终端) 和服务 器之间、 服务器和文件接收方 (目的终端)之间分别建立传输通道; 之后, 利用 MSRP协议首先将文件从发送方传输到服务器, 然后从服务器再中转 至接收方。从现有 SIP终端的文件传输方法可见,各 SIP终端之间进行文件 传输必须经过中间服务器的中转, 而在当前网络带宽日趋紧张的情况下, 尤其是在传输大文件时, 这种文件传输方式存在长时间占用大量网络带宽 的弊端, 并且传输速度受到了服务器性能和网络带宽的极大影响。 发明内容 At present, the file transfer mechanism of the SIP terminal is based on the Session Initiation Protocol (SIP), the Message Session Relay Protocol (MSRP), and the Session Discription Protocol (SDP). That is, each SIP terminal performs session negotiation through an invite (session message), and media information negotiation through SDP. If the session negotiation is successful, between the file sender (source terminal) and the server, the server and the file receiver ( The destination channel is respectively established with a transmission channel; after that, the file is first transmitted from the sender to the server by using the MSRP protocol, and then transferred from the server. To the recipient. It can be seen from the file transmission method of the existing SIP terminal that the file transfer between the SIP terminals must be transited by the intermediate server, and in the case of the current network bandwidth becoming increasingly tight, especially when transferring large files, this file transmission method There are drawbacks of occupying a large amount of network bandwidth for a long time, and the transmission speed is greatly affected by server performance and network bandwidth. Summary of the invention
本发明的主要目的在于提供一种 NAT网絡中 SIP终端间文件传输的方 法、 终端及系统, 能够提高 SIP终端间文件传输效率并节约网络资源。  The main purpose of the present invention is to provide a method, a terminal and a system for file transmission between SIP terminals in a NAT network, which can improve file transmission efficiency between SIP terminals and save network resources.
本发明提出一种 NAT网络中 SIP终端间文件传输的方法, 包括: 源终端通过服务器建立与目的终端之间的传输控制协议 TCP 直连通 道;  The invention provides a method for transferring files between SIP terminals in a NAT network, comprising: the source terminal establishes a TCP direct communication channel with a transmission control protocol between the destination terminal and the destination terminal;
源终端通过建立的 TCP直连通道, 与目的终端进行文件传输。  The source terminal performs file transmission with the destination terminal through the established TCP direct connection channel.
所述源终端通过服务器建立与目的终端之间的 TCP直连通道包括: 所述源终端通过服务器, 将自身的 NAT地址与端口, 以及携带有文件 标识的文件传输请求发送至所述目的终端;  The source terminal establishes a TCP direct connection channel with the destination terminal by using the server: the source terminal sends a NAT address and a port, and a file transmission request carrying the file identifier to the destination terminal through the server;
所述源终端接收目的终端通过所述服务器发送的该目的终端的 NAT地 址与端口, 以及该目的终端反馈的同意接收文件的响应消息;  Receiving, by the source terminal, a NAT address and a port of the destination terminal sent by the destination terminal by using the server, and a response message of the consent receiving file fed back by the destination terminal;
通过所述源终端与目的终端各自的 NAT地址及端口建立 TCP直连通 道。  A TCP direct communication channel is established by using a NAT address and a port of each of the source terminal and the destination terminal.
所述源终端通过服务器建立与目的终端之间的 TCP直连通道之后, 还 包括:  After the source terminal establishes a TCP direct connection channel with the destination terminal through the server, the source terminal further includes:
若所述 TCP直连通道建立失败, 所述源终端建立与所述服务器之间的 源 MSRP通道;  If the TCP direct connection channel fails to be established, the source terminal establishes a source MSRP channel with the server;
所述源终端通过所述源 MSRP通道, 以及目的终端与所述服务器之间 的目的 MSRP通道, 与所述目的终端进行文件传输。  The source terminal performs file transmission with the destination terminal through the source MSRP channel and the destination MSRP channel between the destination terminal and the server.
所述源终端建立与所述服务器之间的源 MSRP通道的具体包括: 所述源终端通过服务器向所述目的终端发送会话请求消息; The specific configuration of the source MSRP channel between the source terminal and the server includes: Sending, by the server, a session request message to the destination terminal by using a server;
所述目的终端与服务器之间的目的 MSRP通道建立成功后, 所述源终 端接收所述服务器反馈的来自所述目的终端响应消息;  After the destination MSRP channel between the destination terminal and the server is successfully established, the source terminal receives the response message from the destination terminal that is fed back by the server;
所述远终端根据所述响应消息, 建立与所述服务器之间的源 MSRP通 道。  The remote terminal establishes a source MSRP channel with the server according to the response message.
本发明还提供一种 NAT网络中 SIP终端间文件传输的终端, 包括直连 通道建立模块和第一文件传输模块, 其中:  The present invention also provides a terminal for transferring files between SIP terminals in a NAT network, including a direct connection channel establishment module and a first file transmission module, where:
直连通道建立模块, 用于通过服务器建立与目的终端之间的 TCP直连 通道;  a direct channel establishing module, configured to establish a TCP direct connection channel with the destination terminal through the server;
第一文件传输模块, 用于通过建立的 TCP直连通道, 与所述目的终端 进行文件传输。  The first file transmission module is configured to perform file transmission with the destination terminal through the established TCP direct connection channel.
所述直连通道建立模块包括第一发送单元、 第一接收单元和第一建立 单元, 其中:  The direct channel establishing module includes a first sending unit, a first receiving unit, and a first establishing unit, where:
第一发送单元, 用于通过所述服务器将所述终端的 NAT地址与端口以 及携带有文件标识的文件传输请求发送至所述目的终端;  a first sending unit, configured to send, by using the server, a NAT address and a port of the terminal, and a file transmission request carrying a file identifier to the destination terminal;
第一接收单元, 用于接收所述目的终端通过所述服务器发送的该目的 终端的 NAT地址与端口以及该目的终端反馈的同意接收文件的响应消息; 第一建立单元, 用于通过所述终端与目的终端各自的 NAT地址及端口 建立所述 TCP直连通道。  a first receiving unit, configured to receive a NAT address and a port of the destination terminal that is sent by the destination terminal by using the server, and a response message that is sent by the destination terminal to agree to receive a file; a first establishing unit, configured to pass the terminal The TCP direct connection channel is established with the respective NAT address and port of the destination terminal.
所述终端还包括 MSRP通道建立模块和第二文件传输模块, 其中: 所述直通通道建立模块, 还用于在 TCP 直连通道建立失败时, 通知 MSRP通道建立模块;  The terminal further includes an MSRP channel establishment module and a second file transmission module, where: the through channel establishment module is further configured to notify the MSRP channel establishment module when the TCP direct connection channel fails to be established;
MSRP通道建立模块, 用于当接收到 TCP直连通道建立失败通知时, 建立与所述服务器之间的源 MSRP通道;  An MSRP channel establishing module, configured to establish a source MSRP channel with the server when receiving a TCP direct channel establishment failure notification;
第二文件传输模块, 用于通过所述源 MSRP通道以及目的终端与所述 服务器之间的目的 MSRP通道与所述目的终端进行文件传输。 a second file transmission module, configured to pass the source MSRP channel and the destination terminal The destination MSRP channel between the servers performs file transfer with the destination terminal.
所述 MSRP通道建立模块包括第二发送单元、 第二接收单元和第二建 立单元, 其中:  The MSRP channel establishment module includes a second sending unit, a second receiving unit, and a second establishing unit, where:
第二发送单元, 用于通过所述服务器向目的终端发送会话请求消息; 第二接收单元, 用于接收所述服务器在目的终端与该服务器之间的目 的 MSRP通道建立成功后反馈的响应消息;  a second sending unit, configured to send a session request message to the destination terminal by using the server; and a second receiving unit, configured to receive a response message that is sent back by the server after the destination MSRP channel between the destination terminal and the server is successfully established;
第二建立单元, 用于根据所述响应消息建立与所述服务器之间的源 MSRP通道。  And a second establishing unit, configured to establish a source MSRP channel with the server according to the response message.
本发明还一种 NAT网络中 SIP终端间文件传输的系统, 包括: 源终端、 服务器与目的终端, 所述源终端与目的终端分别通过 NAT网络设备与所述 服务器连接; 其中:  The present invention also provides a system for transferring files between SIP terminals in a NAT network, including: a source terminal, a server, and a destination terminal, wherein the source terminal and the destination terminal are respectively connected to the server through a NAT network device;
源终端 , 用于通过所述服务器建立与目的终端之间的 TCP直连通道; 以及通过所述 TCP直连通道与所述目的终端进行文件传输;  a source terminal, configured to establish, by using the server, a TCP direct connection channel with the destination terminal; and perform file transmission with the destination terminal by using the TCP direct connection channel;
服务器, 用于通过 NAT网络设备, 实现所述源终端建立该源终端与目 的终端之间的 TCP直连通道;  a server, configured to establish, by the NAT network device, the TCP direct connection channel between the source terminal and the destination terminal by using the source terminal;
目的终端, 用于通过所述服务器建立与源终端之间的所述 TCP直连通 道; 以及通过所述 TCP直连通道与所述源终端进行文件传输。  And the destination terminal is configured to establish, by the server, the TCP direct communication channel with the source terminal, and perform file transmission with the source terminal by using the TCP direct connection channel.
所述服务器, 还用于接收源终端发送的携带有文件标识的文件传输请 求, 并获取所述源终端的 NAT地址和端口; 转发所述文件传输请求至所述 目的终端 , 同时将所述源终端的 NAT地址与端口发送至所述目的终端; 以 及转发所述目的终端反馈的同意接收文件的响应消息至所述源终端, 同时 将将所述目的终端的 NAT地址与端口发送至所述源终端。  The server is further configured to receive a file transfer request that is sent by the source terminal and that carries the file identifier, and obtain a NAT address and a port of the source terminal; forward the file transfer request to the destination terminal, and simultaneously use the source Sending a NAT address and a port of the terminal to the destination terminal; and forwarding a response message of the consent receiving file fed back by the destination terminal to the source terminal, and sending the NAT address and port of the destination terminal to the source terminal.
所述服务器为应用服务器 AS。  The server is an application server AS.
本发明提出一种 NAT网络中 SIP终端间文件传输的方法、终端及系统, 基于 SIP终端所处的网络拓朴结构, 动态选择文件传输的通道, 即当两 SIP 终端为处在不同 NAT网络设备后的私网内时, 在两 SIP终端之间建立穿越The invention provides a method, a terminal and a system for transferring files between SIP terminals in a NAT network, and dynamically selects a channel for file transmission based on the network topology structure of the SIP terminal, that is, when two SIPs When the terminal is in a private network behind different NAT network devices, a traversal is established between the two SIP terminals.
NAT网的 TCP直连通道, 这样, 不需通过服务器中转的 MSRP通道, 即实 现了两 SIP终端之间的双向文件传输, 从而有效地利用了网络拓朴结构, 提高了文件传输的速率, 减少了对网络带宽的占用, 进一步减轻了服务器 的负荷, 而且本发明提供的文件传输方式支持断点续传。 更进一步地, 在 TCP直连通道建立失败时, 仍可切换至服务器中转的 MSRP通道进行文件 传输, 使得文件传输方式具有选择性与灵活性。 附图说明 The TCP direct connection channel of the NAT network, so that the two-way file transmission between the two SIP terminals is realized without using the MSRP channel of the server relay, thereby effectively utilizing the network topology structure, improving the file transmission rate and reducing the file transmission rate. The occupation of the network bandwidth further reduces the load on the server, and the file transmission mode provided by the present invention supports breakpoint retransmission. Further, when the TCP direct connection channel fails to be established, the server can still switch to the server-transferred MSRP channel for file transmission, which makes the file transmission mode selective and flexible. DRAWINGS
图 1是本发明 NAT网络中 SIP终端间文件传输的方法的第一实施例的 流程图;  1 is a flow chart of a first embodiment of a method for transferring files between SIP terminals in a NAT network according to the present invention;
图 2是本发明 NAT网络中 SIP终端间文件传输的方法的第一实施例中, 通过 TCP直连通道与目的终端进行文件传输的流程图;  2 is a flow chart of file transmission between a TCP direct connection channel and a destination terminal in a first embodiment of a method for transferring file between SIP terminals in a NAT network according to the present invention;
图 3是本发明 NAT网络中 SIP终端间文件传输的方法的第二实施例的 流程图;  3 is a flow chart showing a second embodiment of a method for transferring files between SIP terminals in a NAT network according to the present invention;
图 4是本发明 NAT网络中 SIP终端间文件传输的方法的第二实施例中, 源终端建立与服务器之间的源 MSRP通道的流程图;  4 is a flowchart of a source MSRP channel established between a source terminal and a server in a second embodiment of a method for transferring file between SIP terminals in a NAT network according to the present invention;
图 5是本发明 NAT网络中 SIP终端间文件传输的终端的第一实施例的 结构示意图;  5 is a schematic structural diagram of a first embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention;
图 6是本发明 NAT网络中 SIP终端间文件传输的终端的第一实施例中, 直连通道建立模块的结构示意图;  6 is a schematic structural diagram of a direct connection channel establishment module in a first embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention;
图 7是本发明 NAT网络中 SIP终端间文件传输的终端的而第二实施例 的结构示意图;  7 is a schematic structural diagram of a second embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention;
图 8是本发明 NAT网络中 SIP终端间文件传输的终端的第二实施例中, MSRP通道建立模块的结构示意图;  8 is a schematic structural diagram of an MSRP channel establishment module in a second embodiment of a terminal for transferring files between SIP terminals in a NAT network according to the present invention;
图 9是本发明 NAT网络中 SIP终端间文件传输的系统的第一实施例的结 构示意图。 具体实施方式 9 is a diagram of a first embodiment of a system for transferring files between SIP terminals in a NAT network according to the present invention; Schematic diagram. detailed description
本发明实施例解决方案主要是根据网络拓朴 SIP 终端动态启用 TCP ( Transmission Control Protocol, 传输控制协议 )直连通道或 MSRP通道进 行文件传输。  The solution of the embodiment of the present invention is to dynamically enable a TCP (Transmission Control Protocol) direct connection channel or an MSRP channel to perform file transmission according to the network topology SIP terminal.
如图 1所示, 本发明第一实施例提出一种 NAT网络中 SIP终端间文件 传输的方法, 包括:  As shown in FIG. 1, a first embodiment of the present invention provides a method for file transfer between SIP terminals in a NAT network, including:
步骤 101 : 源终端通过服务器建立与目的终端之间的传输控制协议 ( TCP ) 直连通道。  Step 101: The source terminal establishes a Transmission Control Protocol (TCP) direct connection channel with the destination terminal through the server.
步骤 102: 通过 TCP直连通道与目的终端进行文件传输。  Step 102: Perform file transmission with the destination terminal through the TCP direct connection channel.
图 1所示的本发明方法的运行环境为基于 IMS环境下 SIP终端所处的 网络拓朴结构。 在该网络拓朴结构中 , SIP终端通过各自的 NAT网络设备 与应用服务器(本文中简称为服务器)连接, 现有技术中, IMS环境下 SIP 终端大都单一釆用服务器中转的 MSRP通道方式进行文件传输, 这对于处 在不同子网内的 SIP终端进行文件传输缺乏有效支持, 即处于不同 NAT网 络设备后的私网内的 SIP终端之间只能通过服务器中转的 MSRP通道进行 文件传输, 这种文件传输方式在传输大文件时存在长时间占用大量网络带 宽的弊端, 并且传输速度极易受服务器性能和网络带宽的影响。  The operating environment of the method of the present invention shown in Figure 1 is based on the network topology in which the SIP terminal is located in the IMS environment. In the network topology, the SIP terminals are connected to the application server (hereinafter referred to as the server) through the respective NAT network devices. In the prior art, most of the SIP terminals in the IMS environment use the MSRP channel mode of the server to transfer files. Transmission, which does not effectively support file transfer for SIP terminals in different subnets, that is, the SIP terminals in the private network behind different NAT network devices can only transmit files through the MSRP channel relayed by the server. The file transfer method has the disadvantage of occupying a large amount of network bandwidth for a long time when transferring large files, and the transfer speed is extremely susceptible to server performance and network bandwidth.
如何实现 SIP终端之间高效的文件传输, 尽量减少 Internet/Intranet网 络带宽占用率则是本发明所要解决的问题。  How to achieve efficient file transfer between SIP terminals and minimize the bandwidth usage of the Internet/Intranet network is a problem to be solved by the present invention.
在第一实施例中, 将处于不同 NAT网絡设备后的私网内的两台需要进 行文件传输的 SIP 终端分别称为源终端与目的终端, 为了实现源终端与目 的终端直接进行文件传输, 需要建立源终端与目的终端之间的 TCP直连通 道,通过该 TCP直连通道,源终端与目的终端不需通过服务器中转的 MSRP 通道即可实现文件传输, 从而有效利用了网络拓朴结构, 提高了文件传输 的速率, 减少了对网络带宽的占用, 也减轻了服务器的负荷。 In the first embodiment, two SIP terminals that need to perform file transmission in the private network behind different NAT network devices are respectively referred to as a source terminal and a destination terminal, and in order to directly perform file transmission between the source terminal and the destination terminal, Establish a TCP direct connection channel between the source terminal and the destination terminal. Through the TCP direct connection channel, the source terminal and the destination terminal can implement file transmission without passing through the MSRP channel of the server transit, thereby effectively utilizing the network topology and improving the network topology. File transfer The rate reduces the occupation of network bandwidth and reduces the load on the server.
如图 2所示, 图 1中的步骤 101具体实现包括:  As shown in FIG. 2, the specific implementation of step 101 in FIG. 1 includes:
步骤 1021: 源终端通过服务器将自身的 NAT地址与端口, 以及携带有 文件标识的文件传输请求发送至目的终端。  Step 1021: The source terminal sends its own NAT address and port, and a file transfer request carrying the file identifier to the destination terminal through the server.
步骤 1022: 目的终端接收到文件传输请求后, 通过服务器发送自身的 NAT地址与端口, 以及向源终端反馈的同意接收文件的响应消息。  Step 1022: After receiving the file transmission request, the destination terminal sends its own NAT address and port through the server, and a response message to the source terminal that agrees to receive the file.
步驟 1023: 通过源终端与目的终端各自的 NAT地址及端口建立 TCP 直连通道。  Step 1023: Establish a TCP direct connection channel through the NAT address and port of the source terminal and the destination terminal.
上述步骤 1021至步骤 1023中,由于源终端与目的终端通过各自的 NAT 网络设备 (以下分别简称源 NAT和目的 NAT )与服务器连接, 即源终端处 于源 NAT之后, 目的终端处于目的 NAT之后。 源终端和目的终端通过服务 器交换文件传输的信息以及各自的 NAT地址和端口。 源终端与目的终端之 间的 TCP直连通道建立过程具体为:  In the above steps 1021 to 1023, the source terminal and the destination terminal are connected to the server through respective NAT network devices (hereinafter referred to as source NAT and destination NAT respectively), that is, the source terminal is behind the source NAT, and the destination terminal is behind the destination NAT. The source terminal and the destination terminal exchange file transfer information and their respective NAT addresses and ports through the server. The process of establishing a TCP direct connection channel between the source terminal and the destination terminal is specifically as follows:
首先, 源终端需要将文件传输请求发送至目的终端, 为此, 本实施例 服务器需启动两个端口侦听, 即主侦听和辅助侦听; 且各终端需与服务器 的主侦听保持联系。 源终端向服务器的辅助侦听端口发送文件传输请求, 该文件传输请求中包含文件标识, 服务器通过此步骤, 获取到源终端经过 源 NAT转换后的 NAT地址和端口。  First, the source terminal needs to send the file transmission request to the destination terminal. To this end, the server needs to start two port listening, that is, primary listening and auxiliary listening; and each terminal needs to keep in touch with the server's main listening. . The source terminal sends a file transfer request to the secondary listening port of the server. The file transfer request includes a file identifier, and the server obtains the NAT address and port of the source terminal after the source NAT is converted.
之后, 服务器通过主侦听端口转发源终端发送的文件传输请求至目的 终端,同时把源终端经过源 NAT转换后的 NAT地址和端口发送给目的终端。 目的终端通过服务器的主侦听端口向源终端转发同意接收文件的响应消 息。  After that, the server forwards the file transmission request sent by the source terminal to the destination terminal through the primary listening port, and sends the source terminal to the destination terminal through the source NAT-transformed NAT address and port. The destination terminal forwards the response message agreeing to receive the file to the source terminal through the primary listening port of the server.
随后, 目的终端主动向服务器的辅助侦听端口建立连接, 以通过服务 器将该目的终端经过目的 NAT转换后的 NAT地址和端口转发至源终端。  Then, the destination terminal actively establishes a connection to the secondary listening port of the server, and forwards the NAT address and port of the destination terminal through the destination NAT to the source terminal through the server.
此时, 目的终端尝试连接源终端的 NAT地址和端口, 该连接在通常情 况下会失败, 但是, 源 NAT会记录此次连接的源地址和端口, 为接下来的 真正连接做好了准备, 即所谓的打洞, 也就是目的终端向源终端打了一个 洞, 以便下次源终端能够连接到目的终端刚才使用的 NAT地址和端口。 同 时, 目的终端在本地端口启动监听, 并经过服务器向源终端发送准备接收 文件的通知。 At this time, the destination terminal attempts to connect to the NAT address and port of the source terminal, and the connection is in the normal situation. In the case of failure, the source NAT will record the source address and port of the connection, ready for the next real connection, the so-called hole punching, that is, the destination terminal makes a hole to the source terminal, so that The next time the source terminal can connect to the NAT address and port that the destination terminal just used. At the same time, the destination terminal starts monitoring on the local port, and sends a notification to the source terminal to receive the file through the server.
服务器向源终端发送目的终端已经准备好接收文件的通知, 并把目的 终端的经过目的 NAT转换后的 NAT地址和端口发送给源终端。源终端尝试 连接目的终端的 NAT地址和端口, 由于上述步骤中目的终端曾经尝试连接 过源终端的 NAT地址和端口 ,并且源 NAT记录了该次连接的信息,所以当 源终端主动连接目的终端时, 目的 NAT则认为该连接请求是合法的连接请 求, 并允许该连接通过, 从而源终端与目的终端之间的 TCP直连通道建立 成功。 源终端与目的终端即可利用该 TCP直连通道进行高速文件传输, 且 该文件传输方式不仅支持断点续传, 还可以实现双向文件传输。  The server sends a notification to the source terminal that the destination terminal is ready to receive the file, and sends the NAT address and port of the destination terminal that has been translated by the destination NAT to the source terminal. The source terminal tries to connect to the NAT address and port of the destination terminal. Because the destination terminal has tried to connect to the NAT address and port of the source terminal in the above steps, and the source NAT records the information of the connection, when the source terminal actively connects to the destination terminal, The destination NAT considers that the connection request is a valid connection request, and allows the connection to pass, so that the TCP direct connection channel between the source terminal and the destination terminal is successfully established. The source terminal and the destination terminal can use the TCP direct connection channel for high-speed file transmission, and the file transmission mode not only supports breakpoint resume transmission, but also realizes two-way file transmission.
需要说明的是, 本实施例中服务器可以为应用服务器(AS ), 也可以是 其他应用服务器。  It should be noted that, in this embodiment, the server may be an application server (AS) or another application server.
本实施例中, 当两 SIP终端处在不同 NAT网络设备后的私网内时, 在 两 SIP终端之间络建立穿越 NAT网的 TCP直连通道, 不需通过服务器的 MSRP通道中转, 即可实现两 SIP终端之间的双向文件传输,从而有效的利 用了网络拓朴结构, 提高了文件传输的速率, 减少了对网络带宽的占用, 进一步减轻了服务器的负荷, 且该种文件传输方式支持断点续传。  In this embodiment, when the two SIP terminals are in the private network behind the different NAT network devices, a TCP direct connection channel traversing the NAT network is established between the two SIP terminals, and the MSRP channel of the server is not required to be transited. The two-way file transmission between the two SIP terminals is realized, thereby effectively utilizing the network topology structure, improving the file transmission rate, reducing the occupation of the network bandwidth, further reducing the load of the server, and supporting the file transmission mode. http.
如图 3所示, 本发明的第二实施例中, 提出一种 NAT网络中 SIP终端 间文件传输的方法, 包括:  As shown in FIG. 3, in a second embodiment of the present invention, a method for file transfer between SIP terminals in a NAT network is provided, including:
步骤 301 : 源终端通过服务器建立与目的终端之间的 TCP直连通道, 若建立成功, 则进入步骤 302; 否则进入步骤 303。  Step 301: The source terminal establishes a TCP direct connection channel with the destination terminal through the server. If the establishment is successful, the process proceeds to step 302; otherwise, the process proceeds to step 303.
步骤 302, 源终端通过 TCP直连通道与目的终端进行文件传输, 结束 本流程。 Step 302: The source terminal performs file transmission with the destination terminal through the TCP direct connection channel, and ends. This process.
步骤 303 , 源终端建立与服务器之间的源 MSRP通道。  Step 303: The source terminal establishes a source MSRP channel with the server.
步骤 304, 源终端通过源 MSRP通道, 以及目的终端与服务器之间的 目的 MSRP通道, 与目的终端进行文件传输。  Step 304: The source terminal performs file transmission with the destination terminal through the source MSRP channel and the destination MSRP channel between the destination terminal and the server.
其中, 步骤 301和步骤 302与图 1所示实施例的步骤 101和步骤 102 分别对应相同, 步骤 S302与上述实施例步骤 102具体流程相同, 在此不再 赘述。  The steps 301 and 302 are the same as the steps 101 and 102 of the embodiment shown in FIG. 1. The step S302 is the same as the step 102 of the foregoing embodiment, and details are not described herein again.
第二实施例在第一实施例的基础上, 增加了当源终端与目的终端之间 的 TCP直连通道建立失败时, 源终端与目的终端通过服务器中转的 MSRP 通道进行文件传输的步骤, 更进一步确保了源终端与目的终端之间的正常 通信。  On the basis of the first embodiment, the second embodiment adds a step of performing file transmission by the source terminal and the destination terminal through the MSRP channel relayed by the server when the TCP direct connection channel between the source terminal and the destination terminal fails to be established. The normal communication between the source terminal and the destination terminal is further ensured.
如图 4所示, 步骤 303中源终端建立与服务器之间的源 MSRP通道的 具体实现包括以下步骤:  As shown in FIG. 4, the specific implementation of the source MSRP channel between the source terminal and the server in step 303 includes the following steps:
步骤 3031 : 源终端通过服务器向目的终端发送会话请求消息。  Step 3031: The source terminal sends a session request message to the destination terminal through the server.
步骤 3032: 目的终端与该服务器之间的目的 MSRP通道建立成功后, 服务器向源终端反馈来自目的终端的响应消息。  Step 3032: After the destination MSRP channel between the destination terminal and the server is successfully established, the server feeds back a response message from the destination terminal to the source terminal.
步驟 3033: 源终端根据响应消息,建立与服务器之间的源 MSRP通道。 第二实施例中,源终端与目的终端在 TCP直连通道建立失败的情况下, 切换至服务器中转的 MSRP通道进行文件传输的过程具体为:  Step 3033: The source terminal establishes a source MSRP channel with the server according to the response message. In the second embodiment, when the source terminal and the destination terminal fail to establish a TCP direct connection channel, the process of switching to the MSRP channel of the server for file transmission is specifically as follows:
首先, 源终端发送会话消息 invite ( sdpl ) 给服务器, 由服务器转发 invite(sdpr)至目的终端; 目的终端接收到 invite(sdpr)后, 向服务器发出响 应 200OK ( sdp2 ) ; 服务器接收到目的终端发来的响应 200OK ( sdp2 )后, 向目的终端发送确认信息 (ACK ) ;  First, the source terminal sends a session message invite ( sdpl ) to the server, and the server forwards the invite (sdpr) to the destination terminal; after receiving the invite (sdpr), the destination terminal sends a response 200 OK (sdp2) to the server; the server receives the destination terminal. After the response 200OK ( sdp2 ), the confirmation message (ACK) is sent to the destination terminal;
接着, 目的终端主动向服务器发送建链请求; 目的终端与服务器之间 的 MSRP通道建立成功; 然后, 服务器向源终端发送 200OK(sdp2、); 源终端向服务器发送确认 信息 ACK; 源终端主动向服务器发送建链请求; 源终端与服务器之间的 MSRP通道建立成功; Then, the destination terminal actively sends a link establishment request to the server; the MSRP channel between the destination terminal and the server is successfully established; Then, the server sends a 200 OK (sdp2) to the source terminal; the source terminal sends an acknowledgement message ACK to the server; the source terminal actively sends a link establishment request to the server; the MSRP channel between the source terminal and the server is successfully established;
最后, 源终端开始向服务器发送文件内容; 服务器向目的终端转发文 件内容; 源终端发送文件内容成功; 目的终端接收文件内容成功。  Finally, the source terminal starts to send the file content to the server; the server forwards the file content to the destination terminal; the source terminal sends the file content successfully; and the destination terminal receives the file content successfully.
第二实施例中, 当源终端与目的终端通过服务器中转的 MSRP通道传 输文件成功后, 源终端与目的终端分别释放和服务器之间的 MSRP通道以 及会话。  In the second embodiment, after the source terminal and the destination terminal successfully transmit the file through the MSRP channel relayed by the server, the source terminal and the destination terminal respectively release the MSRP channel and the session between the server and the server.
在第二实施例中 , 如前所述, 源终端与目的终端处于不同的 NAT环境 内, 因此, 源终端和目的终端在进行文件传输时, 首先尝试穿越 NAT建立 TCP直连通道, 若 TCP直连通道成功建立, 则通过该 TCP直连通道进行文 件传输; 若 TCP直连通道无法建立, 则启用服务器中转的 MSRP通道, 通 过服务器中转的 MSRP通道进行文件传输。  In the second embodiment, as described above, the source terminal and the destination terminal are in different NAT environments. Therefore, when the source terminal and the destination terminal perform file transmission, first try to establish a TCP direct connection channel through the NAT, if the TCP is straight. If the channel is successfully established, the file is transmitted through the TCP direct connection channel. If the TCP direct connection channel cannot be established, the MSRP channel of the server relay is enabled, and the file is transmitted through the MSRP channel of the server transit.
第二施例提供了一种根据网络拓朴 SIP终端动态启用 TCP直连通道或 MSRP通道进行文件传输的方式, 即当两 SIP终端处在不同 NAT网絡设备 后的私网内时,在两 SIP终端之间建立穿越 NAT网的 TCP直连通道, 不需 通过服务器中转的 MSRP通道, 即可实现两 SIP终端之间的双向文件传输, 从而有效的利用了网络拓朴结构, 提高了文件传输的速率, 减少对网络带 宽的占用, 进一步减轻了服务器的负荷, 且该种文件传输方式支持断点续 传。 更进一步的, 当上述 TCP直连通道建立失败时, 仍可切换至服务器中 转的 MSRP通道进行文件传输, 使得文件传输方式具有选择性与灵活性。  The second embodiment provides a method for dynamically enabling a TCP direct connection channel or an MSRP channel for file transmission according to a network topology SIP terminal, that is, when two SIP terminals are in a private network behind different NAT network devices, in the two SIPs A TCP direct connection channel traversing the NAT network is established between the terminals, and the two-way file transmission between the two SIP terminals can be realized without using the MSRP channel relayed by the server, thereby effectively utilizing the network topology structure and improving file transmission. The rate reduces the occupation of the network bandwidth, further reduces the load on the server, and the file transmission mode supports breakpoint retransmission. Further, when the above TCP direct connection channel fails to be established, the MSRP channel that is transferred to the server can still be switched to perform file transmission, so that the file transmission mode is selective and flexible.
如图 5所示, 本发明提出的一种 NAT网络中 SIP终端间文件传输的终 端的第一实施例的结构示意图, 包括: 直连通道建立模块 501 以及第一文 件传输模块 502, 其中:  As shown in FIG. 5, a schematic structural diagram of a first embodiment of a terminal for file transfer between SIP terminals in a NAT network according to the present invention includes: a direct connection channel establishing module 501 and a first file transmission module 502, wherein:
直连通道建立模块 501 , 用于通过服务器建立与目的终端之间的 TCP 直连通道; The direct connection channel establishing module 501 is configured to establish a TCP between the destination terminal and the destination terminal through the server. Direct connection channel;
第一文件传输模块 502, 用于通过 TCP直连通道与目的终端进行文件 传输。  The first file transmission module 502 is configured to perform file transmission with the destination terminal through the TCP direct connection channel.
如图 6所示, 直连通道建立模块 501包括:  As shown in FIG. 6, the direct connection channel establishing module 501 includes:
第一发送单元 5011 , 用于通过服务器, 将终端的 NAT地址与端口以及 携带有文件标识的文件传输请求发送至目的终端;  The first sending unit 5011 is configured to send, by using a server, a NAT address and a port of the terminal, and a file transmission request carrying the file identifier to the destination terminal;
第一接收单元 5012, 用于接收目的终端通过服务器发送的、 该目的终 端的 NAT地址与端口以及该目的终端反馈的同意接收文件的响应消息; 第一建立单元 5013 ,用于通过源终端与目的终端各自的 NAT地址及端 口建立所述 TCP直连通道。  The first receiving unit 5012 is configured to receive a NAT address and a port of the destination terminal sent by the destination terminal, and a response message of the consent receiving file fed back by the destination terminal. The first establishing unit 5013 is configured to pass the source terminal and the destination. The TCP direct connection channel is established by the terminal's respective NAT address and port.
本实施例中, 源终端与目的终端均为 IMS环境下 SIP终端, SIP终端 通过各自的 NAT网络设备与应用服务器(本文中简称为服务器)连接, 现 有技术中, IMS环境下 SIP终端大都单一采用服务器中转的 MSRP通道方 式进行文件传输, 这对于处在不同子网内的 SIP 终端进行文件传输缺乏有 效支持, 即处于不同 NAT网络设备后的私网内的 SIP终端之间只能通过服 务器中转的 MSRP通道进行文件传输, 这种文件传输方式在传输大文件时 存在长时间占用大量网络带宽的弊端, 并且传输速度极易受服务器性能和 网络带宽的影响。  In this embodiment, the source terminal and the destination terminal are both SIP terminals in the IMS environment, and the SIP terminals are connected to the application server (hereinafter referred to as the server) through the respective NAT network devices. In the prior art, the SIP terminals in the IMS environment are mostly single. The file transfer is performed by using the MSRP channel mode of the server. This is not effective for file transfer of SIP terminals in different subnets. That is, SIP terminals in the private network behind different NAT network devices can only transit through the server. The MSRP channel performs file transfer. This file transfer method has the disadvantage of occupying a large amount of network bandwidth for a long time when transferring large files, and the transfer speed is highly susceptible to server performance and network bandwidth.
本实施例为了实现终端与目的终端之间高效的文件传输, 以尽量减少 Internet/Intranet网络带宽占用率, 需要建立终端与目的终端之间的 TCP直 连通道, 通过该 TCP 直连通道, 终端与目的终端不需通过服务器中转的 MSRP 通道即可实现文件传输, 从而可有效利用了网络拓朴结构, 提高文 件传输的速率, 减少对网络带宽的占用, 也减轻服务器的负荷。  In this embodiment, in order to implement efficient file transmission between the terminal and the destination terminal, to minimize the bandwidth occupation ratio of the Internet/Intranet network, a TCP direct connection channel between the terminal and the destination terminal needs to be established, and the TCP directly connects the channel, the terminal and the The destination terminal can implement file transmission without using the MSRP channel relayed by the server, thereby effectively utilizing the network topology structure, increasing the file transmission rate, reducing the occupation of the network bandwidth, and reducing the load on the server.
以下以本实施例终端称为源终端为例说明源终端与目的终端之间的 Hereinafter, the terminal is referred to as a source terminal in this embodiment as an example to describe the relationship between the source terminal and the destination terminal.
TCP直连通道建立过程: 首先, 源终端需要将文件传输请求发送至目的终端, 为此, 本实施例 服务器需启动两个端口侦听, 即主侦听和辅助侦听; 且各终端需与服务器 的主侦听保持联系。 源终端向服务器的辅助侦听端口发送文件传输请求, 该文件传输请求中包含文件标识, 服务器通过此步骤, 获取到源终端经过 源 NAT转换后的 NAT地址和端口。 TCP direct connection channel establishment process: First, the source terminal needs to send the file transmission request to the destination terminal. To this end, the server needs to start two port listening, that is, primary listening and auxiliary listening; and each terminal needs to keep in touch with the server's main listening. . The source terminal sends a file transfer request to the secondary listening port of the server. The file transfer request includes a file identifier, and the server obtains the NAT address and port of the source terminal after the source NAT is translated.
之后, 服务器通过主侦听端口转发源终端发送的文件传输请求至目的 终端, 同时把源终端经过源 NAT转换后的 NAT地址和端口发送给目的终 端。 目的终端通过服务器的主侦听端口向源终端转发同意接收文件的响应 消息。  After that, the server forwards the file transfer request sent by the source terminal to the destination terminal through the primary listening port, and sends the source terminal to the destination terminal through the source NAT-transformed NAT address and port. The destination terminal forwards the response message agreeing to receive the file to the source terminal through the primary listening port of the server.
随后, 目的终端主动向服务器的辅助侦听端口建立连接, 以通过服务 器将该目的终端经过目的 NAT转换后的 NAT地址和端口转发至源终端。  Then, the destination terminal actively establishes a connection to the secondary listening port of the server, and forwards the NAT address and port of the destination terminal through the destination NAT to the source terminal through the server.
此时, 目的终端尝试连接源终端的 NAT地址和端口, 该连接在通常情 况下会失败, 但是源 NAT会记录此次连接的源地址和端口, 为接下来的真 正连接做好了准备, 即所谓的打洞, 也就是目的终端向源终端打了一个洞, 以便下次源终端能够连接到目的终端刚才使用的 NAT地址和端口。 同时, 目的终端在本地端口启动监听, 并经过服务器向源终端发送准备接收文件 的通知。  At this point, the destination terminal attempts to connect to the source terminal's NAT address and port. The connection will fail normally, but the source NAT will record the source address and port of the connection, ready for the next real connection. The so-called hole punching, that is, the destination terminal makes a hole to the source terminal, so that the next source terminal can connect to the NAT address and port that the destination terminal just used. At the same time, the destination terminal starts monitoring on the local port, and sends a notification to the source terminal to receive the file through the server.
服务器向源终端发送目的终端已经准备好接收文件的通知, 并把目的 终端的经过目的 NAT转换后的 NAT地址和端口发送给源终端。 源终端尝 试连接目的终端的 NAT地址和端口 , 由于上述步骤中目的终端曾经尝试连 接过源终端的 NAT地址和端口, 并且源 NAT记录了该次连接的信息, 所 以当源终端主动连接目的终端时, 目的 NAT则认为该连接请求是合法的连 接请求, 并允许该连接通过, 从而源终端与目的终端之间的 TCP直连通道 建立成功。源终端与目的终端即可利用该 TCP直连通道进行高速文件传输, 且该文件传输方式不仅支持断点续传, 还可以实现双向文件传输。 需要说明的是, 本实施例中服务器可以为应用服务器 AS, 也可以是其 他应用服务器。 The server sends a notification to the source terminal that the destination terminal is ready to receive the file, and sends the destination NAT-transformed NAT address and port to the source terminal. The source terminal tries to connect to the NAT address and port of the destination terminal. In the above step, the destination terminal attempts to connect to the NAT address and port of the source terminal, and the source NAT records the information of the connection. Therefore, when the source terminal actively connects to the destination terminal, The destination NAT considers that the connection request is a valid connection request, and allows the connection to pass, so that the TCP direct connection channel between the source terminal and the destination terminal is successfully established. The source terminal and the destination terminal can use the TCP direct connection channel for high-speed file transmission, and the file transmission mode not only supports breakpoint continuous transmission, but also realizes two-way file transmission. It should be noted that, in this embodiment, the server may be an application server AS, or may be another application server.
本实施例中,当终端与目的终端处在不同 NAT网络设备后的私网内时, 在该两 SIP终端之间络建立穿越 NAT网的 TCP直连通道,不需通过服务器 中转的 MSRP通道, 即可实现两 SIP终端之间的双向文件传输, 从而有效 的利用了网络拓朴结构, 提高了文件传输的速率, 减少对网络带宽的占用, 进一步减轻了服务器的负荷, 且该种文件传输方式支持断点续传。  In this embodiment, when the terminal and the destination terminal are located in a private network behind different NAT network devices, a TCP direct connection channel traversing the NAT network is established between the two SIP terminals, and the MSRP channel that is transited by the server is not required. The two-way file transmission between the two SIP terminals can be realized, thereby effectively utilizing the network topology structure, improving the file transmission rate, reducing the occupation of the network bandwidth, further reducing the load of the server, and the file transmission mode. Support for breakpoints.
如图 7所示, 本发明提出的一种 NAT网络中 SIP终端间文件传输的终 端的第二实施例的结构示意图, 包括: 直连通道建立模块 701 以及与直连 通道建立模块 701连接的第一文件传输模块 702、 MSRP通道建立模块 703 以及与 MSRP通道建立模块 703连接的第二文件传输模块 704, 其中: 直连通道建立模块 701 , 用于通过服务器建立与目的终端之间的 TCP 直连通道; 当 TCP直连通道建立失败时, 通知 MSRP通道建立模块 703; 第一文件传输模块 702, 用于通过 TCP直连通道与目的终端进行文件 传输;  As shown in FIG. 7, a schematic structural diagram of a second embodiment of a terminal for file transfer between SIP terminals in a NAT network according to the present invention includes: a direct connection channel establishment module 701 and a connection with the direct connection channel establishment module 701 a file transmission module 702, an MSRP channel establishment module 703, and a second file transmission module 704 connected to the MSRP channel establishment module 703, wherein: a direct connection channel establishment module 701 is configured to establish a TCP direct connection with the destination terminal through the server. When the TCP direct connection channel fails to be established, the MSRP channel establishment module 703 is notified; the first file transmission module 702 is configured to perform file transmission with the destination terminal through the TCP direct connection channel;
MSRP通道建立模块 703, 用于当接收到 TCP直连通道建立失败通知 时, 建立与服务器之间的源 MSRP通道;  The MSRP channel establishing module 703 is configured to establish a source MSRP channel with the server when receiving a notification of a TCP direct channel establishment failure.
第二文件传输模块 704, 用于通过源 MSRP通道以及目的终端与服务 器之间的目的 MSRP通道与目的终端进行文件传输。  The second file transmission module 704 is configured to perform file transmission between the source MSRP channel and the destination MSRP channel and the destination terminal between the destination terminal and the server.
图 7中, 直连通道建立模块 701与图 5中的直连通道建立模块 501功 能结构相同, 在此不再赘述。  In FIG. 7, the direct connection channel establishment module 701 has the same functional structure as the direct connection channel establishment module 501 in FIG. 5, and details are not described herein again.
如图 8所示, MSRP通道建立模块 703包括:  As shown in FIG. 8, the MSRP channel establishment module 703 includes:
第二发送单元 7031, 用于通过服务器向目的终端发送会话请求消息; 第二接收单元 7032, 用于接收服务器在目的终端与该服务器之间的目 的 MSRP通道建立成功后反馈的响应消息; 第二建立单元 7033 , 用于根据响应消息建立与服务器之间的源 MSRP 通道。 The second sending unit 7031 is configured to send a session request message to the destination terminal by using the server. The second receiving unit 7032 is configured to receive a response message that is sent back by the server after the destination MSRP channel between the destination terminal and the server is successfully established. The second establishing unit 7033 is configured to establish a source MSRP channel with the server according to the response message.
本实施例在上述实施例的基础上, 更进一步解决了当源终端与目的终 端之间的 TCP直连通道建立失败时, 源终端与目的终端通过服务器中转的 MSRP 通道进行文件传输的问题。 从而确保了源终端与目的终端之间的正 常通信。  On the basis of the foregoing embodiment, the present embodiment further solves the problem that when the TCP direct connection channel between the source terminal and the destination terminal fails to be established, the source terminal and the destination terminal perform file transmission through the MSRP channel relayed by the server. This ensures proper communication between the source terminal and the destination terminal.
如图 9所示, 本发明一实施例提出一种 NAT网络中 SIP终端间文件传 输的系统, 包括: 源终端 901、 服务器 902与目的终端 903, 源终端 901与 目的终端 902分别通过 NAT网络设备与服务器 902连接, 具体为: 源终端 901通过源 NAT网络设备 9012与服务器 902连接,目的终端 902通过目的 NAT网络设备 9023与服务器 902连接; 其中:  As shown in FIG. 9, an embodiment of the present invention provides a system for file transmission between SIP terminals in a NAT network, including: a source terminal 901, a server 902, and a destination terminal 903, and the source terminal 901 and the destination terminal 902 respectively pass through a NAT network device. The server 902 is connected to the server 902. The source terminal 901 is connected to the server 902 through the source NAT network device 9012. The destination terminal 902 is connected to the server 902 through the destination NAT network device 9023.
源终端 901 , 用于通过服务器 902建立与目的终端 903之间的 TCP直 连通道; 以及通过 TCP直连通道与目的终端 902进行文件传输;  The source terminal 901 is configured to establish a TCP direct connection channel with the destination terminal 903 through the server 902; and perform file transmission with the destination terminal 902 through the TCP direct connection channel;
服务器 902,用于通过 NAT网络设备配合源终端 901建立该源终端 901 与目的终端 903之间的 TCP直连通道;  The server 902 is configured to establish, by using the NAT network device, the source terminal 901 to establish a TCP direct connection channel between the source terminal 901 and the destination terminal 903.
目的终端 903 , 用于通过服务器 902建立与源终端 901之间的 TCP直 连通道; 以及通过 TCP直连通道与源终端 901进行文件传输。  The destination terminal 903 is configured to establish a TCP direct channel with the source terminal 901 through the server 902; and perform file transmission with the source terminal 901 through the TCP direct connection channel.
在本实施例中, 服务器 902, 还用于接收源终端 901发送的携带有文件 标识的文件传输请求, 并获取源终端 901的 NAT地址和端口; 转发文件传 输请求至目的终端 903 , 同时将源终端 901的 NAT地址与端口发送至目的 终端 903; 以及转发目的终端 903反馈的同意接收文件的响应消息至源终端 901 , 同时将将目的终端 903的 NAT地址与端口发送至源终端 901。  In this embodiment, the server 902 is further configured to receive the file transfer request that carries the file identifier sent by the source terminal 901, and obtain the NAT address and port of the source terminal 901; forward the file transfer request to the destination terminal 903, and simultaneously source the source The NAT address and port of the terminal 901 are sent to the destination terminal 903; and the response message of the consent receiving file fed back by the destination terminal 903 is forwarded to the source terminal 901, and the NAT address and port of the destination terminal 903 are sent to the source terminal 901.
本实施例服务器 902可以为应用服务器 AS; 源终端 901可以为上述实 施例所述的终端。  The server 902 of this embodiment may be an application server AS; the source terminal 901 may be the terminal described in the above embodiment.
本发明实施例基于 SIP 终端所处的网絡拓朴结构而动态选择文件传输 的通道, 即当两 SIP终端处在不同 NAT网络设备后的私网内时, 在两 SIP 终端之间络建立穿越 NAT 网的 TCP 直连通道, 不需通过服务器中转的 MSRP通道, 即可实现两 SIP终端之间的双向文件传输,从而有效的利用了 网络拓朴结构, 提高了文件传输的速率, 减少对网络带宽的占用, 进一步 减轻了服务器的负荷, 且该种文件传输方式支持断点续传。 更进一步的, 当上述 TCP直连通道建立失败时, 仍可切换至服务器中转的 MSRP通道进 行文件传输, 使得文件传输方式具有选择性与灵活性。 Embodiments of the present invention dynamically select file transmission based on a network topology in which a SIP terminal is located The channel, that is, when the two SIP terminals are in the private network behind different NAT network devices, the TCP direct connection channel that traverses the NAT network is established between the two SIP terminals, and the MSRP channel that is transited by the server does not need to be implemented. Two-way file transfer between the two SIP terminals, thereby effectively utilizing the network topology structure, improving the file transfer rate, reducing the occupation of the network bandwidth, further reducing the load on the server, and the file transfer mode supports breakpoints. Continued transmission. Further, when the above TCP direct connection channel fails to be established, the file transfer can still be switched to the MSRP channel of the server relay, so that the file transmission mode is selective and flexible.
以上所述仅为本发明的优选实施例, 并非因此限制本发明的专利范围, 凡是利用本发明说明书及附图内容所作的等效结构或流程变换, 或直接或 间接运用在其它相关的技术领域, 均同理包括在本发明的专利保护范围内。  The above is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and equivalent structural or process changes made by the present specification and drawings may be directly or indirectly applied to other related technical fields. The same is included in the scope of patent protection of the present invention.

Claims

权利要求书 Claim
1、一种网络地址翻译 NAT网络中会话初始化协议 SIP终端间文件传输 的方法, 其特征在于, 包括: 源终端通过服务器建立与目的终端之间的传 输控制协议 TCP直连通道;  A network address translation method in a NAT network. The method for transmitting a file between SIP terminals is characterized in that: the source terminal establishes a transmission control protocol TCP direct connection channel with the destination terminal through the server;
源终端通过建立的 TCP直连通道, 与目的终端进行文件传输。  The source terminal performs file transmission with the destination terminal through the established TCP direct connection channel.
2、 根据权利要求 1所述的方法, 其特征在于, 所述源终端通过服务器 建立与目的终端之间的 TCP直连通道包括:  The method according to claim 1, wherein the establishing, by the source terminal, the TCP direct connection channel between the source terminal and the destination terminal comprises:
所述源终端通过服务器, 将自身的 NAT地址与端口, 以及携带有文件 标识的文件传输请求发送至所述目的终端;  The source terminal sends a NAT address and port, and a file transmission request carrying the file identifier to the destination terminal through the server;
所述源终端接收目的终端通过所述服务器发送的该目的终端的 NAT地 址与端口, 以及该目的终端反馈的同意接收文件的响应消息;  Receiving, by the source terminal, a NAT address and a port of the destination terminal sent by the destination terminal by using the server, and a response message of the consent receiving file fed back by the destination terminal;
通过所述源终端与目的终端各自的 NAT地址及端口建立 TCP直连通 道。  A TCP direct communication channel is established by using a NAT address and a port of each of the source terminal and the destination terminal.
3、 根据权利要求 1或 2所述的方法, 其特征在于, 所述源终端通过服 务器建立与目的终端之间的 TCP直连通道之后, 还包括:  The method according to claim 1 or 2, wherein after the source terminal establishes a TCP direct connection channel with the destination terminal through the server, the method further includes:
若所述 TCP直连通道建立失败, 所述源终端建立与所述服务器之间的 源 MSRP通道;  If the TCP direct connection channel fails to be established, the source terminal establishes a source MSRP channel with the server;
所述源终端通过所述源 MSRP通道, 以及目的终端与所述服务器之间 的目的 MSRP通道, 与所述目的终端进行文件传输。  The source terminal performs file transmission with the destination terminal through the source MSRP channel and the destination MSRP channel between the destination terminal and the server.
4、 根据权利要求 3所述的方法, 其特征在于, 所述源终端建立与所述 服务器之间的源 MSRP通道的具体包括:  The method according to claim 3, wherein the source terminal establishes a source MSRP channel with the server, and specifically includes:
所述源终端通过服务器向所述目的终端发送会话请求消息;  Sending, by the server, a session request message to the destination terminal by using a server;
所述目的终端与服务器之间的目的 MSRP通道建立成功后, 所述源终 端接收所述服务器反馈的来自所述目的终端响应消息;  After the destination MSRP channel between the destination terminal and the server is successfully established, the source terminal receives the response message from the destination terminal that is fed back by the server;
所述远终端根据所述响应消息, 建立与所述服务器之间的源 MSRP通 道。 The remote terminal establishes a source MSRP connection with the server according to the response message. Road.
5、 一种 NAT网络中 SIP终端间文件传输的终端, 其特征在于, 包括直 连通道建立模块和第一文件传输模块, 其中:  A terminal for transferring files between SIP terminals in a NAT network, comprising: a direct channel establishing module and a first file transmitting module, wherein:
直连通道建立模块, 用于通过服务器建立与目的终端之间的 TCP直连 通道;  a direct channel establishing module, configured to establish a TCP direct connection channel with the destination terminal through the server;
第一文件传输模块, 用于通过建立的 TCP直连通道, 与所述目的终端 进行文件传输。  The first file transmission module is configured to perform file transmission with the destination terminal through the established TCP direct connection channel.
6、 根据权利要求 5所述的终端, 其特征在于, 所述直连通道建立模块 包括第一发送单元、 第一接收单元和第一建立单元, 其中: 及携带有文件标识的文件传输请求发送至所述目的终端;  The terminal according to claim 5, wherein the direct channel establishing module comprises a first sending unit, a first receiving unit and a first establishing unit, wherein: and a file transmission request carrying the file identifier is sent To the destination terminal;
第一接收单元, 用于接收所述目的终端通过所述服务器发送的该目的 终端的 NAT地址与端口以及该目的终端反馈的同意接收文件的响应消息; 第一建立单元, 用于通过所述终端与目的终端各自的 NAT地址及端口 建立所述 TCP直连通道。  a first receiving unit, configured to receive a NAT address and a port of the destination terminal that is sent by the destination terminal by using the server, and a response message that is sent by the destination terminal to agree to receive a file; a first establishing unit, configured to pass the terminal The TCP direct connection channel is established with the respective NAT address and port of the destination terminal.
7、 根据权利要求 5 或 6 所述的终端, 其特征在于, 所述终端还包括 MSRP通道建立模块和第二文件传输模块, 其中:  The terminal according to claim 5 or 6, wherein the terminal further includes an MSRP channel establishment module and a second file transmission module, where:
所述直通通道建立模块, 还用于在 TCP 直连通道建立失败时, 通知 MSRP通道建立模块;  The through channel establishing module is further configured to notify the MSRP channel establishing module when the TCP direct connection channel fails to be established;
MSRP通道建立模块, 用于当接收到 TCP直连通道建立失败通知时, 建立与所述服务器之间的源 MSRP通道;  An MSRP channel establishing module, configured to establish a source MSRP channel with the server when receiving a TCP direct channel establishment failure notification;
第二文件传输模块, 用于通过所述源 MSRP通道以及目的终端与所述 服务器之间的目的 MSRP通道与所述目的终端进行文件传输。  And a second file transmission module, configured to perform file transmission with the destination terminal by using the source MSRP channel and the destination MSRP channel between the destination terminal and the server.
8、 根据权利要求 7所述的终端, 其特征在于, 所述 MSRP通道建立模 块包括第二发送单元、 第二接收单元和第二建立单元, 其中: 第二发送单元, 用于通过所述服务器向目的终端发送会话请求消息; 第二接收单元, 用于接收所述服务器在目的终端与该服务器之间的目 的 MSRP通道建立成功后反馈的响应消息; The terminal according to claim 7, wherein the MSRP channel establishment module comprises a second sending unit, a second receiving unit, and a second establishing unit, where: a second sending unit, configured to send a session request message to the destination terminal by using the server; and a second receiving unit, configured to receive a response message that is sent back by the server after the destination MSRP channel between the destination terminal and the server is successfully established;
第二建立单元, 用于根据所述响应消息建立与所述服务器之间的源 MSRP通道。  And a second establishing unit, configured to establish a source MSRP channel with the server according to the response message.
9、 一种 NAT网络中 SIP终端间文件传输的系统, 其特征在于, 包括: 源终端、 服务器与目的终端, 所述源终端与目的终端分别通过 NAT网络设 备与所述服务器连接; 其中:  A system for transferring files between SIP terminals in a NAT network, comprising: a source terminal, a server, and a destination terminal, wherein the source terminal and the destination terminal are respectively connected to the server through a NAT network device;
源终端 , 用于通过所述服务器建立与目的终端之间的 TCP直连通道; 以及通过所述 TCP直连通道与所述目的终端进行文件传输;  a source terminal, configured to establish, by using the server, a TCP direct connection channel with the destination terminal; and perform file transmission with the destination terminal by using the TCP direct connection channel;
服务器, 用于通过 NAT网络设备, 实现所述源终端建立该源终端与目 的终端之间的 TCP直连通道;  a server, configured to establish, by the NAT network device, the TCP direct connection channel between the source terminal and the destination terminal by using the source terminal;
目的终端, 用于通过所述服务器建立与源终端之间的所述 TCP直连通 道; 以及通过所述 TCP直连通道与所述源终端进行文件传输。  And the destination terminal is configured to establish, by the server, the TCP direct communication channel with the source terminal, and perform file transmission with the source terminal by using the TCP direct connection channel.
10、 根据权利要求 9 所述的系统, 其特征在于, 所述服务器, 还用于 接收源终端发送的携带有文件标识的文件传输请求, 并获取所述源终端的 NAT地址和端口; 转发所述文件传输请求至所述目的终端, 同时将所述源 终端的 NAT地址与端口发送至所述目的终端; 以及转发所述目的终端反馈 的同意接收文件的响应消息至所述源终端, 同时将将所述目的终端的 NAT 地址与端口发送至所述源终端。  The system according to claim 9, wherein the server is further configured to receive a file transmission request that is sent by the source terminal and that carries the file identifier, and obtain a NAT address and a port of the source terminal; Sending a file transfer request to the destination terminal, and transmitting the NAT address and port of the source terminal to the destination terminal; and forwarding a response message of the consent receiving file fed back by the destination terminal to the source terminal, and simultaneously Sending the NAT address and port of the destination terminal to the source terminal.
11、 根据权利要求 9或 10所述的系统, 其特征在于, 所述服务器为应 用服务器 AS。  11. System according to claim 9 or 10, characterized in that the server is an application server AS.
12、 根据权利要求 11所述的系统, 其特征在于, 所述源终端为权利要 求 5至 8中任意项所述的终端。  The system according to claim 11, wherein the source terminal is the terminal according to any one of claims 5 to 8.
PCT/CN2010/078797 2010-09-19 2010-11-16 Method, terminal and system for file transfers between session initiation protocol (sip) terminals in network address translation (nat) network WO2012034309A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010286998.8 2010-09-19
CN2010102869988A CN101964785A (en) 2010-09-19 2010-09-19 Method, terminal and system for transmitting file between SIP (Session Initiation Protocol) terminals in NAT (Network Address Translation) network

Publications (1)

Publication Number Publication Date
WO2012034309A1 true WO2012034309A1 (en) 2012-03-22

Family

ID=43517518

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/078797 WO2012034309A1 (en) 2010-09-19 2010-11-16 Method, terminal and system for file transfers between session initiation protocol (sip) terminals in network address translation (nat) network

Country Status (2)

Country Link
CN (1) CN101964785A (en)
WO (1) WO2012034309A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112788090A (en) * 2020-05-08 2021-05-11 珠海金山办公软件有限公司 Network resource transmission method, device and system
CN114385104A (en) * 2022-01-14 2022-04-22 西安万像电子科技有限公司 Method, device, medium and equipment for transmitting display data between terminals

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101964785A (en) * 2010-09-19 2011-02-02 中兴通讯股份有限公司 Method, terminal and system for transmitting file between SIP (Session Initiation Protocol) terminals in NAT (Network Address Translation) network
CN104023091B (en) 2013-02-28 2018-10-30 华为终端有限公司 A kind of multilink fusion method and equipment
CN105812422B (en) * 2014-12-29 2019-12-20 深圳市腾讯计算机系统有限公司 File transmission method and device based on Internet of things
CN105812402B (en) * 2014-12-29 2020-04-03 腾讯科技(深圳)有限公司 File transmission method and device based on Internet of things
CN106656649B (en) * 2016-09-14 2021-01-01 腾讯科技(深圳)有限公司 Channel switching method based on speed measurement in real-time call process, client and server
WO2018113909A1 (en) * 2016-12-20 2018-06-28 Huawei Technologies Co., Ltd. Systems and methods for passing pseudo-tunnel information during session initialization
CN109660495B (en) * 2017-10-12 2021-08-27 网宿科技股份有限公司 File transmission method and device
CN108306986B (en) * 2018-03-28 2020-10-27 北京大米科技有限公司 Multi-type media data network address translation traversal method, terminal and system
CN110581866B (en) * 2018-06-07 2022-09-23 中国电信股份有限公司 File transmission method and IP multimedia subsystem IMS network terminal
CN109525592B (en) * 2018-12-14 2023-02-03 平安证券股份有限公司 Data sharing method, device, equipment and computer readable storage medium
CN110740087B (en) * 2019-09-18 2021-01-08 视联动力信息技术股份有限公司 Message transmission method, terminal, gateway device, electronic device and storage medium
CN119544686A (en) * 2025-01-21 2025-02-28 邦彦技术股份有限公司 A transmission method, device and storage medium based on network environment adaptation

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060018996A (en) * 2004-08-26 2006-03-03 주식회사 나라비전 System and method for providing TC channel based on SPI service
CN101035140A (en) * 2007-02-07 2007-09-12 中兴通讯股份有限公司 File transmission system based on the SIP and MSRP and its method
CN101212448A (en) * 2006-12-27 2008-07-02 英华达(南京)科技有限公司 Session initiation protocol communication system, method, and implementation method
CN101964785A (en) * 2010-09-19 2011-02-02 中兴通讯股份有限公司 Method, terminal and system for transmitting file between SIP (Session Initiation Protocol) terminals in NAT (Network Address Translation) network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060018996A (en) * 2004-08-26 2006-03-03 주식회사 나라비전 System and method for providing TC channel based on SPI service
CN101212448A (en) * 2006-12-27 2008-07-02 英华达(南京)科技有限公司 Session initiation protocol communication system, method, and implementation method
CN101035140A (en) * 2007-02-07 2007-09-12 中兴通讯股份有限公司 File transmission system based on the SIP and MSRP and its method
CN101964785A (en) * 2010-09-19 2011-02-02 中兴通讯股份有限公司 Method, terminal and system for transmitting file between SIP (Session Initiation Protocol) terminals in NAT (Network Address Translation) network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WU XIN-LONG: "Solution for NAT traversal of TCP in P2P communications", TELECOMMUNICATIONS FOR ELECTRIC POWER SYSTEM, vol. 27, no. 159, 10 January 2006 (2006-01-10), pages 10 - 12 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112788090A (en) * 2020-05-08 2021-05-11 珠海金山办公软件有限公司 Network resource transmission method, device and system
CN112788090B (en) * 2020-05-08 2023-06-23 珠海金山办公软件有限公司 Network resource transmission method, device and system
CN114385104A (en) * 2022-01-14 2022-04-22 西安万像电子科技有限公司 Method, device, medium and equipment for transmitting display data between terminals

Also Published As

Publication number Publication date
CN101964785A (en) 2011-02-02

Similar Documents

Publication Publication Date Title
WO2012034309A1 (en) Method, terminal and system for file transfers between session initiation protocol (sip) terminals in network address translation (nat) network
WO2011006324A1 (en) Method and terminal for file transmission
JP5972398B2 (en) ICE-based NAT traversal
EP1892887B1 (en) Communication method between communication devices and communication apparatus
WO2007036160A1 (en) An apparatus, system and method for realizing communication between the client and the server
CN101437036B (en) Document transmission method and system capable of supporting NAT/firewall traversing
JP4060281B2 (en) COMMUNICATION SYSTEM, BACKUP SERVER, AND COMMUNICATION CONTROL DEVICE
JP2005086467A (en) Session control device, information communication terminal, server, and terminal
CN101473616A (en) Method and device f or reliably transferring multicast data
WO2007016851A1 (en) A method for establishing the chat room data transmission channel to realize the chat message transmission
WO2009039754A1 (en) Method, media gateway and system for controlling redundant data packets transport
CN102316419A (en) Method for developing multimedia service in wireless local area network, device and system
US20130117460A1 (en) Data management methods for use in a network system and network systems using the same
WO2009152734A1 (en) Process method, system and device for binding/unbinding
JP4940335B2 (en) Telephone exchange apparatus, telephone terminal, and control method used in telephone system
CN101567769A (en) Data retransmission method, system and peer-to-peer node
WO2010031230A1 (en) A media negotiation method for ip multimedia link
WO2011120463A2 (en) Method, system and network device for quality of service (qos) negotiation in cross-medium networks
WO2011015020A1 (en) File transmission method, system and client
JP2006074132A (en) Multicast communication method and gateway device
JP5506941B2 (en) Method for establishing optimized media path and signaling gateway implementing the method
WO2009082908A1 (en) Method, device and system for processing real time streaming protocol
EP2445302B1 (en) Transmission method and system for converged ip messaging
CN101399822A (en) Method for determining media stream path relation and call control system
CN104135468B (en) Support IMS session negotiation control systems, the device and method of multipath relay transmission

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: 10857165

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: 10857165

Country of ref document: EP

Kind code of ref document: A1