A method and system for communication penetration based on session initiation protocol

By intercepting and converting data packets between SIP terminals and servers through border devices, the problem of inconsistent signaling addresses in NAT environments is solved, thus ensuring the reliability of signaling interaction.

CN122268852APending Publication Date: 2026-06-23ZKTECO CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZKTECO CO LTD
Filing Date
2026-03-27
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In a NAT environment, inconsistent signaling addresses in SIP terminal communication can lead to communication failures. Existing solutions such as STUN and ALG suffer from high costs, large latency, or failure in symmetric NAT scenarios.

Method used

By intercepting data packets between SIP terminals and servers through border devices, the source IP and port are converted to public IP and destination port, and the private IP and port in the connection field of the signaling header are modified simultaneously to ensure the address consistency of signaling and media streams.

Benefits of technology

It achieves consistency of SIP signaling addresses in a NAT environment, ensuring the reliability of signaling interaction and avoiding the problem of signaling address mismatch.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122268852A_ABST
    Figure CN122268852A_ABST
Patent Text Reader

Abstract

The application discloses a communication penetration method and system based on a session initiation protocol, and the method comprises the following steps: forcibly intercepting a data packet sent by a SIP terminal to a SIP server, converting a source IP of the data packet into a public network IP, converting a source port of the data packet into a target port, replacing a private IP and a port carried in a header connection field in SIP signaling of the data packet with the public network IP and the target port, and replacing a private media IP and a port in SDP information with a public network IP and a target media port when the SIP signaling carries the SDP information. Therefore, it can be seen that a boundary device uniformly intercepts and processes SIP data packets, fixes a port conversion relationship during registration, synchronously modifies a private address and a port in a signaling header into boundary device public network information, realizes consistency of network layer and application layer address conversion, and avoids SIP signaling address mismatch in a NAT environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and more specifically, to a communication penetration method and system based on a session initialization protocol. Background Technology

[0002] SIP (Session Initiation Protocol), as the core signaling protocol for multimedia communication, carries terminal private IPs and ports in its signaling and SDP (Session Description Protocol) protocols. In a NAT (Network Address Translation) environment, address translation can lead to signaling address inconsistencies and media stream traversal failures, resulting in communication failures. Currently, solutions such as simple NAT and the STUN (Session Traversal Utilities for NAT) either ignore application-layer signaling modifications or rely on relay servers, increasing costs and latency.

[0003] While the Application Layer Gateway (ALG) solution can parse and modify SIP / SDP packet addresses, it has high device performance requirements, fails in symmetric NAT scenarios, lacks a forced proxy mechanism for signaling flows, and may bypass signaling processing. It also relies on standard terminal protocol behavior, and non-standard operations can easily lead to traversal failures.

[0004] Therefore, how to perform communication penetration based on the SIP protocol and avoid inconsistent signaling addresses in SIP terminal communication under NAT environment is a problem that needs to be solved. Summary of the Invention

[0005] In view of the above problems, this application provides a communication traversal method and system based on the session initialization protocol to avoid inconsistent signaling addresses in SIP terminal communication under NAT environment.

[0006] To achieve the above objectives, the following specific solutions are proposed:

[0007] A communication traversal method based on Session Initiation Protocol (SIP) is applied to a boundary device between an intranet and a public network, wherein the public network is equipped with a SIP server and the intranet is equipped with a SIP terminal.

[0008] The method includes:

[0009] When the SIP terminal sends a data packet to the SIP server, the data packet is intercepted;

[0010] The source IP address of the data packet is converted to the public IP address of the border device, and the source port of the data packet is converted to the destination port. The destination port is the port recorded in a pre-established IP port translation table that corresponds to the source port when the SIP terminal registers with the SIP server.

[0011] Replace the private IP address and port number in the header connection field of the SIP signaling of the data packet with the public IP address and the target port, respectively.

[0012] Optionally, the method further includes:

[0013] When the SIP signaling carries Session Description Protocol (SDP) information, the private media IP and port in the SDP information of the SIP signaling are replaced with the public IP and target media port, respectively.

[0014] Optionally, the process of the SIP terminal registering with the SIP server includes:

[0015] When the SIP terminal sends a registration request to the SIP server, the registration request is intercepted;

[0016] The source IP of the registration request is converted to the public IP, and the source port of the registration request is converted to the preset port in the registration request;

[0017] The IP port translation table records and stores the mapping relationship between the source IP and source port of the registration request and the public IP and the preset port;

[0018] Replace the private IP address and port in the header connection field of the SIP signaling of the registration request with the public IP address and the preset port, respectively, to obtain a port redirection registration request;

