Method for realizing SIP-NAT by using SIP protocol
Through the SIP-NAT method, SNAT and DNAT address translation and SIPProxy extension technology are used to solve the penetration problem of the SIP protocol in the NAT environment, achieve smooth communication between the private network and the public network, and expand the application scope of the SIP protocol. .
Patent Information
- Application Number
- CN202410932205.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-18
AI Technical Summary
The SIP protocol encounters obstacles when penetrating NAT, resulting in its inability to effectively save IP addresses in an environment where IPV4 addresses are insufficient, limiting the large-scale application of SIP.
The SIP-NAT method is adopted, through SNAT and DNAT address translation, and SIPProxy extension technology is used to define rport parameters to realize address forwarding of SIP messages and ensure smooth communication between the private network and the public network.
It effectively solves the conflict problem between SIP and NAT, enables SIP messages to pass through the gateway smoothly, realizes communication between private network and public network softswitch system, and expands the application scope of SIP protocol.
Smart Images

Figure CN118802829A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer networks, and in particular to a method for implementing SIP-NAT by utilizing the SIP protocol. Background Art
[0002] SIP is an application layer control protocol for multimedia communication on IP networks. Its biggest feature is that it makes full use of the defined header fields. By simply and necessary expansion, it can easily support various new services and intelligent services, which is conducive to the integration with various network applications to develop value-added services. SIP forms a dialogue through the "invite" method. All participants in a conference invited by the same source constitute a call. NAT technology is a technology that can save IP addresses in an environment where IPV4 addresses are increasingly scarce. It allows multiple devices in the internal network to use the same public IP address, effectively saving IP addresses and allowing network managers to save the cost of purchasing IP addresses. NAT is widely used in broadband metropolitan area networks and enterprise networks that are widely developed in my country.
[0003] Since NAT technology is currently mainly used in IP and UDP / TCP layers, and SIP protocol is an application layer protocol based on UDP / TCP, there are many address information in the SIP message header that are essential for routing, connecting SIP signaling and establishing call connections, which has become an obstacle for SIP to penetrate NAT. If the problem of SIP penetrating NAT is solved, it will facilitate the large-scale application of SIP, and thus SIP-NAT came into being.
[0004] The SIP-NAT gateway is a gateway that applies traditional NAT behavior to the data part. It performs NAT address conversion on the rich address information in the SIP message according to the traditional NAT concept and SIP protocol specifications, so that it reaches the correct destination and can be correctly accepted. It is used on the private network boundary. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a method for implementing SIP-NAT using the SIP protocol, which removes the obstacles of SIP penetrating NAT, facilitates the large-scale application of the SIP protocol, and solves the conflict problem of the collaborative work of SIP and NAT.
[0006] The technical solution of the present invention is:
[0007] Including SIP-NAT's SNAT and DNAT address conversion, using SIPProxy extension technology, defining a new header parameter: rport, to extend the SIP message. Then using the address forwarding capability of the traditional NAT mechanism, querying the NAT address table, forwarding the corresponding address and port, to achieve the communication purpose between the private network soft switch system and the public network soft switch system.
[0008] Furthermore,
[0009] The two address forwarding methods include SNAT, where the internal private network sends a request to the external public network, and DNAT, where the external public network sends a request to the internal private network.
[0010] SNAT forwarding uses SIPProxy extension technology. When user1 sends an invite message, it adds the rport parameter in via. NAT queries the rport message with an empty value, inserts the ip and port provided to the outside, and modifies the ip and port of the source host in via, so that it can be compatible with the situation that user2 may not support the SIPProxy extension function. Then, according to the address information of the source host recorded in the NAT table, user2's response message is forwarded.
[0011] DNAT forwarding uses the information about user2 recorded in the NAT table during initialization to match the IP and port of user1 to forward data.
[0012] Going further,
[0013] During the SNAT message transmission process, when user1 sends an invite message, the message reaches SIPProxy, which expands it and adds the rport parameter.
[0014] When the message reaches SIP-NAT, SNAT conversion is performed. NAT assigns it a new port and external address, and inserts this address into the rport parameter with a null value. At the same time, the source host address and port in the Via field are modified to be compatible with systems that do not support the SIPProxy extension.
[0015] The message is sent from NAT to user2's SIPProxy on the external public network. User2 replies with a corresponding message that arrives at NAT. The reply message is sent to user1 through the corresponding item in the NAT table.
[0016] Going further,
[0017] DNAT message transmission process: establish an external SIP system IP address and port table, load it into memory when NAT is initialized, and dynamically update it at any time as the registration status changes;
[0018] When an external call comes in, DNAT performs routing selection after conversion, and sends the message to the corresponding host by checking the matching result of the table on SIP-NAT.
[0019] The beneficial effects of the present invention are
[0020] The present invention effectively solves the conflict problem between SIP and NAT. SIP-NAT can make SIP messages pass through the gateway smoothly, and can make the soft switch system in the private network communicate with the soft switch system in the public network, so that the soft switch system can be more widely used. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of the workflow of the present invention;
[0022] Figure 2 The address indicates the intention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0024] The present invention relates to a soft switching technology of the SIP protocol and a method for implementing SIP-NAT by using the SIP protocol extension. SIP-NAT is a gateway that applies general NAT behavior to the application data part, performs NAT address conversion on the rich address information in the SIP message according to the traditional NAT concept and SIP protocol specification, so that it reaches the correct destination and can be correctly accepted.
[0025] SIP is an application layer control protocol proposed by IETF for multimedia communication on IP network. The biggest feature of SIP protocol is that it makes full use of the defined header fields. By simply and necessary expansion, it can easily support various new services and intelligent services, which is conducive to the integration with various Internet applications to develop value-added services. SIP is a session initiation protocol, SDP is a session description protocol, and the SIP message includes the SDP part, which is the message body of SIP. In the SIP message structure, IP addresses mainly appear in the following parts: Request-line, To field, From field, Via field, Contactfield, Record-route field, Route field, Call-ID. There are also corresponding IP addresses and port information in the SDP part, mainly in the o field.
[0026] NAT: It can be divided into two types: D-NAT (destination NAT), for incoming data packets, first D-NAT is performed to translate the destination address and port into internal address and port, and then routing is selected. S-NAT (source NAT), for outgoing data packets, S-NAT is performed to select an available address and port from the NAT address pool and assign it to the data packet as its source address and port.
[0027] Working principle of SIP-NAT: SIP-NAT gateway is a gateway that applies traditional NAT behavior to the application data part. It NATs the rich address information in the SIP message according to the traditional NAT concept and SIP protocol specifications, so that it reaches the correct destination and can be correctly received. It is applied on the private network boundary. SIP-NAT is divided into Destination Address Translation (DNAT), which processes requests sent from the external public network to the internal private network. Source Address Translation (SNAT), which processes requests sent from the internal private network to the external public network. The topological structure diagram of SIP-NAT is shown in the attached figure. Figure 1 As shown. One of the functions of SIPProxy is to extend the SIP message and define a new header parameter: responseport, encoded as rport. The client inserts this parameter in the Viaheader, and its value is empty. The following uses INVITE as an example to illustrate the design ideas of SIP extension and network layer SIP-NAT. It is agreed here that the action performed by traditional NAT is called NAT, and the action performed by the inserted code for identifying and processing SIP is referred to as SIP-NAT.
[0028] The message transmission process of sending a request from the internal private network to the external public network: When user1 sends an invite message, the message reaches SIPProxy, which expands it and adds the rport parameter. When the message reaches SIP-NAT, since it is an outgoing message, SNAT conversion is required. NAT assigns it a new port and external address, and inserts this address into the rport parameter with a null value. At the same time, the source host address and port in the Via field are modified to be compatible with systems that do not support SIP extensions. The message is sent from NAT to user2's SIPProxy on the external public network. User2 replies to the corresponding message and reaches NAT. Through the corresponding item in the NAT table, the reply message is sent to user1.
[0029] The message transmission process of sending a request from the external public network to the internal private network: establish the external SIP system IP address and port table, load it into the memory when NAT is initialized, and dynamically update it at any time as the registration situation changes. Due to the forwarding function set by NAT, when an external call comes, DNAT conversion is performed after routing selection. By checking the matching results of the table on SIP-NAT, the message can be sent to the corresponding host.
[0030] The following describes the specific implementation of SIP-NAT gateway address forwarding:
[0031] 1. The internal private network sends a request to the external public network:
[0032] Define a new Viaheader parameter: responseport, encoded as "report", the client inserts this parameter in the Viaheader, and its value is empty
[0033] (1) user1 sends an invite message
[0034] INVITE sip:user1@domain SIP
[0035] Via: SIP / UDP 192.168.1.68:4090
[0036] (2) The message arrives at SIPProxy, which expands the message and adds the rport parameter, indicating that the source host of the SIP message is the address in the Via header and that the message is sent outward:
[0037] INVITE sip:user1@domain SIP
[0038] Via: SIP / UDP 192.168.1.68:4090;rport
[0039] (3) The message arrives at NAT. This is an outgoing message and needs to be translated by SNAT. NAT assigns a new external address and port 10.110.26.4:4500. At this time, the internal address in the NAT table is rewritten with 192.168.1.68:4090 in the Via field with the rport parameter, so that the response message reaches the source host directly. The address table is shown in the attached figure. Figure 2 As shown. NAT inserts the address 10.110.26.4:4500 into the message with the rport parameter, and rewrites the source host address and port in the Via field with this external address, so that it is compatible with the SIP system that receives this message and does not support SIP extensions. This is how the message becomes:
[0040] INVITE sip:user1@domain SIP
[0041] Via: SIP / UDP 10.110.26.4:4500; recived=10.110.26.4; rport=4500
[0042] (4) The message arrives at the SIP Proxy of user2 on the external public network. If the Proxy supports SIP extension, it will send the message to the address and port pointed to by the received and rport parameters. Otherwise, it will ignore received and rport and directly send the response message to 10.110.26.4:4500. The response message is as follows:
[0043] SIP 200OK
[0044] Via: SIP / UDP 10.110.26.4:4500; recived=10.110.26.4; rport=4500
[0045] (5) When the response message arrives at NAT, the first thing to do is D-NAT. The work that needs to be done before DNAT is to rewrite the address and port in the Via field with a non-empty rport parameter with the corresponding internal address and port in the NAT table, and then strip off all previous Via headers, so that the Via with the rport parameter becomes the current Via header, and then D-NAT is performed. Because there is a corresponding entry in the NAT table, the message is sent directly to 192.168.1.68:4090.
[0046] 2. The external public network sends a request to the internal private network:
[0047] (1) Establish a SIP system registry:
[0048] IP PORT username 192.168.1.68 4090 User1
[0049] (2) Initialize SIP-NAT, load the registration table into memory, and dynamically update it as the registration status changes. Its initial value is the registered user information in the configuration file, and the format is as follows:
[0050] HOST IP PORT
[0051] (3) Because the address registered externally is a NAT address, and because NAT is set up with a forwarding function, when an external call comes in, D-NAT must first be performed, and then routing selection must be performed. When D-NAT is performed, SIP-NAT searches the table above to see if there is a matching user name or phone number. If so, the destination address and port are rewritten with the corresponding items in the table above and then sent to the corresponding host.
[0052] The above description is only a preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, and is not used to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A method for implementing SIP-NAT using the SIP protocol, characterized in that: Including SIP-NAT's SNAT and DNAT address translation, using SIPProxy extension technology, defining a new header parameter: rport, to extend SIP messages; Then, the address forwarding capability of the NAT mechanism is used to query the NAT address table, forward the corresponding address and port, and achieve the communication purpose between the private network soft switch system and the public network soft switch system.
2. The method according to claim 1, characterized in that Address forwarding methods include destination address translation DNAT, which processes requests from the external public network to the internal private network; source address translation SNAT, which processes requests from the internal private network to the external public network.
3. The method according to claim 2, characterized in that SNAT forwarding uses SIPProxy extension technology. When user user1 sends an invite message, the rport parameter is added to via. After NAT queries the rport message with an empty value, it inserts the ip and port provided to the outside world, and modifies the ip and port of the source host in via, so as to be compatible with the situation where user user2 does not support the SIPProxy extension function; then, according to the address information of the source host recorded in the NAT table, the response message of user user2 is forwarded.
4. The method according to claim 2, characterized in that: DNAT forwarding uses the information of the relevant user user2 recorded in the NAT table during initialization to match the IP and port of the corresponding user user1 to forward data.
5. The method according to claim 3, characterized in that: During the SNAT message transmission process, when user 1 sends an invite message, the message reaches SIPProxy, which expands it and adds the rport parameter.
6. The method according to claim 5, characterized in that When the message reaches SIP-NAT, SNAT conversion is performed. NAT assigns it a new port and external address, and inserts this address into the rport parameter with a null value. At the same time, the source host address and port in the Via field are modified to be compatible with systems that do not support the SIPProxy extension.
7. The method according to claim 6, characterized in that The message is sent from NAT to the SIPProxy of user 2 on the external public network. User 2 replies to the corresponding message which arrives at NAT. The reply message is sent to user 1 through the corresponding item in the NAT table.
8. The method according to claim 4, characterized in that DNAT message transmission process: establish an external SIP system IP address and port table, load it into memory when NAT is initialized, and dynamically update it at any time as the registration status changes; When an external call comes in, DNAT performs routing selection after conversion, and sends the message to the corresponding host by checking the matching result of the table on SIP-NAT.
Citation Information
Patent Citations
Private network access system based on SIP soft phone and method thereof
CN101860536A
Method and device for NAT (Network Address Translation) traversal of SIP (Session Initiation Protocol) message in Genesys environment
CN106506711A
Data interaction method and device, NAT gateway and storage medium
CN117240820A
