SIP media stream and signaling consistency forwarding methods, electronic devices, readable media, and program products.

By generating ternary and quinary expected forwarding relationships in the SIP protocol and dynamically mapping addresses and ports, the problem of detection failure caused by the conversion of media streams before INVITE messages is solved, and the correct forwarding and consistency verification of media streams are achieved.

CN119420740BActive Publication Date: 2025-12-02BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411715480.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-12-02
Estimated Expiration
2044-11-27

AI Technical Summary

Technical Problem

In SIP protocol communication, if a media stream is sent before the 200 OK acknowledgment message of the INVITE packet arrives, the network forwarding device performs port translation on the media stream, causing the media receiver to fail detection and reject the media stream because it cannot pass the consistency check.

Method used

By generating a ternary expected forwarding relationship in the INVITE direction and matching a quintuple relationship when receiving media streams, consistent forwarding of media streams and signaling is ensured. This includes parsing INVITE messages to extract call identifiers and media information, generating ternary expected forwarding relationships, updating them to quintuple expected forwarding relationships when receiving 200 OK messages, and performing dynamic mapping of addresses and ports.

Benefits of technology

This ensures that media streams can be forwarded correctly and reliably to the target client, resolving the forwarding anomaly caused by media streams arriving before 200 OK messages, and achieving consistent media stream forwarding in SIP sessions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119420740B_ABST
    Figure CN119420740B_ABST
Patent Text Reader

Abstract

This disclosure provides a method for consistent forwarding of SIP media streams and signaling, comprising: generating a ternary expected forwarding relationship in the INVITE direction based on the conversion relationship formed by the INVITE message of the SIP protocol; receiving a media stream and matching the ternary expected forwarding relationship according to the 5-tuple relationship of the media stream; if the match is successful and a 200 OK message has not yet been received, generating a 5-tuple expected forwarding relationship based on the 5-tuple relationship of the media stream; receiving a 200 OK message corresponding to the INVITE message and checking whether a 5-tuple expected forwarding relationship already exists; if no 5-tuple expected forwarding relationship exists, generating a 5-tuple expected forwarding relationship based on the conversion relationship formed by the 200 OK message and the ternary expected forwarding relationship; converting the received media stream according to the 5-tuple expected forwarding relationship and forwarding the converted media stream. This disclosure also provides an electronic device, a computer-readable medium, and a computer program product. This disclosure implements address and port consistency forwarding of SIP media streams and signaling messages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of network communication technology, and in particular to a SIP media stream and signaling consistency forwarding method, an electronic device, a computer-readable medium, and a computer program product. Background Technology

[0002] SIP (Session Initiation Protocol) is an application-layer control protocol widely used to establish, modify, and terminate multimedia sessions, such as internet telephony and video conferencing. SIP is particularly prevalent in audio and video transmission within video conferencing systems and security applications.

[0003] Network forwarding devices are used to protect network security, typically deployed between internal and external networks. Their main function is to block data that violates pre-defined security policies, and to transmit compliant data to the target network after security filtering. These devices effectively defend against potential external attacks and ensure the security of the internal network through physical isolation and blocking mechanisms.

[0004] When transmitting SIP protocol data across internal and external networks, network forwarding devices need to perform special address and port translations, especially when processing media data within the SIP protocol, which involves more complex operations. During this process, it is essential to ensure the consistency between SIP protocol signaling and media data.

[0005] However, when network forwarding devices use port forwarding technology, media streams may fail to pass consistency checks, causing clients to refuse to receive media streams. Summary of the Invention

[0006] This disclosure provides a SIP media stream and signaling consistency forwarding method, an electronic device, a computer-readable medium, and a computer program product.

[0007] In a first aspect, embodiments of this disclosure provide a SIP media stream and signaling consistency forwarding method, comprising: generating a ternary expected forwarding relationship in the INVITE direction based on a conversion relationship formed by an INVITE message in the SIP protocol; receiving a media stream and matching the ternary expected forwarding relationship according to the quintuple relationship of the media stream; if the matching is successful and a 200 OK message has not yet been received, generating a quintuple expected forwarding relationship based on the quintuple relationship of the media stream; receiving a 200 OK message corresponding to the INVITE message and checking whether a quintuple expected forwarding relationship already exists; if no quintuple expected forwarding relationship exists, generating a quintuple expected forwarding relationship based on the conversion relationship formed by the 200 OK message and the ternary expected forwarding relationship; converting the received media stream according to the quintuple expected forwarding relationship and forwarding the converted media stream.

[0008] In some embodiments, generating a ternary expected forwarding relationship in the INVITE direction based on the conversion relationship formed by the INVITE message of the SIP protocol includes: parsing the INVITE message of the SIP protocol to extract the call identifier and media information, wherein the media information includes the transport protocol, a first address, and a first port; selecting a first mapping address and a first mapping port corresponding to the first address and the first port, and generating a corresponding conversion relationship; generating a ternary expected forwarding relationship in the INVITE direction based on the call identifier, the transport protocol, and the conversion relationship, wherein the ternary expected forwarding relationship includes the call identifier, the transport protocol, the first address, the first port, the first mapping address, and the first mapping port; and replacing the first address and the first port in the INVITE message with the corresponding first mapping address and the first mapping port according to the generated ternary expected forwarding relationship, and forwarding the modified INVITE message.

[0009] In some embodiments, receiving a media stream and matching the ternary expected forwarding relationship based on the quintuple relationship of the media stream includes: receiving the media stream and extracting the quintuple relationship of the media stream; and matching the ternary expected forwarding relationship based on the extracted quintuple relationship.

[0010] In some embodiments, if a match is successful and a 200 OK message has not yet been received, a five-element expected forwarding relationship is generated based on the five-element relationship of the media stream, including: if a match is successful and a 200 OK message has not yet been received, selecting the corresponding mapping address and mapping port of the second address and the second port in the five-element relationship of the media stream, and generating the corresponding conversion relationship; updating the three-element expected forwarding relationship based on the generated conversion relationship, and generating a five-element expected forwarding relationship.

[0011] In some embodiments, receiving a 200OK message corresponding to the INVITE message and checking whether a five-ary expected forwarding relationship already exists includes: receiving a 200OK message corresponding to the INVITE message, extracting a call identifier and media information from the 200OK message, wherein the media information includes a transport protocol, a second address, and a second port; and checking whether a five-ary expected forwarding relationship already exists based on the call identifier.

[0012] In some embodiments, after receiving the 200OK message corresponding to the INVITE message and checking whether a five-element expected forwarding relationship already exists, the method further includes: if it is confirmed that a five-element expected forwarding relationship already exists, replacing the second address and the second port in the received 200OK message with the corresponding mapped address and mapped port according to the five-element expected forwarding relationship, and forwarding the modified 200OK message.