[0019] When the SIP terminal receives the return instruction from the SIP server in response to the port redirection registration request, the SIP terminal completes the registration process with the SIP server.

[0020] Optionally, the method further includes:

[0021] When the SIP signaling of the registration request carries SDP information, the private media IP and port in the SDP information of the SIP signaling of the registration request are replaced with the public IP and the preset media port in the registration request, respectively.

[0022] The IP port translation table records and stores the mapping relationship between the private media IP and its port in the SDP information of the SIP signaling of the registration request, and the public IP and the preset media port.

[0023] Optionally, after the SIP terminal receives the return instruction from the SIP server in response to the port redirection registration request, the process of the SIP terminal registering with the SIP server is completed, including:

[0024] When the SIP server responds to the port redirection registration request and generates a return instruction to be sent to the SIP terminal, the return instruction is intercepted;

[0025] Based on the mapping relationship between the source IP and source port of the registration request in the IP port translation table and the public IP and the preset port, the public IP of the return instruction is restored to the source IP of the registration request, and the target port of the return instruction is restored to the source port of the registration request;

[0026] The preset port in the header connection field of the SIP signaling of the return instruction is restored to the source port of the registration request, and the public IP in the header connection field of the SIP signaling of the return instruction is restored to the source IP of the registration request corresponding to the source port of the registration request, so as to obtain the intranet return instruction.

[0027] After the SIP terminal receives the intranet return instruction, it completes the process of registering with the SIP server.

[0028] Optionally, the method further includes:

[0029] When the SIP signaling of the return instruction carries SDP information, the preset media port in the SDP information of the SIP signaling of the return instruction is restored to the port in the SDP information of the SIP signaling of the registration request, and the public IP in the SDP information of the SIP signaling of the return instruction is replaced with the private media IP.

[0030] Optionally, the method further includes:

[0031] When the SIP terminal initiates a session establishment request to a called party located on the public network, the session establishment request is intercepted;

[0032] The source IP address of the session establishment request is converted to the public IP address, and the source port of the session establishment request is converted to the target port;

[0033] Replace the private IP address and port in the header connection field of the SIP signaling of the session establishment request with the public IP address and the target port, respectively, to obtain a port redirection session invitation request;

[0034] The port redirection session invitation request is sent to the SIP server, so that the SIP server forwards the port redirection session invitation request to the called party;

[0035] When the called party responds to the port redirection session invitation request and generates a session acceptance instruction to be sent to the SIP terminal, the session acceptance instruction is intercepted, and the signaling IP port is restored and corrected to obtain the session establishment instruction.

[0036] When the SIP terminal receives the session establishment instruction sent by the border device, it completes the establishment of a session between the SIP terminal and the called party.

[0037] A communication traversal system based on Session Initiation Protocol (SIP) includes a boundary device between an intranet and a public network, a SIP server deployed on the public network, and a SIP terminal deployed on the intranet. The boundary device includes a port redirection module, a Network Address Translation (NAT) module, and a signaling processing module.

[0038] The port redirection module is used to intercept and forward data packets sent by the SIP terminal to the SIP server to the NAT module.

[0039] The NAT module is used to convert the source IP of the data packet to the public IP of the border device and to convert the source port of the data packet to the destination port. The destination port is the port recorded in a pre-established IP port translation table that corresponds to the source port when the SIP terminal registers with the SIP server.

[0040] The signaling processing module is used to replace the private IP address and port in the header connection field of the SIP signaling of the data packet with the public IP address and the target port, respectively.

[0041] Optionally, the system may also include:

[0042] The media processing module is used to replace the private media IP and port in the SDP information of the SIP signaling with the public IP and target media port, respectively, when the SIP signaling carries Session Description Protocol (SDP) information.

[0043] Optionally, the port redirection module is further configured to intercept the registration request when the SIP terminal sends a registration request to the SIP server;

[0044] The NAT module is also used to convert the source IP of the registration request to the public IP and convert the source port of the registration request to a preset port in the registration request. In the IP port conversion table, the mapping relationship between the source IP and source port of the registration request and the public IP and the preset port is recorded and stored.

[0045] The signaling processing module is also used to replace the private IP and port in the header connection field of the SIP signaling of the registration request with the public IP and the preset port, respectively, to obtain a port redirection registration request.

[0046] The boundary device is used to complete the registration process between the SIP terminal and the SIP server after the SIP terminal receives a return instruction from the SIP server in response to the port redirection registration request.

[0047] Optionally, the media processing module is further configured to replace the private media IP and port in the SDP information of the SIP signaling of the registration request with the public IP and the preset media port in the registration request when the SIP signaling of the registration request carries SDP information, and record and store the mapping relationship between the private media IP and its port in the SDP information of the SIP signaling of the registration request and the public IP and the preset media port in the IP port conversion table.

