Summary of the invention
The object of the invention is to overcome above-mentioned shortcoming of the prior art, providing one can when providing that reliably NAT passes through, reduce server load based on SDP Autonomous test NAT ride through system and method.
In order to realize above-mentioned object, of the present invention have following formation based on SDP Autonomous test NAT ride through system:
Should comprise based on SDP Autonomous test NAT ride through system: first terminal and the second terminal, registrar and pass through server.
Wherein, first terminal and the second terminal all connect public network by NAT router, and in order to send registration request, acquisition log-on message and transmission comprise the communication request of described log-on message;
Registrar connects public network, with described first terminal and the second terminal interaction, according to the described registration request obtained, provides corresponding log-on message to described first terminal and the second terminal;
Pass through server and connect public network, mutual with described first terminal, the second terminal and registrar, according to the communication request obtained, the first terminal described in realization and the NAT between the second described terminal pass through.
Should based in SDP Autonomous test NAT ride through system, described log-on message comprises public network IP address corresponding to terminal and NAT router bundling port.
Should based in SDP Autonomous test NAT ride through system, described communication request is the SDP information comprising target terminal information, source terminal public network IP address and source terminal NAT router bundling port.
Should based in SDP Autonomous test NAT ride through system, described pass through server realize described in first terminal and the second described terminal between NAT pass through as adding trunking port to described SDP information.
Should based in SDP Autonomous test NAT ride through system, first terminal described in described realization and the NAT between the second described terminal pass through, be specially, pass through sequence server and select private address, publicly-owned address, the first terminal described in relay address and communication mode between the second described terminal, realize NAT and pass through.
The present invention also provides a kind of based on SDP Autonomous test NAT through method, and the method comprises the following steps:
(1) first terminal and the second terminal connect public network by NAT router, and send registration request to the registrar being connected to public network;
(2) registrar described in, according to the described registration request obtained, provides corresponding log-on message to described first terminal and the second terminal;
(3) one in the first terminal described in and the second terminal as source terminal, another is as target terminal, source terminal sends to the server that passes through being connected to public network the communication request communicated with target terminal, and this communication request comprises the communication request of described log-on message;
(4) described in pass through server according to obtain communication request, the first terminal described in realization and the NAT between the second described terminal pass through.
Should based in SDP Autonomous test NAT through method, described log-on message comprises public network IP address corresponding to terminal and NAT router bundling port.
Should based in SDP Autonomous test NAT through method, described communication request is the SDP information comprising target terminal information, source terminal public network IP address and source terminal NAT router bundling port.
Should based in SDP Autonomous test NAT through method, described pass through server realize described in first terminal and the second described terminal between NAT pass through as adding trunking port to described SDP information.
Should based in SDP Autonomous test NAT through method, first terminal described in described realization and the NAT between the second described terminal pass through, be specially, pass through sequence server and select private address, publicly-owned address, the first terminal described in relay address and communication mode between the second described terminal, realize NAT and pass through.
Have employed this invention based on SDP Autonomous test NAT ride through system and method, because terminal independently obtains public network address, Autonomous test connectivity of link is adopted to ensure reliable data transmission, what the present invention proposed not only can successful passing through NAT based on SDP Autonomous test NAT ride through system and method, the terminal being in Intranet is made can directly to set up point-to-point connection, adopt Server Relay can compensate for the deficiency being in symmetry NAT terminal and cannot communicating, guarantee the reliability and stability that between terminal, data send.
Embodiment
In order to more clearly understand technology contents of the present invention, describe in detail especially exemplified by following examples.
Refer to shown in Fig. 1, for of the present invention based on the structured flowchart of SDP Autonomous test NAT ride through system.
In one embodiment, should comprise based on SDP Autonomous test NAT ride through system: first terminal and the second terminal, registrar and pass through server.
Wherein, first terminal and the second terminal all connect public network by NAT router, and in order to send registration request, acquisition log-on message and transmission comprise the communication request of described log-on message;
Registrar connects public network, with described first terminal and the second terminal interaction, according to the described registration request obtained, provides corresponding log-on message to described first terminal and the second terminal;
Pass through server and connect public network, mutual with described first terminal, the second terminal and registrar, according to the communication request obtained, the first terminal described in realization and the NAT between the second described terminal pass through.
The present invention also provides a kind of based on SDP Autonomous test NAT through method, and the method comprises the following steps:
(1) first terminal and the second terminal connect public network by NAT router, and send registration request to the registrar being connected to public network;
(2) registrar described in, according to the described registration request obtained, provides corresponding log-on message to described first terminal and the second terminal;
(3) one in the first terminal described in and the second terminal as source terminal, another is as target terminal, source terminal sends to the server that passes through being connected to public network the communication request communicated with target terminal, and this communication request comprises the communication request of described log-on message;
(4) described in pass through server according to obtain communication request, the first terminal described in realization and the NAT between the second described terminal pass through.
In more preferably execution mode, described log-on message comprises public network IP address corresponding to terminal and NAT router bundling port.
In further preferred embodiment, described communication request is the SDP information comprising target terminal information, source terminal public network IP address and source terminal NAT router bundling port.
Further preferred embodiment in, described pass through server realize described in first terminal and the second described terminal between NAT pass through as adding trunking port to described SDP information.
In preferred execution mode, first terminal described in described realization and the NAT between the second described terminal pass through, be specially, pass through sequence server and select private address, publicly-owned address, the first terminal described in relay address and communication mode between the second described terminal, realize NAT and pass through.
In an application of the invention, as shown in Figure 1, the present invention is a kind of based on SDP Autonomous test NAT ride through system, comprise and send communication request terminal 1, requested terminal 2, terminal is connected to public network by NAT router, and terminal can obtain NAT information by autonomous learning, integrates the SDP message comprising communication attributes information; Endpoint registration server A, all NAT of need pass through terminal and register on registrar, terminal sends registration message, and message comprises terminal and uniquely indicates ID, local private address, registrar receives log-on message, preserve Termination ID and corresponding source IP address, registrar assists terminal to obtain local public network address, and server and terminal are carried out alternately, return the corresponding public network address of terminal, and corresponding NAT router bundling port address; Assist NAT pass through server B, server receives terminal request communication SDP message, detect-message form legitimacy, whether comprise private address and public network address, and the port of messaging to be communicated, NAT pass through server needs bundling port to be trunking port, and amendment SDP message content, adds trunking port.
In step S01, terminal needs timed sending registration message to registrar, registrar is positioned at public network, terminal can directly send registration message to server, terminal should be bound and be monitored fixed port, for occurring or accepting communication request SDP message, registration message comprises, terminal uniquely indicates ID, registrar will preserve Termination ID, and registration message source IP address and port, and ID and address are bound, and this ID is set as legal terminal, registrar receives registration message at every turn will upgrade corresponding ID source IP address, registrar preserves IP address of terminal and port object is for there is communication request to Requested Party, registrar receives registration message, the message that succeeds in registration can be returned to registration terminal after success.Whole registration logic is simple, can not have much impact to system load.
In step S02, when terminal need communicate with other-end, local NAT essential information need be obtained and bind and wait to receive and dispatch message port, utilize with registrar mutual, terminal can obtain self public network address, find after being positioned at that type NAT, and NAT router is the port of a local port binding.Terminal sends binding request message, message comprises local source address and port numbers, if after terminal is positioned at one or more NAT, when binding request message arrives registrar, message source IP address is mapped to the IP address of the NAT near registrar, registrar copies to this source IP address and port numbers in a binding response message, send it back the terminal having this IP address and port numbers, terminal receives message, local corresponding public network address can be obtained, and local bundling port corresponding NAT router side slogan.
In step S03, terminal gets public network address, after binding local port and corresponding NAT router port, need be integrated into SDP for requested terminal interaction, SDP comprises two addresses and port, private address and port, public network address and port, these two addresses and port represent two kinds of different links respectively, private address and port are that terminal is ready to use in and carries out alternately with requested terminal, and port is terminal local binding.Public network address and port are the mailing address and port that are created by NAT device, and port is counterpart terminal local port on NAT router.The SDP information integrated is sent to NAT and passes through server, server need be verified terminal identity, therefore, need in SDP information to comprise Termination ID and password, terminal can be encrypted ID and password, encryption adopts Digest-MD5 algorithm, rule is ID: registrar address or domain name: password, and terminal carries out md5 encryption according to rule, is stored in SDP information as base attribute, be sent to server, server determines whether proxy terminal request by according to the legitimacy of terminal.
In step S04, NAT passes through server and receives terminal communication request SDP information, to verify terminal legality and SDP property value, server is according to Termination ID, according to rule ID: registrar address or domain name: password, carry out md5 encryption, encrypted result is mated with property value in SDP.The checking of SDP property value comprises inspection link address and whether port is correct, and whether comprises medium property.All be verified after, server expands SDP information, server is in local bundling port, server address and port are saved to SDP information, the mailing address that this server this locality creates and port, be transit server address and port, only for the communication link of transit server technology.The SDP information of expansion is sent to requested terminal by server.
In step S05, requested terminal receives the communication request by transit server, will according to shown in S02 step, local binding port to be communicated, by obtaining public network address and corresponding nat port alternately with registrar, obtains requisite information and according to shown in S03 step, integrate SDP information, comprise Termination ID and password, cryptographic attributes, and two connection attributes, private address and port, public network address and port, after having integrated, send SDP to NAT and pass through server.After server receives requested terminal SDP information, shown in S04 step, verification terminal legitimacy and SDP property value integrality, and binding local port, preserve server address and port, expand SDP information, as Requested Party repeated link, send requested SDP information to requesting terminal.
In step S06, the Requested Party SDP information of requesting party's reception server transfer, now, requesting party and Requested Party all obtain the SDP information of the other side, and both sides will detect link, select one as communication path.Three addresses and port that represent three kinds of communication modes are comprised in the other side's SDP information that terminal obtains, terminal needs to select a kind of mode to communicate in these three kinds of communication modes, before selection, communication link is tested, whether selection is communicated with according to link, acquiescence selecting sequence is private address, public network address, Server Relay address, namely preferentially private address is detected, if this link can select this link as final communication mode by this terminal, if this link is unavailable, then select public network link and detect, if this link can be used, then select public network link as final communication mode, if unavailable, then select Server Relay link, Server Relay connectivity of link is ensured by server, terminal directly selects this link as final communication mode, do not need to detect.Detecting link methodology is that terminal sends detect-message to peer IP address and port, and terminal returns response message after receiving detect-message, and request detection side receives detection response message in response time, then determine that this communication link can be used; If do not receive inspection again in the response time to receive the response, then think that this link is unavailable, the response time can be set as in 10 seconds.
The present invention, by the mutual private address of terminal room, can be the node that terminal node finds to be in it same Intranet, thus not need to carry out NAT penetration step, so both ensure that the reliability of communication connection and transfer of data, also improved transmission speed.Terminal independently obtains public network address, Autonomous test connectivity of link is adopted to ensure reliable data transmission, what the present invention proposed not only can successful passing through NAT based on SDP Autonomous test NAT ride through system and method, the terminal being in Intranet is made can directly to set up point-to-point connection, adopt Server Relay can compensate for the deficiency being in symmetry NAT terminal and cannot communicating, guarantee the reliability and stability that between terminal, data send.
In this description, the present invention is described with reference to its specific embodiment.But, still can make various amendment and conversion obviously and not deviate from the spirit and scope of the present invention.Therefore, specification and accompanying drawing are regarded in an illustrative, rather than a restrictive.