[0013] In some embodiments, when a five-ary expected forwarding relationship does not exist, generating a five-ary expected forwarding relationship based on the conversion relationship formed through the 200OK message and the ternary expected forwarding relationship includes: when a five-ary expected forwarding relationship does not exist, selecting a second mapping address and a second mapping port corresponding to the second address and the second port, and generating a corresponding conversion relationship; searching for the ternary expected forwarding relationship based on the call identifier; generating a five-ary expected forwarding relationship based on the conversion relationship and the ternary expected forwarding relationship, wherein the five-ary expected forwarding relationship includes the call identifier, transport protocol, first address, first port, second mapping address, second mapping port, first mapping address, first mapping port, second address, and second port; and according to the generated five-ary expected forwarding relationship, replacing the second address and the second port in the 200OK message with the corresponding second mapping address and the second mapping port, and forwarding the modified 200OK message.

[0014] In some embodiments, converting the received media stream according to the five-tuple expected forwarding relationship and forwarding the converted media stream includes: converting the five-tuple relationship of the received media stream according to the five-tuple expected forwarding relationship; and forwarding the media stream with the converted five-tuple relationship.

[0015] In a second aspect, embodiments of this disclosure provide an electronic device, including: one or more processors; and a memory storing one or more programs thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the SIP media stream and signaling consistency forwarding method described in the first aspect of this disclosure.

[0016] Thirdly, embodiments of this disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the SIP media stream and signaling consistency forwarding method described in the first aspect of embodiments of this disclosure.

[0017] Fourthly, embodiments of this disclosure provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the SIP media stream and signaling consistency forwarding method described in the first aspect of this disclosure.

[0018] This disclosure provides a method for consistent forwarding of media streams and signaling in the SIP protocol. By establishing ternary and quinary expected forwarding relationships, it achieves dynamic mapping of address and port translations in media streams and signaling packets. Specifically, upon receiving an INVITE, address and port information are extracted to generate a ternary expected forwarding relationship. Upon arrival of a 200 OK packet or the first media stream packet, the ternary expected forwarding relationship is updated to generate a quinary expected forwarding relationship. This method effectively solves the forwarding anomaly caused by the media stream arriving before the 200 OK packet, ensuring that media streams in a SIP session can be correctly and reliably forwarded to the target client. Attached Figure Description

[0019] Figure 1 This is a flowchart of a SIP media stream and signaling consistency forwarding method according to an embodiment of this disclosure;

[0020] Figure 2 This is a schematic flowchart of a SIP protocol signaling forwarding method according to an embodiment of this disclosure;

[0021] Figure 3 This is a schematic flowchart of a SIP media stream forwarding method according to an embodiment of the present disclosure;

[0022] Figure 4 This is a schematic diagram of the composition of an electronic device according to an embodiment of the present disclosure;

[0023] Figure 5 This is a block diagram of a SIP media stream and signaling consistency forwarding system according to an embodiment of the present disclosure;

[0024] Figure 6 A flowchart of a SIP call passing through a network forwarding device is shown. Detailed Implementation

[0025] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions of this disclosure will be described in detail below with reference to the accompanying drawings.

[0026] Exemplary embodiments will be described more fully below with reference to the accompanying drawings; however, these exemplary embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will enable those skilled in the art to fully understand the scope of this disclosure.

[0027] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.

[0028] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0029] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are also intended to include the plural forms unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded.

[0030] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0031] Unless otherwise specified in this disclosure, the following technical terms shall be interpreted as follows:

[0032] The INVITE message is a request message in the SIP protocol used to initiate a session. It invites the other party to participate in a call or multimedia session and contains session parameters and protocol information.

[0033] CALL_ID is an identifier in the SIP protocol used to uniquely identify a session. The CALL_ID remains consistent across all messages within the same session and is used to associate signaling and media streams within the session.

[0034] SDP (Session Description Protocol) is used to describe detailed information about a multimedia session, including the transport protocol, media format, IP address, and port of the media stream. SDP information is typically embedded in SIP messages (such as INVITE and 200 OK) and is used to negotiate media parameters between the two parties in the session.

[0035] The INVITE message is one of the request messages in the SIP protocol, used to initiate a session request to the other party.

[0036] The 200 OK message is an acknowledgment message in the SIP protocol in response to an INVITE request.

[0037] The source address (SRC_IP) and source port (SRC_PORT) refer to the IP address and port of the media stream sender, used to identify the source of the media stream data packets.

[0038] Destination address and destination port refer to the IP address and port of the media stream receiver, used to identify the destination of the media stream. They are typically negotiated and specified in the SDP of the INVITE and 200 OK messages.

[0039] Source address mapping (SRC_IP_NAT) and source port mapping (SRC_PORT_NAT) are alternative addresses and ports assigned by network forwarding devices to source addresses and source ports, used for address translation when transmitting across network boundaries (such as intranet and extranet).

[0040] Destination address mapping (IP_NAT) and destination port mapping (PORT_NAT) are alternative addresses and ports assigned by network forwarding devices to destination addresses and ports. They are used to replace the original destination addresses and ports during the forwarding of media streams to ensure security and connection correctness across networks.

[0041] NAT (Network Address Translation) is a network translation mechanism used to translate IP addresses and ports between private and public networks, enabling devices on an internal network to communicate with the outside world via public IP addresses. NAT is widely used in SIP media streaming to achieve media stream forwarding across network segments.

[0042] A media stream 5-tuple relationship refers to a unique identifier for a media stream, containing five elements: protocol type (UDP / TCP), source address, source port, destination address, and destination port. The 5-tuple relationship is commonly used in network forwarding devices to accurately match and process media stream forwarding rules.

[0043] Media stream forwarding is the process of transmitting media data packets from the source end to the destination end through network forwarding devices.

[0044] This disclosure aims to address the following problem: In SIP protocol communication, when a media stream is sent before the arrival of the 200 OK acknowledgment message of the INVITE packet, and the network forwarding device performs port translation on the media stream, the media receiver fails to enable media stream and signaling consistency verification, thus rejecting the media stream. The method proposed in this disclosure aims to ensure that the media stream can pass the consistency verification in this situation and be successfully received.

[0045] This application provides a method to solve the following problem in the SIP protocol: when a media stream arrives before the 200 OK message corresponding to the INVITE message, and the network forwarding device performs port translation on the media stream, the media receiver will fail to detect the media stream and thus reject the media stream after enabling media stream and signaling consistency verification.

[0046] Figure 1 This is a flowchart of a SIP media stream and signaling consistency forwarding method according to an embodiment of this disclosure.