[0048] Optionally, the port redirection module is further configured to intercept the return instruction when the SIP server generates a return instruction to be sent to the SIP terminal in response to the port redirection registration request;

[0049] The NAT module is also used to restore the public IP of the returned instruction to the source IP of the registration request, and restore the target port of the returned instruction to the source port of the registration request, based on the mapping relationship between the source IP and source port of the registration request in the IP port translation table and the public IP and the preset port;

[0050] The signaling processing module is further configured to restore the preset port in the header connection field of the SIP signaling of the return instruction to the source port of the registration request, and restore the public IP in the header connection field of the SIP signaling of the return instruction to the source IP of the registration request corresponding to the source port of the registration request, so as to obtain the intranet return instruction.

[0051] Optionally, the media processing module is further configured to, when the SIP signaling of the return instruction carries SDP information, restore the preset media port in the SDP information of the SIP signaling of the return instruction to the port in the SDP information of the SIP signaling of the registration request, and replace the public IP in the SDP information of the SIP signaling of the return instruction with the private media IP.

[0052] Optionally, the system also includes a forwarding module.

[0053] The port redirection module is also used to intercept the session establishment request when the SIP terminal initiates a session establishment request to a called party located on the public network;

[0054] The NAT module is also used to convert the source IP of the session establishment request to the public IP and convert the source port of the session establishment request to the target port;

[0055] The signaling processing module is also used to replace the private IP address and port in the header connection field of the SIP signaling of the session establishment request with the public IP address and the target port, respectively, to obtain a port redirection session invitation request;

[0056] The forwarding module is used to send the port redirection session invitation request to the SIP server, so that the SIP server forwards the port redirection session invitation request to the called party;

[0057] The port redirection module is also used to intercept the session acceptance instruction when the called party responds to the port redirection session invitation request and generates a session acceptance instruction to be sent to the SIP terminal;

[0058] The border device is also used to restore and correct the signaling IP port of the session grant instruction to obtain a session establishment instruction. When the SIP terminal receives the session establishment instruction sent by the border device, it completes the establishment of a session between the SIP terminal and the called party.

[0059] By employing the above technical solution, this application intercepts SIP data packets when a SIP terminal deployed on an intranet sends them to a SIP server deployed on a public network. The source IP address of the data packet is converted to the public IP address of the border device, and the source port is converted to the destination port. The destination port is the port recorded in a pre-established IP port translation table, corresponding to the source port when the SIP terminal registers with the SIP server. The private IP address and port in the header connection field of the SIP signaling data packet are replaced with the public IP address and destination port, respectively. When the SIP signaling carries Session Description Protocol (SDP) information, the private media IP address and port in the SDP information are replaced with the public IP address and destination media port, respectively. Therefore, the border device uniformly intercepts and processes SIP data packets, fixes the port translation relationship during registration, and synchronously modifies the private address and port in the signaling header to the public network information of the border device. This achieves consistency in address translation between the network layer and application layer, avoids SIP signaling address mismatches in NAT environments, and ensures the reliability of signaling interaction. Attached Figure Description

[0060] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0061] Figure 1 A system architecture diagram for implementing communication penetration based on the session initialization protocol provided in this application embodiment;

[0062] Figure 2 A schematic diagram illustrating a process for implementing communication penetration based on a session initialization protocol, provided in an embodiment of this application;

[0063] Figure 3 This is a schematic diagram illustrating a signaling flow for a SIP terminal to register with a SIP server, provided in an embodiment of this application.

[0064] Figure 4 This is a schematic diagram of a signaling flow for a SIP terminal to establish a session with a called party, provided in an embodiment of this application. Detailed Implementation

[0065] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0066] Figure 1 An optional system architecture for implementing communication penetration based on the session initialization protocol, as provided in the embodiments of this application, is as follows: Figure 1 As shown, the system architecture may include: a SIP terminal 00, a border device 10, and a SIP server 20. The SIP terminal 00 is deployed on the internal network, and may be, for example, an Omini AC30 device. The border device 10 is the device between the internal network and the public network, and may be, for example, an AHU-1X60 device. The SIP server 20 is deployed on the public network.

[0067] Specifically, there can be multiple SIP terminals 00, with IP addresses ranging from 192.168.2.203 to 192.168.2.206. Each SIP terminal 00 can access border device 10 through its internal network port (ETH0), and the gateway for each terminal can be set to 192.168.2.202 for initiating / receiving SIP calls and media streams. Border device 10 includes an internal network port and an external network port (ETH1). The internal network port IP address can be 192.168.2.202 (serving as the default gateway for internal network devices), connecting to the internal private network (such as the LAN where SIP terminal 00 resides, with an IP range of 192.168.2.x). The external network port IP address can be 10.8.57.182 (actually a public network or routable address from an upstream network, which can be a public or private IP address assigned by the ISP; here, it is assumed to be an address that communicates with the SIP server), connecting to the external network and the SIP server. The IP address of SIP server 20 can be 192.168.200.99, which is responsible for handling SIP signaling (such as registration and call setup) and media stream negotiation.

[0068] More specifically, the border device 10 may include a port redirection module 11, a NAT module 12, a signaling processing module 13, and a media processing module 14.

[0069] The port redirection module 11 forces all SIP signaling traffic to be processed through the border device 10, preventing the terminal from directly communicating with the external network and causing address information not to be translated. Specifically, this can be achieved through firewall rules or routing policies, intercepting SIP signaling packets received on the internal network interface and forwarding them to the internal SIP signaling processing engine, ensuring that signaling passes through the NAT module 12, signaling processing module 13, and media processing module 14. The NAT module 12 maps internal private IPs to external public IPs. The signaling processing module 13 parses key header fields (such as the tag-related addresses in Via, Contact, and From / To) in SIP signaling (such as REGISTER, INVITE, ACK, etc.), replacing the terminal's private IP and port with the external IP of the border device 10 and the port translated by the NAT module 12, ensuring that the address recorded by the SIP server matches the actual communication address. The media processing module 14 performs deep modification on the SDP information carried in the SIP signaling (such as the IP and port in a=connection-information and a=media), replacing the private media address declared by the terminal with the external IP address of the border device 10 and the mapped media port, enabling external terminals or servers to directly access the real media stream address. The signaling processing module 13 and the media processing module 14 work together to ensure that the media address carried in the SIP signaling is consistent with the NAT-mapped port of the actual media stream transmission. For example, after the SDP description port in the INVITE message is modified, subsequent media streams strictly use the modified port.

[0070] Before implementing the solution, the border devices can be initialized by configuring the internal network IP address (e.g., 192.168.2.202) and external network IP address (e.g., 10.8.57.182) and their interface parameters, and loading port redirection rules, such as blocking signaling on port 5060, loading NAT translation rules, such as internal network IP segment 192.168.2.0 / 24 → external network IP 10.8.57.182, and loading signaling / media coordination processing rules, such as target fields: SIP header + SDP content.

[0071] based on Figure 1 The system architecture shown is as follows: Figure 2 This invention illustrates an optional signaling flow for implementing a communication penetration method based on a session initialization protocol using a border device 10 according to an embodiment of this application. (Refer to...) Figure 2 The process may include:

[0072] Step S101: When the SIP terminal sends a data packet to the SIP server, the data packet is intercepted.

[0073] Specifically, when an intranet SIP terminal 00 sends a data packet to an external SIP server 20, the border device 10 can forcibly intercept the data packet and forward it to the NAT module 11.

[0074] Step S102: Convert the source IP of the data packet to the public IP of the border device, and convert the source port of the data packet to the destination port.

[0075] The target port can be the port recorded in a pre-established IP port translation table, which corresponds to the source port when the SIP terminal registers with the SIP server.

[0076] Specifically, before a session begins between SIP terminal 00 and a terminal on the public network, the SIP terminal must first register with the SIP server. During registration, the mapping relationship between the source IP and port and the public IP and its destination port is recorded in the IP port translation table. Afterwards, when the two parties need to switch IPs and ports between the internal and public networks, they can obtain the required destination IP and port based on the mapping relationship recorded in the IP port translation table. Furthermore, to alleviate the storage pressure on the IP port translation table, it can be configured to release the mapping relationship after a certain period of inactivity, such as 300 seconds.

[0077] Step S103: Replace the private IP address and port number in the header connection field of the SIP signaling data packet with the public IP address and destination port number, respectively.

[0078] Understandably, the signaling processing module 13 replaces the private IP and port in the connection field of the SIP signaling header with the public IP and target port, which allows the public SIP server to only identify and record the public network information of the border device, ensuring that the terminal communication address stored by the server is completely consistent with the actual address after NAT translation, thus solving the signaling address inconsistency from the application layer.

[0079] Furthermore, when SIP signaling carries Session Description Protocol (SDP) information, the media processing module 14 replaces the private media IP address and port in the SDP information with the public IP address and target media port, respectively. It is understood that signaling processing and media processing are linked to ensure that the media address carried in the SIP signaling matches the NAT-mapped port of the actual media stream transmission.