[0047] Firstly, referring to Figure 1 This disclosure provides a SIP media stream and signaling consistency forwarding method, including:

[0048] S11. Based on the conversion relationship formed by the INVITE message through the SIP protocol, generate a ternary expected forwarding relationship in the INVITE direction;

[0049] S12. Receive the media stream and match the ternary expected forwarding relationship according to the five-tuple relationship of the media stream;

[0050] S13. If the match is successful and a 200 OK message has not yet been received, then generate a five-tuple expected forwarding relationship based on the five-tuple relationship of the media stream.

[0051] S14. Receive the 200 OK message corresponding to the INVITE message and check whether a five-element expected forwarding relationship already exists.

[0052] S15. In the absence of a five-element expected forwarding relationship, a five-element expected forwarding relationship is generated based on the conversion relationship formed by the 200OK message and the three-element expected forwarding relationship.

[0053] S16. Convert the received media stream according to the five-element expectation forwarding relationship, and forward the converted media stream.

[0054] In some embodiments, a ternary expected forwarding relationship for the INVITE direction is generated based on the transformation relationship formed by the INVITE message via the SIP protocol, including:

[0055] Parse the SIP protocol INVITE message to extract the call identifier and media information, wherein the media information includes the transport protocol, a first address, and a first port;

[0056] Select the first mapping address and the first mapping port corresponding to the first address and the first port, and generate the corresponding conversion relationship;

[0057] Based on the call identifier, the transport protocol, and the conversion relationship, a ternary expected forwarding relationship for the INVITE direction is generated, wherein the ternary expected forwarding relationship includes the call identifier, the transport protocol, the first address, the first port, the first mapped address, and the first mapped port;

[0058] Based on the generated ternary expected forwarding relationship, the first address and the first port in the INVITE message are replaced with the corresponding first mapped address and the first mapped port, and the modified INVITE message is forwarded.

[0059] In this embodiment of the disclosure, the SIP protocol INVITE message is received and parsed to extract the call identifier CALL_ID and media information from SDP, such as the transport protocol, media address and media port (i.e., UDP / TCP, IP:PORT).

[0060] Select the mapping address IP_NAT and mapping port PORT_NAT of the media stream, and generate the conversion relationship from the original media information (UDP / TCP, IP:PORT) to the mapping information (UDP / TCP, IP_NAT:PORT_NAT);

[0061] Establish a three-part expected forwarding relationship for the media stream corresponding to the CALL_ID in the INVITE direction: {CALL_ID:{UDP / TCP,IP,PORT,IP_NAT,PORT_NAT}}; (that is, when the media stream flows through the network forwarding device in the reverse direction of INVITE, it will check whether its destination address and port are IP_NAT and PORT_NAT; if the destination address of the media stream is IP_NAT, the destination port is PORT_NAT, and the transport protocol can also be matched, then the destination address of the media stream will be converted to IP and the destination port will be converted to PORT).

[0062] Based on the media stream ternary expectation forwarding relationship of the call INVITE direction corresponding to CALL_ID, modify the media information of SDP in the INVITE message (i.e., convert IP:PORT to IP_NAT:PORT_NAT), and forward the modified message.

[0063] Through this ternary matching forwarding relationship, network forwarding devices can still correctly process the forwarding of media streams even when the media stream arrives 2000 kiloseconds later.

[0064] In some embodiments, receiving a media stream and matching the ternary expected forwarding relationship based on the quintuple relationship of the media stream includes:

[0065] Receive the media stream and extract the quintuple relationship of the media stream;

[0066] Based on the extracted quintuple relationship, the ternary expected forwarding relationship is matched.

[0067] In some embodiments, if a match is successful and a 200 OK message has not yet been received, a five-tuple expected forwarding relationship is generated based on the five-tuple relationship of the media stream, including:

[0068] If a match is successful and a 200 OK message has not yet been received, select the corresponding mapping address and mapping port of the second address and the second port in the five-tuple relationship of the media stream, and generate the corresponding conversion relationship;

[0069] The ternary expected forwarding relationship is updated based on the generated transformation relationship to generate a quinary expected forwarding relationship.

[0070] In this embodiment, for a case where a media stream is received before the corresponding 200 OK response to INVITE is received, and a ternary media expectation forwarding relationship is matched; the ternary media expectation forwarding relationship does not specify the translation relationship between the source address and the source port. The source address can be translated according to the signaling translation relationship, and an available port is selected as the source port. The port cannot be guaranteed to be consistent with the original port. The source address and source port translation relationship is updated in the media expectation forwarding relationship recorded in CALL_ID, and the packet is forwarded according to the media expectation forwarding relationship.

[0071] For example, a network forwarding device receives a media stream from client B. The five-tuple relationship of the media stream is TCP:11.0.0.3:20061<-11.0.0.4:20000. Based on the five-tuple relationship of the media stream, the network forwarding device matches the three-tuple media expectation forwarding relationship {CALL_ID:845761442,{PROTO:TCP,

[0072] IP: 192.168.40.3, PORT: 10061

[0073] IP_NAT:11.0.0.3,PORT_NAT:20061}}.

[0074] The network forwarding device selects the mapping information of the media stream source address and source port to obtain the corresponding conversion relationship; and generates a quinary media expectation forwarding relationship by combining the ternary expectation forwarding relationship:

[0075] {CALL_ID:845761442,{PROTO:TCP,

[0076] IP: 192.168.40.3, PORT: 10061

[0077] SRC_IP:192.168.40.4, SRC_PORT:10002,

[0078] IP_NAT:11.0.0.3,PORT_NAT:20061,

[0079] SRC_IP_NAT:11.0.0.4,SRC_PORT_NAT:20000}}.

[0080] In some embodiments, receiving a 200 OK message corresponding to the INVITE message and checking whether a five-element expected forwarding relationship already exists includes:

[0081] Receive the 200OK message corresponding to the INVITE message, and extract the call identifier and media information from the 200OK message, wherein the media information includes the transport protocol, the second address and the second port;

[0082] Based on the call identifier, check whether a five-element expected forwarding relationship already exists.

[0083] In some embodiments, after receiving the 200 OK message corresponding to the INVITE message and checking whether a five-element expected forwarding relationship already exists, the method further includes:

[0084] If a five-element expected forwarding relationship is confirmed to exist, the second address and the second port in the received 200OK message are replaced with the corresponding mapped address and mapped port according to the five-element expected forwarding relationship, and the modified 200OK message is forwarded.

[0085] In this embodiment of the disclosure, if a five-tuple expected forwarding relationship already exists before receiving the 200 OK message, it indicates that media stream forwarding has already occurred. At this time, based on the five-tuple relationship of the media stream, the currently matched three-tuple expected forwarding relationship has been updated to a five-tuple expected forwarding relationship, containing complete source address and source port information; the five-tuple expected forwarding relationship can be represented as:

[0086] {CALL_ID:{UDP / TCP,IP,PORT,SRC_IP,SRC_PORT,IP_NAT,PORT_NAT,SRC_IP_NAT,SRC_PORT_NAT}};

[0087] Upon receiving a 200 OK message, the media address and media port information of the SDP in the 200 OK message are converted according to the five-element expected forwarding relationship. Specifically, SRC_IP_NAT:SRC_PORT_NAT in the SDP is converted to SRC_IP:SRC_PORT. The modified 200 OK message is then forwarded to client A to ensure that client A can identify the correct media address and port.

[0088] In some embodiments, when a quinary expected forwarding relationship does not exist, a quinary expected forwarding relationship is generated based on the conversion relationship formed through the 200OK message and the ternary expected forwarding relationship, including:

[0089] In the absence of a five-element expected forwarding relationship, select the second mapping address and the second mapping port corresponding to the second address and the second port, and generate the corresponding conversion relationship;

[0090] Based on the call identifier, the ternary expected forwarding relationship is found;

[0091] Based on the transformation relationship and the ternary expectation forwarding relationship, a quinary expectation forwarding relationship is generated, wherein the quinary expectation forwarding relationship includes the call identifier, the transmission protocol, the first address, the first port, the second mapping address, the second mapping port, the first mapping address, the first mapping port, the second address, and the second port;

[0092] Based on the generated five-element expected forwarding relationship, the second address and the second port in the 200OK message are replaced with the corresponding second mapped address and the second mapped port, and the modified 200OK message is forwarded.

[0093] In this embodiment of the disclosure, the call identifier CALL_ID and media information in SDP, such as transport protocol, media address (SRC_IP_NAT) and media port (SRC_PORT_NAT), are extracted from the 200 OK message corresponding to the INVITE message of the SIP protocol.

[0094] Select the mapping address SRC_IP and mapping port SRC_PORT of the media stream, and generate the conversion relationship from the original media information (UDP / TCP, SRC_IP_NAT: SRC_PORT_NAT) to the mapping information (UDP / TCP, SRC_IP: SRC_PORT);

[0095] The corresponding ternary expected forwarding relationship is found by CALL_ID. A set of quinary expected forwarding relationships is formed by the conversion relationship formed by 200 OK and the media address, media port and transport protocol in the ternary expected forwarding relationship. The relationship can be represented as: {CALL_ID:{UDP / TCP,IP,PORT,SRC_IP,SRC_PORT,IP_NAT,PORT_NAT,SRC_IP_NAT,SRC_PORT_NAT}};

[0096] Based on the media address and media port determined in the generated five-element expected forwarding relationship for the converted 200OK direction, modify the media address and media port in the SDP of the 200OK message (that is, convert SRC_IP_NAT:SRC_PORT_NAT in the SDP to SRC_IP:SRC_PORT), and forward the modified message.

[0097] By matching the three-element expected forwarding relationship and generating the source address and source port translation relationship of the media stream, and modifying the media information in the 200 OK signaling according to the source address and source port translation relationship, the consistency of media information between the media stream and the signaling is ensured.

[0098] In some embodiments, the received media stream is converted according to the five-element expected forwarding relationship, and the converted media stream is forwarded, including:

[0099] Based on the aforementioned five-tuple expectation forwarding relationship, the five-tuple relationship of the received media stream is transformed;

[0100] Forward media streams that have had their quintuple relationships converted.

[0101] In this embodiment of the disclosure, the network forwarding device receives a media stream from a client. The five-tuple relationship of the media stream is, for example, TCP:11.0.0.3:20061<-11.0.0.4:20000. The device performs a conversion based on the expected forwarding relationship of the five-tuple, that is, TCP:11.0.0.3:20061<-11.0.0.4:20000 is converted to TCP:192.168.40.3:10061<-192.168.40.4:10002, and then completes the forwarding.

[0102] In this embodiment of the disclosure, the method mainly targets media streams in the SIP protocol, and can be described separately from two aspects: signaling forwarding and media stream forwarding.

[0103] 1) Handling the forwarding of media-related signaling in the SIP protocol

[0104] When processing INVITE messages, network forwarding devices extract and record relevant media addresses and port information, and establish preliminary forwarding relationships to ensure that even if the media stream arrives before the successful response message, the device can still identify and correctly process the subsequent media stream.

[0105] 2) Handling media stream forwarding in the SIP protocol

[0106] When the media stream arrives, the network forwarding device maps the address and port information of the media stream according to the established forwarding relationship, ensuring that the media stream can pass through the network forwarding device correctly, even if the 200 OK message has not yet arrived.

[0107] Figure 2 This is a schematic flowchart of a SIP protocol signaling forwarding method according to an embodiment of this disclosure.

[0108] In this embodiment of the disclosure, reference is made to Figure 2 A SIP protocol signaling forwarding method, comprising:

[0109] Receive SIP protocol INVITE messages;

[0110] Parse the SDP information in the INVITE message and generate a ternary expected forwarding relationship for the INVITE direction based on the parsing results;

[0111] Receive the 200 OK message corresponding to the INVITE message;

[0112] Parse the SDP information in the 200 OK message and match it with the media information in the corresponding INVITE message to form a 5-tuple relationship;

[0113] Based on the quintuple relationship, the corresponding INVITE and 200OK quintuple expectation forwarding relationship is issued.

[0114] Figure 3 This is a schematic flowchart of a SIP media stream forwarding method according to an embodiment of the present disclosure.

[0115] In this embodiment of the disclosure, reference is made to Figure 3 A SIP media stream forwarding method, comprising:

[0116] Receive the first data packet of the media stream and match the expected forwarding relationship;

[0117] Prioritize matching based on the expected forwarding relationship of five yuan;

[0118] If the match is successful, it means that the 200 OK message has been received (i.e., the 200 OK message was received before the media stream was received), and a five-element expectation forwarding relationship has been established based on the 200 OK message and the corresponding INVITE message. The data packet is then forwarded directly according to the five-element expectation forwarding relationship.

[0119] If the quinary expectation forwarding relationship fails to match, continue matching the ternary expectation forwarding relationship;

[0120] If the ternary expectation forwarding relationship is successfully matched, it means that the 200 OK message has not been received yet, only the INVITE message has been received, and a ternary expectation forwarding relationship has been established based on the INVITE message;