[0080] The communication traversal method based on the Session Initialization Protocol (SDP) provided in this embodiment intercepts SIP packets when a SIP terminal deployed on an intranet sends them to a SIP server deployed on a public network. It then translates the source IP address of the packet to the public IP address of the border device and the source port to the destination port. The destination port is recorded in a pre-established IP port translation table and corresponds to the port used by the SIP terminal when registering with the SIP server. The private IP address and port in the header connection field of the SIP signaling packet are replaced with the public IP address and destination port, respectively. When the SIP signaling carries Session Description Protocol (SDP) information, the private media IP address and port in the SDP information are replaced with the public IP address and destination media port, respectively. Therefore, the border device uniformly intercepts and processes SIP packets, maintains a fixed port translation relationship during registration, and synchronously modifies the private address and port in the signaling header to the public network information of the border device. This ensures consistency between network layer and application layer address translation, avoids SIP signaling address mismatches in NAT environments, and guarantees the reliability of signaling interaction.

[0081] In some embodiments of this application, the process of SIP terminal 00 registering with SIP server 20 as mentioned in the above embodiments is further described, such as... Figure 3 As shown, the process may include:

[0082] Step S201: SIP terminal 00 sends a registration request to SIP server 20. S201: Send registration request to SIP server 20

[0083] Step S202: Port redirection module 11 intercepts the registration request.

[0084] The registration request is sent from SIP terminal 00 to SIP server 20.

[0085] Step S203: NAT module 12 converts the source IP of the registration request to a public IP and converts the source port of the registration request to the preset port in the registration request.

[0086] For example, NAT module 12 can translate the source IP (192.168.2.203) and port (5060) of a registration request to 10.8.57.182:6000.

[0087] Step S204: NAT module 12 records and stores the mapping relationship between the source IP and source port of the registration request and the public IP and preset port in the IP port translation table.

[0088] For example, NAT module 12 can record and store 192.168.2.203:5060←→10.8.57.182:6000 in the IP port translation table.

[0089] In step S205, the signaling processing module 13 replaces the private IP address and port in the header connection field of the SIP signaling in the registration request with the public IP address and the preset port, respectively, to obtain the port redirection registration request.

[0090] For example, the signaling processing module 13 can parse the Contact field in the SIP signaling header, such as 192.168.2.203:5060, and replace it with 10.8.57.182:6000.

[0091] In addition, when the SIP signaling of the registration request carries SDP information, the media processing module 14 can replace the private media IP and port in the SDP information of the SIP signaling of the registration request with the public IP and the preset media port in the registration request, respectively.

[0092] Step S206: Border device 10 sends a port redirection registration request to SIP server 20.

[0093] Furthermore, when SIP terminal 00 receives the return instruction from SIP server 20 in response to the port redirection registration request, the process of SIP terminal 00 registering with SIP server 20 is completed.

[0094] Specifically, after SIP terminal 00 receives the return instruction from SIP server 20 in response to the port redirection registration request, the process of SIP terminal 00 registering with SIP server 20 may include:

[0095] In step S207, SIP server 20 responds to the port redirection registration request and generates a return instruction to be sent to SIP terminal 00.

[0096] Step S208: SIP server 20 sends a return command to SIP terminal 00.

[0097] Step S209: Port redirection module 11 intercepts the return command.

[0098] In step S210, NAT module 12, based on the mapping relationship between the source IP and source port of the registration request in the IP port translation table and the public IP and preset port, restores the public IP of the returned instruction to the source IP of the registration request, and restores the target port of the returned instruction to the source port of the registration request.

[0099] For example, when the border device 10 intercepts a return command from the SIP server 20 to the SIP terminal 00, the NAT module 12 can restore the public IP address and port of the return command, 10.8.57.182:6000, to 192.168.2.203:5060.

[0100] Step S211: The signaling processing module 13 restores the preset port in the header connection field of the SIP signaling of the return instruction to the source port of the registration request, and restores the public IP in the header connection field of the SIP signaling of the return instruction to the source IP of the registration request corresponding to the source port of the registration request, thus obtaining the intranet return instruction.

[0101] For example, when you receive an intranet return command, you can restore the Contact field in the SIP signaling header of the return command from 10.8.57.182:6000 to 192.168.2.203:5060.

[0102] In addition, when the SIP signaling of the return instruction carries SDP information, the media processing module 14 restores the preset media port in the SDP information of the SIP signaling of the return instruction to the port in the SDP information of the SIP signaling of the registration request, and replaces the public IP in the SDP information of the SIP signaling of the return instruction with the private media IP.

[0103] Step S212: The border device sends an intranet return command to the SIP terminal 00.

[0104] Specifically, after SIP terminal 00 receives the intranet return instruction, it completes the process of registering SIP terminal 00 with SIP server 20.

[0105] During the registration process, the logs of SIP server 20 can be checked to confirm that the registration address of SIP terminal 00 is the public IP address of border device 10, rather than a private IP address. During registration, packet capture tools (such as Wireshark) can also be used to capture data packets from the internal and public network ports to verify whether the Contact and SDP addresses in the signaling have been replaced with the external IP address; whether the source / destination IP addresses of the media stream are the external IP address and mapped port of border device 10; and whether SIP terminals 00 across NATs can communicate normally.

[0106] In some embodiments of this application, the process of SIP terminal 00 establishing a session with a called party in the public network is described, as referenced. Figure 4 The process may include:

[0107] Step S301: SIP terminal 00 initiates a session establishment request to the called party.

[0108] Step S302: Port redirection module 11 intercepts the session establishment request.

[0109] Step S303: NAT module 12 converts the source IP of the session establishment request to a public IP and converts the source port of the session establishment request to the target port.

[0110] For example, NAT module 12 translates 192.168.2.203:5004 to 10.8.57.182:6001.

[0111] Step S304: Signaling processing module 13 replaces the private IP address and port in the header connection field of the SIP signaling of the session establishment request with the public IP address and target port, respectively, to obtain the port redirection session invitation request.

[0112] For example, the signaling processing module 13 changes the Contact field in the SIP signaling header of the session establishment request to 10.8.57.182:6001.

[0113] In addition, when the SIP signaling of the session establishment request carries SDP information, the media processing module 14 replaces the private media IP and port in the SDP information with the public IP and target media port, respectively.

[0114] For example, the media processing module 14 modifies the media address in the SDP information to 10.8.57.182:6002 (which is the mapped port).

[0115] Step S305: Border device 10 sends a port redirection session invitation request to SIP server 20.

[0116] Step S306: SIP server 20 forwards the port redirection session invitation request to the called party.

[0117] Step S307: The called party responds to the port redirection session invitation request and generates a session acceptance instruction to be sent to SIP terminal 00.

[0118] Step S308: The called party sends a session acceptance instruction to the SIP terminal 00.

[0119] Step S309: Port redirection module 11 intercepts the session permission command.

[0120] In step S310, the border device 10 restores and corrects the signaling IP port of the session grant instruction to obtain the session establishment instruction.

[0121] Step S311: Send a session establishment command to the SIP terminal.

[0122] Specifically, when SIP terminal 00 receives a session establishment instruction sent by border device 10, it completes the establishment of a session between SIP terminal 00 and the called party.

[0123] Understandably, when SIP terminal 00 acts as the calling party to call a device within the public network (i.e., the called party), the border device 10 can intercept the session request and perform port redirection to avoid inconsistencies in the signaling addresses of SIP terminal communication under NAT, thus enabling call flow traversal between the two terminals on the internal and external networks. In this way, when media streams such as RTP packets are sent from the calling SIP terminal 00, the source IP (192.168.2.203:5004) can be translated by the NAT module 12 into 10.8.57.182:6002, allowing the external called party to directly access this address to complete media transmission.

[0124] Furthermore, when the calling or called party initiates a session termination request, the port redirection method for the session termination request can refer to the port redirection method for the session establishment request. After processing by the border device, the signaling address is ensured to be correct, and the session release is completed.

[0125] The following describes the implementation of the communication penetration system based on the session initialization protocol provided in the embodiments of this application. The communication penetration system based on the session initialization protocol described below can be referred to in correspondence with the communication penetration system based on the session initialization protocol described above.

[0126] refer to Figure 1 The communication penetration system of the Session Initiation Protocol may include a boundary device 10 between the intranet and the public network, a Session Initiation Protocol (SIP) server 20 deployed on the public network, and a SIP terminal 00 deployed on the intranet. The boundary device 10 includes a port redirection module 11, a Network Address Translation (NAT) module 12, and a signaling processing module 13.

[0127] The port redirection module 11 is used to intercept the data packet sent by the SIP terminal to the SIP server and forward it to the NAT module.

[0128] The NAT module 12 is used to convert the source IP of the data packet to the public IP of the border device and convert the source port of the data packet to the destination port. The destination port is the port recorded in a pre-established IP port translation table that corresponds to the source port when the SIP terminal registers with the SIP server.

[0129] The signaling processing module 13 is used to replace the private IP address and port in the header connection field of the SIP signaling of the data packet with the public IP address and the target port, respectively.

[0130] Optionally, the system may also include:

[0131] The media processing module 14 is used to replace the private media IP and port in the SDP information of the SIP signaling with the public IP and target media port, respectively, when the SIP signaling carries Session Description Protocol (SDP) information.

[0132] Optionally, the port redirection module 11 is further configured to intercept the registration request when the SIP terminal sends a registration request to the SIP server;

[0133] The NAT module 12 is also used to convert the source IP of the registration request to the public IP and convert the source port of the registration request to a preset port in the registration request. In the IP port conversion table, the mapping relationship between the source IP and source port of the registration request and the public IP and the preset port is recorded and stored.

[0134] The signaling processing module 13 is further configured to replace the private IP and port in the header connection field of the SIP signaling of the registration request with the public IP and the preset port respectively, to obtain a port redirection registration request;

[0135] The boundary device 10 is used to complete the registration process of the SIP terminal with the SIP server after the SIP terminal receives the return instruction from the SIP server in response to the port redirection registration request.

[0136] Optionally, the media processing module 14 is further configured to replace the private media IP and port in the SDP information of the SIP signaling of the registration request with the public IP and the preset media port in the registration request when the SIP signaling of the registration request carries SDP information, and record and store the mapping relationship between the private media IP and its port in the SDP information of the SIP signaling of the registration request and the public IP and the preset media port in the IP port conversion table.

[0137] Optionally, the port redirection module 11 is further configured to intercept the return instruction when the SIP server generates a return instruction to be sent to the SIP terminal in response to the port redirection registration request;

[0138] The NAT module 12 is further configured to, based on the mapping relationship between the source IP and source port of the registration request in the IP port translation table and the public IP and the preset port, restore the public IP of the returned instruction to the source IP of the registration request, and restore the target port of the returned instruction to the source port of the registration request;

[0139] The signaling processing module 13 is further configured to restore the preset port in the header connection field of the SIP signaling of the return instruction to the source port of the registration request, and restore the public IP in the header connection field of the SIP signaling of the return instruction to the source IP of the registration request corresponding to the source port of the registration request, so as to obtain the intranet return instruction.

[0140] Optionally, the media processing module 14 is further configured to, when the SIP signaling of the return instruction carries SDP information, restore the preset media port in the SDP information of the SIP signaling of the return instruction to the port in the SDP information of the SIP signaling of the registration request, and replace the public IP in the SDP information of the SIP signaling of the return instruction with the private media IP.

[0141] Optionally, the system also includes a forwarding module.

[0142] The port redirection module 11 is also used to intercept the session establishment request when the SIP terminal initiates a session establishment request to a called party located on the public network;

[0143] The NAT module 12 is also used to convert the source IP of the session establishment request to the public IP and convert the source port of the session establishment request to the target port;

[0144] The signaling processing module 13 is further configured to replace the private IP address and port in the header connection field of the SIP signaling of the session establishment request with the public IP address and the target port, respectively, to obtain a port redirection session invitation request;

[0145] The forwarding module is used to send the port redirection session invitation request to the SIP server, so that the SIP server forwards the port redirection session invitation request to the called party;

[0146] The port redirection module 11 is also used to intercept the session acceptance instruction when the called party responds to the port redirection session invitation request and generates a session acceptance instruction to be sent to the SIP terminal;

[0147] The border device 10 is also used to perform signaling IP port restoration and correction on the session grant instruction to obtain a session establishment instruction. When the SIP terminal receives the session establishment instruction sent by the border device, it completes the establishment of a session between the SIP terminal and the called party.

[0148] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0149] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0150] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A communication penetration method based on a session initialization protocol, characterized in that, A boundary device used between an intranet and a public network, wherein the public network is equipped with a Session Initiation Protocol (SIP) server and the intranet is equipped with SIP terminals; The method includes: When the SIP terminal sends a data packet to the SIP server, the data packet is intercepted; The source IP address of the data packet is converted to the public IP address of the border device, and the source port of the data packet is converted to the destination port. The destination port is the port recorded in a pre-established IP port translation table that corresponds to the source port when the SIP terminal registers with the SIP server. Replace the private IP address and port number in the header connection field of the SIP signaling of the data packet with the public IP address and the target port, respectively.

2. The method according to claim 1, characterized in that, Also includes: When the SIP signaling carries Session Description Protocol (SDP) information, the private media IP and port in the SDP information of the SIP signaling are replaced with the public IP and target media port, respectively.