[0121] Since the ternary expected forwarding relationship does not specify the translation relationship between the source address and the source port, the source address can be translated according to the signaling translation relationship, and the source port can be selected as an available port, which cannot be guaranteed to be consistent with the original port; then the source address and port are updated to the ternary expected forwarding relationship table corresponding to CALL_ID to form a quinary expected forwarding relationship;

[0122] Forward media stream data packets according to the aforementioned five-element expectation forwarding relationship;

[0123] If the ternary expectation forwarding relationship fails to match, the packet is discarded.

[0124] By prioritizing the matching of five-element expected forwarding, we handle the situation where 200OK is forwarded before the media stream. By matching three-element expected forwarding, we handle the situation where 200OK is forwarded slower than the media stream.

[0125] Figure 4 This is a schematic diagram of the composition of an electronic device according to an embodiment of the present disclosure.

[0126] Secondly, referring to Figure 4 This disclosure provides an electronic device, which includes:

[0127] One or more processors 401;

[0128] The memory 402 stores one or more programs that, when executed by one or more processors, enable the one or more processors to implement the SIP media stream and signaling consistency forwarding method described in the first aspect of the present disclosure.

[0129] One or more I / O interfaces 403 are connected between the processor and the memory and configured to enable information exchange between the processor and the memory.

[0130] Among them, processor 401 is a device with data processing capabilities, including but not limited to central processing unit (CPU); memory 402 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); I / O interface (read-write interface) 403 is connected between processor 401 and memory 402, and can realize information interaction between processor 401 and memory 402, including but not limited to data bus (Bus).

[0131] In some embodiments, the processor 401, memory 402, and I / O interface 403 are interconnected via bus 404, and thus connected to other components of the computing device.

[0132] Thirdly, embodiments of this disclosure provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the SIP media stream and signaling consistency forwarding method described in the first aspect of this disclosure.

[0133] Fourthly, embodiments of this disclosure provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the SIP media stream and signaling consistency forwarding method described in the first aspect of this disclosure.

[0134] Figure 5 This is a block diagram of a SIP media stream and signaling consistency forwarding system according to an embodiment of the present disclosure.

[0135] Fifthly, refer to Figure 5 This disclosure provides a SIP media stream and signaling consistency forwarding system, comprising:

[0136] The ternary expectation forwarding relationship generation module 501 generates a ternary expectation forwarding relationship in the INVITE direction based on the conversion relationship formed by the INVITE message through the SIP protocol.

[0137] Matching module 502 receives the media stream and matches the ternary expected forwarding relationship according to the five-tuple relationship of the media stream;

[0138] Based on the media stream five-tuple expectation forwarding relationship generation module 503, if the match is successful and a 200 OK message has not yet been received, a five-tuple expectation forwarding relationship is generated based on the media stream five-tuple relationship.

[0139] The inspection module 504 receives the 200 OK message corresponding to the INVITE message and checks whether a five-ary expected forwarding relationship already exists.

[0140] Based on the message five-element expected forwarding relationship generation module 505, in the absence of a five-element expected forwarding relationship, a five-element expected forwarding relationship is generated based on the conversion relationship formed by the 200OK message and the three-element expected forwarding relationship;

[0141] The conversion module 506 converts the received media stream according to the five-element expected forwarding relationship and forwards the converted media stream.

[0142] In some embodiments, the ternary expectation forwarding relationship generation module 501 includes:

[0143] The first media information extraction module parses the SIP protocol INVITE message to extract the call identifier and media information, wherein the media information includes the transport protocol, the first address, and the first port;

[0144] The first selection module selects the first mapping address and the first mapping port corresponding to the first address and the first port, and generates the corresponding conversion relationship;

[0145] The first generation module generates a ternary expected forwarding relationship in the INVITE direction based on the call identifier, the transmission protocol, and the conversion relationship, wherein the ternary expected forwarding relationship includes the call identifier, the transmission protocol, the first address, the first port, the first mapped address, and the first mapped port;

[0146] The first replacement module, based on the generated ternary expected forwarding relationship, replaces the first address and the first port in the INVITE message with the corresponding first mapped address and the first mapped port, and forwards the modified INVITE message.

[0147] In some embodiments, the matching module 502 includes:

[0148] The extraction module receives the media stream and extracts the quintuple relationships of the media stream;

[0149] The quintuple relationship matching module matches the extracted quintuple relationships with the ternary expected forwarding relationships.

[0150] In some embodiments, the media stream five-element expectation forwarding relationship generation module 503 includes:

[0151] The second selection module, if a match is successful and a 200 OK message has not yet been received, selects the corresponding mapping address and mapping port of the second address and the second port in the five-tuple relationship of the media stream, and generates the corresponding conversion relationship;

[0152] The second generation module updates the ternary expected forwarding relationship based on the generated transformation relationship to generate a quinary expected forwarding relationship.

[0153] In some embodiments, the inspection module 504 includes:

[0154] The second media information extraction module receives the 200OK message corresponding to the INVITE message and extracts the call identifier and media information from the 200OK message. The media information includes the transmission protocol, the second address, and the second port.

[0155] The five-element expectation forwarding relationship checking module checks whether a five-element expectation forwarding relationship already exists based on the call identifier.

[0156] In some embodiments, the SIP media stream and signaling consistency forwarding system further includes:

[0157] The second replacement module, upon confirming the existence of a five-element expected forwarding relationship, replaces the second address and the second port in the received 200OK message with the corresponding mapped address and mapped port according to the five-element expected forwarding relationship, and forwards the modified 200OK message.

[0158] In some embodiments, the message five-element expected forwarding relationship generation module 505 includes:

[0159] The third selection module, in the absence of a five-element expected forwarding relationship, selects the second mapping address and the second mapping port corresponding to the second address and the second port, and generates the corresponding conversion relationship.

[0160] The lookup module searches for the ternary expected forwarding relationship based on the call identifier;

[0161] The third generation module generates a quinary expectation forwarding relationship based on the conversion relationship and the ternary expectation forwarding relationship, wherein the quinary expectation forwarding relationship includes the call identifier, transmission protocol, first address, first port, second mapping address, second mapping port, first mapping address, first mapping port, second address, and second port;

[0162] The third replacement module, based on the generated five-element expected forwarding relationship, replaces the second address and the second port in the 200OK message with the corresponding second mapped address and the second mapped port, and forwards the modified 200OK message.

[0163] In some embodiments, the conversion module 506 includes:

[0164] The quintuple relationship conversion module converts the quintuple relationships of the received media stream based on the quintuple expected forwarding relationship;

[0165] The forwarding module forwards media streams whose quintuple relationships have been converted.

[0166] To enable those skilled in the art to more clearly understand the technical solutions provided by the embodiments of this disclosure, the SIP media stream and signaling consistency forwarding method provided by the embodiments of this disclosure will be described in detail below through specific embodiments:

[0167] Example 1

[0168] Figure 6 A flowchart of a SIP call passing through a network forwarding device is shown.

[0169] like Figure 6 As shown, SIP client A sends an INVITE request to SIP client B to attempt to establish a call; the network forwarding device forwards response messages in sequence, including 100 Trying, 180 Ringing, and 200 OK, from SIP client B back to SIP client A via the SIP proxy server; after receiving 200 OK, SIP client A sends an ACK confirmation, and then the media stream is transmitted between the clients through the network forwarding device; when either party sends a BYE request to end the call, the network forwarding device forwards an end response (200 OK). Figure 6 It is a SIP call flowchart that shows the signaling and media stream forwarding process through network forwarding devices.

[0170] The following are important media information in the SDP of media stream negotiation related signaling:

[0171] Example 1

[0172]

[0173] According to Example 1, by analyzing the SDP information in the INVITE signaling sent by SIP client A, it can be found that the IP address of the video media stream negotiated by the requester in this call is 192.168.40.3, the media port is 10061, and the transport protocol is TCP.

[0174] Analyzing the SDP information in the 200 OK signaling corresponding to INVITE received by SIP client A, we can know that the IP address of the video media stream negotiated by the responder in this call is 192.168.40.4, the media port is 10000, and the transmission protocol is TCP.

[0175] In summary, by using the INVITE message on the SIP client A side and the SDP information in the corresponding 200 OK message, a negotiated media stream 5-tuple relationship can be determined: TCP:192.168.40.3:10061<->192.168.40.4:10000.

[0176] Example 2

[0177]

[0178] According to Example 2, analysis of the SDP information in the INVITE signaling sent by the SIP network forwarding device agent shows that the IP address of the video media stream negotiated by the requester in this call is 11.0.0.3, the media port is 20061, and the transport protocol is TCP.

[0179] Analysis of the SDP information in the 200 OK signaling corresponding to INVITE received by the SIP network forwarding device agent reveals that the IP address of the video media stream negotiated by the responder in this call is 11.0.0.4, the media port is 20000, and the transmission protocol is TCP.

[0180] In summary, by using the INVITE message on the SIP client B side and the SDP information in the corresponding 200 OK message, a negotiated media stream quintuple relationship can be determined: TCP:11.0.0.3:20061<->11.0.0.4:20000.

[0181] By analyzing the SDP media information in the INVITE and corresponding 200 OK packets on both sides of the network forwarding device, the conversion relationship of the corresponding media stream can be determined as follows:

[0182] Translation relationships: TCP:192.168.40.3:10061 <-> 192.168.40.4:10000 and TCP:11.0.0.3:20061 <-> 11.0.0.4:20000

[0183] The following conversion rules will be issued on the network forwarding device:

[0184] The network forwarding device receives a media stream from SIP client A on the SIP client side, specifically the stream information as TCP:192.168.40.3:10061->192.168.40.4:10000. Then, the network forwarding device sends this media stream from the other side, in the format TCP:11.0.0.3:20061->11.0.0.4:20000, to SIP client B.

[0185] The network forwarding device receives a media stream from SIP client B on the SIP client B side. The specific stream information is TCP: 11.0.0.4:20000->11.0.0.3:20061. Then, the network forwarding device sends this media stream from the other side, in the format TCP: 192.168.40.4:10000->192.168.40.3:10061, to SIP client A.

[0186] Complete the forwarding of the corresponding media stream in SIP.

[0187] According to Figure 6 The deployment shown, along with the SDP media information in Examples 1 and 2, and the specific implementation steps of the forwarding method are as follows:

[0188] (1) The specific steps for forwarding media-related signaling in the SIP protocol are as follows:

[0189] i. Receive and parse INVITE messages to construct a ternary expected forwarding relationship: The network forwarding device receives and parses the SIP protocol INVITE message, and establishes a ternary expected forwarding relationship for the media stream in the direction of the call INVITE corresponding to the CALL_ID based on the extracted CALL_ID and media information.

[0190] For example, a network forwarding device receives an INVITE message from client A, extracts the video media stream information with CALL_ID 845761442, whose IP address is 192.168.40.3, port is 10061, and the mapped address is 11.0.0.3, port is 20061; it generates a ternary expected forwarding relationship based on the extracted media information and records it in JSON format, for example, {CALL_ID:845761442,{PROTO:TCP,IP:192.168.40.3,PORT:10061,IP_NAT:11.0.0.3,PORT_NAT:20061}}.

[0191] Modify the media address and port in SDP: Using the generated ternary expected forwarding relationship, modify the IP in the SDP information of the INVITE message, changing IP:192.168.40.3 and PORT:10061 to 11.0.0.3 and 20061 respectively, and forward the modified message.

[0192] ii. After receiving and parsing the SIP protocol INVITE 200 OK message, the network forwarding device extracts the CALL_ID and media information. Then, it queries the corresponding media forwarding relationship using the CALL_ID:

[0193] If a forwarding relationship between the source address and source port already exists, it indicates that media stream forwarding has been processed.

[0194] If no forwarding relationship for source address and source port is generated, it means that media stream forwarding has not been processed. In this case, the corresponding forwarding relationship for source address and source port is generated for the 200 OK message, and the media forwarding relationship table is updated.

[0195] For example, if the media expected forwarding relationship {CALL_ID:845761442,{PROTO:TCP,IP:192.168.40.3,PORT:10061,IP_NAT:11.0.0.3,PORT_NAT:20061}} found in the 200 OK message's CALL_ID does not have a source address and source port forwarding relationship, then a corresponding source address and source port forwarding relationship will be generated for the 200 OK message and updated in the media expected forwarding relationship table. Otherwise, it means the media stream has already been forwarded.

[0196] iii. Handling media streams that have already been forwarded.

[0197] When a media stream is matched with the ternary expected forwarding relationship, the source address (SRC_IP) and source port (SRC_PORT) have been selected, and the source address and source port of the ternary expected forwarding relationship are updated to form a quinary media expected forwarding relationship;

[0198] For example, based on the CALL_ID (e.g., 845761442) in the 200 OK message, the media mapping relationship of the call can be found as {CALL_ID:845761442,{PROTO:TCP,

[0199] IP: 192.168.40.3, PORT: 10061

[0200] SRC_IP:192.168.40.4, SRC_PORT:10002,

[0201] IP_NAT:11.0.0.3,PORT_NAT:20061,

[0202] SRC_IP_NAT:11.0.0.4,SRC_PORT_NAT:20000}},

[0203] Based on the aforementioned relationship, it can be seen that the media IP in the SDP of 200OK is 11.0.0.4, the media port is 20000, and the corresponding translated media address is 192.168.40.4, the media port is 10002.