3. The method according to claim 1, characterized in that, The process of the SIP terminal registering with the SIP server includes: When the SIP terminal sends a registration request to the SIP server, the registration request is intercepted; The source IP of the registration request is converted to the public IP, and the source port of the registration request is converted to the preset port in the registration request; The IP port translation table records and stores the mapping relationship between the source IP and source port of the registration request and the public IP and the preset port; Replace the private IP address and port in the header connection field of the SIP signaling of the registration request with the public IP address and the preset port, respectively, to obtain a port redirection registration request; When the SIP terminal receives the return instruction from the SIP server in response to the port redirection registration request, the SIP terminal completes the registration process with the SIP server.

4. The method according to claim 3, characterized in that, Also includes: When the SIP signaling of the registration request carries SDP information, the private media IP and port in the SDP information of the SIP signaling of the registration request are replaced with the public IP and the preset media port in the registration request, respectively. The IP port translation table records and stores the mapping relationship between the private media IP and its port in the SDP information of the SIP signaling of the registration request, and the public IP and the preset media port.

5. The method according to claim 4, characterized in that, After the SIP terminal receives the return instruction from the SIP server in response to the port redirection registration request, the process of the SIP terminal registering with the SIP server is completed, including: When the SIP server responds to the port redirection registration request and generates a return instruction to be sent to the SIP terminal, the return instruction is intercepted; Based on the mapping relationship between the source IP and source port of the registration request in the IP port translation table and the public IP and the preset port, the public IP of the return instruction is restored to the source IP of the registration request, and the target port of the return instruction is restored to the source port of the registration request; The preset port in the header connection field of the SIP signaling of the return instruction is restored to the source port of the registration request, and the public IP in the header connection field of the SIP signaling of the return instruction is restored to the source IP of the registration request corresponding to the source port of the registration request, so as to obtain the intranet return instruction. After the SIP terminal receives the intranet return instruction, it completes the process of registering with the SIP server.

6. The method according to claim 5, characterized in that, Also includes: When the SIP signaling of the return instruction carries SDP information, the preset media port in the SDP information of the SIP signaling of the return instruction is restored to the port in the SDP information of the SIP signaling of the registration request, and the public IP in the SDP information of the SIP signaling of the return instruction is replaced with the private media IP.

7. The method according to any one of claims 1-6, characterized in that, Also includes: When the SIP terminal initiates a session establishment request to a called party located on the public network, the session establishment request is intercepted; The source IP address of the session establishment request is converted to the public IP address, and the source port of the session establishment request is converted to the target port; Replace the private IP address and port in the header connection field of the SIP signaling of the session establishment request with the public IP address and the target port, respectively, to obtain a port redirection session invitation request; The port redirection session invitation request is sent to the SIP server, so that the SIP server forwards the port redirection session invitation request to the called party; When the called party responds to the port redirection session invitation request and generates a session acceptance instruction to be sent to the SIP terminal, the session acceptance instruction is intercepted, and the signaling IP port is restored and corrected to obtain the session establishment instruction. When the SIP terminal receives the session establishment instruction sent by the border device, it completes the establishment of a session between the SIP terminal and the called party.

8. A communication penetration system based on a session initialization protocol, characterized in that, It includes a boundary device between the intranet and the public network, a Session Initiation Protocol (SIP) server deployed on the public network, and a SIP terminal deployed on the intranet. The boundary device includes a port redirection module, a Network Address Translation (NAT) module, and a signaling processing module. The port redirection module is used to intercept and forward data packets sent by the SIP terminal to the SIP server to the NAT module. The NAT module is used to convert the source IP of the data packet to the public IP of the border device and to convert the source port of the data packet to the destination port. The destination port is the port recorded in a pre-established IP port translation table that corresponds to the source port when the SIP terminal registers with the SIP server. The signaling processing module is used to replace the private IP address and port in the header connection field of the SIP signaling of the data packet with the public IP address and the target port, respectively.

9. The system according to claim 8, characterized in that, The boundary device also includes a media processing module; The media processing module is used to replace the private media IP and port in the SDP information of the SIP signaling with the public IP and target media port, respectively, when the SIP signaling carries Session Description Protocol (SDP) information.

10. The system according to claim 8, characterized in that, The port redirection module is also used to intercept the registration request when the SIP terminal sends a registration request to the SIP server; The NAT module is also used to convert the source IP of the registration request to the public IP and convert the source port of the registration request to a preset port in the registration request. In the IP port conversion table, the mapping relationship between the source IP and source port of the registration request and the public IP and the preset port is recorded and stored. The signaling processing module is also used to replace the private IP and port in the header connection field of the SIP signaling of the registration request with the public IP and the preset port, respectively, to obtain a port redirection registration request. The boundary device is used to complete the registration process between the SIP terminal and the SIP server after the SIP terminal receives a return instruction from the SIP server in response to the port redirection registration request.