[0204] Modify the relevant information in SDP in 200OK, changing c=IN IP4 11.0.0.4 and m=video 20000TCP / RTP / AVP 96 to c=IN IP4 192.168.40.4 and m=video 10002TCP / RTP / AVP 96.

[0205] After updating the message length, the message is forwarded to client A.

[0206] iv. Handling situations where media streams have not been forwarded.

[0207] Extract the CALL_ID from the 200 OK message corresponding to INVITE in the SIP protocol, and extract the media information from SDP, including the media address (SRC_IP_NAT) and the media port (SRC_PORT_NAT);

[0208] Select the mapping address (SRC_IP) and mapping port (SRC_PORT) of the media stream, and generate the mapping information (UDP / TCP, SRC_IP_NAT:SRC_PORT_NAT) corresponding to the media information (UDP / TCP, SRC_IP:SRC_PORT);

[0209] Modify and forward messages according to expected media forwarding relationships;

[0210] For example, based on CALL_ID:845761442 in 200OK, existing forwarding relationships are searched; for example, the existing media mapping relationship of the call is found as follows: {CALL_ID:845761442,{PROTO:TCP,

[0211] IP: 192.168.40.3, PORT: 10061

[0212] IP_NAT:11.0.0.3,PORT_NAT:20061}}.

[0213] Among the expected forwarding relationships found, there is no source address / source port forwarding relationship. Therefore, a new media expected forwarding relationship needs to be established as follows:

[0214] Extract the original media information from the SDP portion of 200OK, including the media address SRC_IP_NAT as 11.0.0.4 and the media port SRC_PORT_NAT as 20000;

[0215] Select the mapping address (SRC_IP) and mapping port (SRC_PORT) for the media stream in 200OK. SRC_IP is 192.168.40.4 and SRC_PORT is 10004.

[0216] Based on the existing ternary expectation forwarding relationship, the new media expectation forwarding relationship is updated and generated as follows: {CALL_ID:845761442,{PROTO:TCP,

[0217] IP: 192.168.40.3, PORT: 10061

[0218] SRC_IP:192.168.40.4, SRC_PORT:10004,

[0219] IP_NAT:11.0.0.3,PORT_NAT:20061,

[0220] SRC_IP_NAT:11.0.0.4,SRC_PORT_NAT:20000}};

[0221] According to the relationship table, the media IP in SDP of 200OK is 11.0.0.4, the media port is 20000, and the corresponding translated media address is 192.168.40.4, the media port is 10004;

[0222] Based on expected media forwarding relationships, the media information in the SDP of the 200OK message will be...

[0223] c = IN IP4 11.0.0.4

[0224] m = video 20000 TCP / RTP / AVP 96

[0225] Modified to

[0226] c = IN IP4 192.168.40.4

[0227] m = video 10004 TCP / RTP / AVP 96

[0228] Recalculate the length of the modified 200 OK message and then capture and send it to client A.

[0229] (2) The specific steps for forwarding media streams are as follows:

[0230] i. Receive the first packet of the media stream and match it with the corresponding media expected to forward it;

[0231] ii. Based on the matched media expectation forwarding relationship, determine whether the matched policy is a five-tuple policy (which specifies the network layer protocol (UDP / TCP), destination address, destination port, source address, and source port) or a three-tuple policy (which specifies the network layer protocol (UDP / TCP), destination address, and destination port).

[0232] iii. If a five-tuple strategy is matched, then the 200 OK response corresponding to the INVITE must be received first, followed by the media stream; in this case, forwarding is directly performed according to the five-tuple media expectation forwarding relationship. For example, if the media stream is sent from client B to the network forwarding device, and the five-tuple relationship is TCP:11.0.0.3:20061<-11.0.0.4:20000, the expected forwarding relationship matched according to this five-tuple relationship is: {CALL_ID:845761442,{PROTO:TCP,

[0233] IP: 192.168.40.3, PORT: 10061

[0234] SRC_IP:192.168.40.4,SRC_PORT:10004,

[0235] IP_NAT:11.0.0.3,PORT_NAT:20061,

[0236] SRC_IP_NAT:11.0.0.4,SRC_PORT_NAT:20000}},

[0237] Then the media stream can be converted according to the relationship described above, that is, TCP:11.0.0.3:20061<-11.0.0.4:20000 can be converted to TCP:192.168.40.3:10061<-192.168.40.4:10004, thus completing the media stream forwarding.

[0238] iv. If a ternary media expectation forwarding relationship is matched, it means the media stream was received before the corresponding 200 OK response to the INVITE was received. The ternary media expectation forwarding relationship does not specify the source address and source port translation. The source address can be translated according to the signaling translation relationship, and an available port is selected as the source port. The selected port cannot be guaranteed to be identical to the original port. Update the source address and source port translation relationship in the media expectation forwarding relationship recorded in the CALL_ID. Forward the packet according to the media expectation forwarding relationship.

[0239] For example, a network forwarding device receives a media stream from client B. The five-tuple relationship of the media stream is TCP:11.0.0.3:20061<-11.0.0.4:20000. According to the five-tuple relationship of the media stream, the network forwarding device can only match the 3-tuple media expectation forwarding relationship {CALL_ID:845761442,{PROTO:TCP,

[0240] IP: 192.168.40.3, PORT: 10061

[0241] IP_NAT:11.0.0.3,PORT_NAT:20061}}.

[0242] The network forwarding device selects the media stream source address and source port forwarding information to generate a five-element media expected forwarding relationship:

[0243] {CALL_ID:845761442,{PROTO:TCP,

[0244] IP: 192.168.40.3, PORT: 10061

[0245] SRC_IP:192.168.40.4, SRC_PORT:10002,

[0246] IP_NAT:11.0.0.3,PORT_NAT:20061,

[0247] SRC_IP_NAT:11.0.0.4,SRC_PORT_NAT:20000}},

[0248] Then the media stream can be converted according to the aforementioned five-element media expectation forwarding relationship, that is, TCP:11.0.0.3:20061<-11.0.0.4:20000 can be converted to TCP:192.168.40.3:10061<-192.168.40.4:10002, thus completing the media stream forwarding.

[0249] The key technical point of this disclosure lies in ensuring the consistency verification of SIP protocol media streams and signaling information, maintaining consistency even when the arrival order of 200OK response signaling and media streams is uncertain. When the INVITE signaling arrives, a ternary expected forwarding relationship is first established, and the NAT mapping of the destination address and port is recorded in the network forwarding device. If the media stream data packet arrives before the 200OK, the device generates a quintuple expected forwarding relationship using the actual quintuple information of the media stream to start forwarding the data stream in advance. After the quintuple forwarding relationship is formed, the SDP media information in the 200OK message is updated through the address and port mapping relationship to ensure that the address and port information of the signaling and media stream are consistent. Regardless of the arrival order of the 200OK signaling and media stream, the network forwarding device can process traffic according to the ternary or quintuple relationship, ensuring that the signaling and media stream information at the receiving end are consistent, achieving a stable media stream forwarding effect.

[0250] The SIP media stream and signaling consistency forwarding method disclosed herein can bring the following beneficial effects:

[0251] This invention implements consistency verification between media streams and signaling in the SIP protocol: even if the media stream arrives before the 200 OK message and the port has been converted in the network forwarding device, the receiving end can still pass the consistency verification, ensuring the consistency between the media stream and signaling. Compared to existing solutions that only change the address, this invention effectively avoids port conflicts by modifying the port. This solution addresses the problem that when the media stream arrives at the network forwarding device before the 200 OK message, the five-element forwarding relationship of the media stream cannot be confirmed in advance via INVITE and 200 OK signaling, which may cause inconsistencies between signaling and media. Through this solution, the network forwarding device ensures successful consistency verification of the media stream and signaling at the SIP protocol media receiving end.

[0252] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0253] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.

Claims

1. A method for forwarding SIP media streams and signaling in a consistent manner, comprising: Based on the conversion relationship formed by the INVITE message through the SIP protocol, a ternary expected forwarding relationship is generated for the INVITE direction; Receive media streams and match the ternary expected forwarding relationships based on the quintuple relationships of the media streams; If a match is successful and a 200 OK message has not yet been received, a five-tuple expected forwarding relationship is generated based on the five-tuple relationship of the media stream; Receive the 200 OK message corresponding to the INVITE message and check whether a five-element expected forwarding relationship already exists; In the absence of a quinary expected forwarding relationship, a quinary expected forwarding relationship is generated based on the conversion relationship formed through the 200OK message and the ternary expected forwarding relationship. The received media stream is converted according to the five-element expectation forwarding relationship, and the converted media stream is forwarded.

2. The SIP media stream and signaling consistency forwarding method according to claim 1, wherein, Based on the translation relationship formed by the INVITE message via the SIP protocol, a ternary expected forwarding relationship is generated for the INVITE direction, including: Parse the SIP protocol INVITE message to extract the call identifier and media information, wherein the media information includes the transport protocol, a first address, and a first port; Select the first mapping address and the first mapping port corresponding to the first address and the first port, and generate the corresponding conversion relationship; Based on the call identifier, the transport protocol, and the conversion relationship, a ternary expected forwarding relationship for the INVITE direction is generated, wherein the ternary expected forwarding relationship includes the call identifier, the transport protocol, the first address, the first port, the first mapped address, and the first mapped port; Based on the generated ternary expected forwarding relationship, the first address and the first port in the INVITE message are replaced with the corresponding first mapped address and the first mapped port, and the modified INVITE message is forwarded.

3. The SIP media stream and signaling consistency forwarding method according to claim 2, wherein, Receiving a media stream and matching the ternary expected forwarding relationship based on the 5-tuple relationship of the media stream includes: Receive the media stream and extract the quintuple relationship of the media stream; Based on the extracted quintuple relationship, the ternary expected forwarding relationship is matched.

4. The SIP media stream and signaling consistency forwarding method according to claim 3, wherein, If a match is successful and a 200 OK message has not yet been received, a five-tuple expected forwarding relationship is generated based on the five-tuple relationship of the media stream, including: If a match is successful and a 200 OK message has not yet been received, select the corresponding mapping address and mapping port of the second address and the second port in the five-tuple relationship of the media stream, and generate the corresponding conversion relationship; The ternary expected forwarding relationship is updated based on the generated transformation relationship to generate a quinary expected forwarding relationship.

5. The SIP media stream and signaling consistency forwarding method according to claim 4, wherein, Upon receiving the 200 OK message corresponding to the INVITE message, check whether a five-ary expected forwarding relationship already exists, including: Receive the 200OK message corresponding to the INVITE message, and extract the call identifier and media information from the 200OK message, wherein the media information includes the transport protocol, the second address and the second port; Based on the call identifier, check whether a five-element expected forwarding relationship already exists.

6. The SIP media stream and signaling consistency forwarding method according to claim 5, wherein, After receiving the 200 OK message corresponding to the INVITE message and checking whether a five-ary expected forwarding relationship already exists, the process also includes: If a five-element expected forwarding relationship is confirmed to exist, the second address and the second port in the received 200OK message are replaced with the corresponding mapped address and mapped port according to the five-element expected forwarding relationship, and the modified 200OK message is forwarded.

7. The SIP media stream and signaling consistency forwarding method according to claim 6, wherein, In the absence of a quinary expected forwarding relationship, a quinary expected forwarding relationship is generated based on the conversion relationship formed through the 200 OK message and the ternary expected forwarding relationship, including: In the absence of a five-element expected forwarding relationship, select the second mapping address and the second mapping port corresponding to the second address and the second port, and generate the corresponding conversion relationship; Based on the call identifier, the ternary expected forwarding relationship is found; Based on the transformation relationship and the ternary expectation forwarding relationship, a quinary expectation forwarding relationship is generated, wherein the quinary expectation forwarding relationship includes the call identifier, the transmission protocol, the first address, the first port, the second mapping address, the second mapping port, the first mapping address, the first mapping port, the second address, and the second port; Based on the generated five-element expected forwarding relationship, the second address and the second port in the 200OK message are replaced with the corresponding second mapped address and the second mapped port, and the modified 200OK message is forwarded.

8. The SIP media stream and signaling consistency forwarding method according to any one of claims 1-7, wherein, The received media stream is converted according to the aforementioned five-element expectation forwarding relationship, and the converted media stream is forwarded, including: Based on the aforementioned five-tuple expectation forwarding relationship, the five-tuple relationship of the received media stream is transformed; Forward media streams that have had their quintuple relationships converted.

9. An electronic device, comprising: One or more processors; A memory having stored one or more programs that, when executed by one or more processors, cause the one or more processors to implement the SIP media stream and signaling consistency forwarding method according to any one of claims 1 to 8.

10. A computer-readable medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the SIP media stream and signaling consistency forwarding method according to any one of claims 1 to 8.

11. A computer program product comprising a computer program or instructions that, when executed by a processor, implement the SIP media stream and signaling consistency forwarding method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • RTP (Real-time Transport Protocol) media stream crossing method, SIP (Session Initiation Protocol) server and SIP communication system

    CN106131084A

  • Communication method and device based on SIP media negotiation and NAT equipment

    CN111885219A