Data processing method, device, electronic device and storage medium
By matching and modifying SIP signaling data with pre-configured rule files, the problem of low compatibility of signaling data for network equipment processing different manufacturers is solved, and efficient and accurate signaling data processing is achieved.
Patent Information
- Application Number
- CN202211146336.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-20
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-09-20
AI Technical Summary
In the prior art, the processing program compatibility of network devices is not high, resulting in errors prone to processing SIP signaling packets from different manufacturers.
By matching the pre-configured rule files, the fields to be modified and their modification rules in the SIP signaling data are determined to realize the processing of SIP signaling data in any format.
It improves the processing compatibility of network equipment for SIP signaling data of different manufacturers, reduces the possibility of errors, and improves processing efficiency.
Smart Images

Figure CN115550325B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of IT networks, more and more services are carried on IT networks to improve their efficiency, including remote video monitoring and real-time voice intercom services. However, these services generally rely on SIP (Session Initiation Protocol) to establish video and voice transmission channels. Due to the increasing demand for services, many video manufacturers have emerged, and these manufacturers have formulated SIP protocol signaling data based on their respective equipment function differences, which places higher requirements on protocol processing.
[0003] The forwarding of SIP signaling data from different networks involves NAT (Network Address Translation) traversal, which inevitably requires necessary processing of SIP signaling data, which involves packet modification of SIP signaling data (modifying the IP and port related parts of SIP signaling data). However, although the packet formats of SIP signaling data sent by audio and video systems of various manufacturers now follow the SIP protocol, the content formats are not exactly the same, which makes it increasingly difficult for NAT devices to process SIP signaling data. At present, the processing procedures of NAT devices for processing SIP signaling data from various manufacturers are not highly compatible, and the processing is not comprehensive enough, which makes it easy to make mistakes when processing SIP signaling data packets from different manufacturers. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a data processing method, device, electronic device and storage medium to improve the problem that the processing program compatibility of network devices in the prior art is not high, which leads to easy errors when processing SIP signaling data packets from different manufacturers.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0006] Receive current Session Initiation Protocol SIP signaling data;
[0007] Matching the current SIP signaling data with a pre-configured rule file to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, wherein the rule file includes a plurality of matching key fields and a modification rule field of the field to be modified, the plurality of matching key fields are used to indicate the position of the field to be modified in the SIP signaling data, and the modification rule field is used to indicate the modification rule of the field to be modified in the SIP signaling data;
[0008] According to the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, the corresponding field in the current SIP signaling data is modified.
[0009] In the above implementation process, the present application pre-configures a rule file. Since a plurality of matching key fields and modification rule fields are pre-set in the rule file, the rule file can match SIP signaling data in any format. For SIP signaling data of any manufacturer, the fields that need to be modified can be determined through the rule file, thereby processing SIP signaling data of any manufacturer with high compatibility and low error rate.
[0010] Optionally, before receiving the current Session Initiation Protocol SIP signaling data, the method further includes:
[0011] Parsing a pre-configured rule file to obtain a plurality of fields in the rule file, wherein the plurality of fields include a plurality of matching key fields and a modification rule field;
[0012] storing the rule file in a memory in the form of the multiple fields;
[0013] The matching of the current SIP signaling data with a pre-configured rule file to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field includes:
[0014] The current SIP signaling data is matched with a plurality of fields stored in the memory to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0015] In the above implementation process, by parsing the rule file into multiple fields and storing them in memory, when matching, the fields are directly read from the memory for matching, so that fast data matching can be achieved and the processing efficiency of SIP signaling data is improved.
[0016] Optionally, storing the rule file in the form of the multiple fields in the memory includes:
[0017] Storing multiple fields of the rule file into a global variable structure array in memory;
[0018] The matching of the current SIP signaling data with the multiple fields stored in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field includes:
[0019] The current SIP signaling data is matched with each array member of the global variable structure array in the memory to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0020] In the above implementation process, by storing multiple fields of the rule file in the global variable structure array, each member value of the array can be matched with the SIP signaling data without omission during matching, which is more accurate and efficient.
[0021] Optionally, storing the rule file in the form of the multiple fields in the memory includes:
[0022] Storing multiple fields of the rule file into each node of the linked list in the memory;
[0023] The matching of the current SIP signaling data with the multiple fields stored in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field includes:
[0024] The current SIP signaling data is matched with each node of the linked list in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0025] In the above implementation process, by storing multiple fields of the rule file in the linked list structure, each node value of the linked list can be matched with the SIP signaling data without omission during matching, which is more accurate and efficient.
[0026] Optionally, the method further comprises:
[0027] When it is necessary to update the matching key field and / or modify the rule field, the rule file is updated and then configured. This makes it easy to modify the rule file, the configuration is simple, and it is easy to be compatible with the processing of SIP signaling data of newly added manufacturers.
[0028] Optionally, the rule file further includes a sub-connection field, and the sub-connection field is used to indicate whether a corresponding sub-connection needs to be established. This makes it easy to know whether a corresponding sub-connection needs to be established directly through the matching rule file, which is more efficient for establishing a sub-connection.
[0029] Optionally, the rule file includes rule files corresponding to various manufacturers, and the matching of the current SIP signaling data with the pre-configured rule file to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field includes:
[0030] Obtain the target manufacturer corresponding to the current SIP signaling data;
[0031] The current SIP signaling data is matched with the pre-configured rule file of the target manufacturer to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0032] In the above implementation process, the rule files are differentiated according to the manufacturers, so that targeted matching can be performed, the matching efficiency is improved, and the processing efficiency of the SIP signaling data is further improved.
[0033] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0034] A data receiving module, used for receiving current session initiation protocol SIP signaling data;
[0035] A data matching module, used to match the current SIP signaling data with a pre-configured rule file, and obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, wherein the rule file includes a plurality of matching key fields and a modification rule field of the field to be modified, the plurality of matching key fields are used to indicate the position of the field to be modified in the SIP signaling data, and the modification rule field is used to indicate the modification rule of the field to be modified in the SIP signaling data;
[0036] The field modification module is used to modify the corresponding field in the current SIP signaling data according to the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0037] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are performed.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method provided in the first aspect are performed.
[0039] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;
[0042] Figure 2 A flowchart of matching SIP signaling data through an array provided in an embodiment of the present application;
[0043] Figure 3 A structural block diagram of a data processing device provided in an embodiment of the present application;
[0044] Figure 4 A schematic diagram of the structure of an electronic device for executing a data processing method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present application.
[0046] It should be noted that the terms "system" and "network" in the embodiments of the present invention can be used interchangeably. "Multiple" means two or more. In view of this, in the embodiments of the present invention, "multiple" can also be understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the previously associated objects are in an "or" relationship.
[0047] The embodiment of the present application provides a data processing method, which matches the received current SIP signaling data with a pre-configured rule file, obtains the location of the field to be modified in the current SIP signaling data and the corresponding modification rule, and then can realize the modification of the relevant field in the current SIP signaling data. Since the rule file is pre-configured in the present application, the rule file can realize the matching of SIP signaling data in any format, so for any manufacturer's SIP signaling data, the field to be modified can be determined through the rule file, so that any SIP signaling data can be processed, with high compatibility and low error. In addition, the solution of the present application does not need to write corresponding matching programs for SIP signaling data of different manufacturers, and the implementation efficiency of the solution is higher and the cost is lower.
[0048] Please refer to Figure 1 , Figure 1 A flowchart of a data processing method provided in an embodiment of the present application, the method comprising the following steps:
[0049] Step S110: Receive current SIP signaling data.
[0050] The executor of the data processing method in the present application may be a network device, such as a NAT device or other network intermediate device. When the SIP signaling data passes through the NAT device, the NAT device needs to process the SIP signaling data before sending it out, such as modifying the contents of the IP and port fields in the SIP signaling data, such as modifying the IP to the destination IP, modifying the port to the destination port, etc.
[0051] When two users need to create, modify or terminate a video or voice conference, the two parties can initiate a video or voice transmission channel through the SIP protocol. For example, one party can send SIP signaling data to the other party. At this time, the SIP signaling data received by the NAT device can be called the current SIP signaling data, that is, the current SIP signaling data refers to the data sent to the network device by the two parties when making a video or voice call.
[0052] Step S120: Match the current SIP signaling data with the pre-configured rule file to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0053] The rule file includes multiple matching key fields and modification rule fields for fields to be modified. The multiple matching key fields are used to indicate the locations of fields to be modified in SIP signaling data, and the modification rule fields are used to indicate modification rules for fields to be modified in SIP signaling data.
[0054] When matching the current SIP signaling data with the rule file, each field of the current SIP signaling data may be matched with each matching key field in the rule file. If there is a field that matches the matching key field, the field is determined to be a field to be modified in the current SIP signaling data, and then the corresponding modification rule field is searched from the rule file, that is, the modification rule of the field to be modified is searched.
[0055] Each matching key field and modification rule field in the rule file can be determined by R&D personnel after analyzing the SIP signaling data of each manufacturer. Since the location and format of IP and port in the SIP signaling data of each manufacturer are slightly different, or the keywords identifying IP and port are different, after analyzing the SIP signaling data of each manufacturer, the R&D personnel can obtain the key fields identifying the fields to be modified (IP or port) in the SIP signaling data of each manufacturer and the corresponding modification rules. In this way, these statistics can be compiled into a rule file. In this way, the matching key fields in the rule file can match the fields to be modified in various forms of SIP signaling data, and the compatibility is stronger.
[0056] Step S130: modify the corresponding field in the current SIP signaling data according to the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0057] Therefore, by matching the current SIP signaling data with each matching key field in the rule file, the position of the field to be modified in the current SIP signaling data can be located, and the modification rule field in the rule file can be used to determine the modification rule of the field to be modified. After determining the position and the modification rule, the field at the position can be modified according to the corresponding modification rule to complete the processing of the SIP signaling data. The modified current SIP signaling data will be forwarded to the receiving end through the network device.
[0058] In the above implementation process, since multiple matching key fields and modification rule fields are pre-set in the rule file, the rule file can match SIP signaling data in any format. For SIP signaling data from any manufacturer, the fields that need to be modified can be determined through the rule file, so that the processing of SIP signaling data from any manufacturer can be realized, with high compatibility and low error rate.
[0059] Based on the above embodiments, R&D personnel can modify the rule file in real time according to needs. For example, when it is necessary to update the matching key field and / or modify the rule field, the rule file can be updated and then configured in the network device.
[0060] In this scenario, the network device can provide proxy forwarding services for multiple manufacturers' video platforms at the same time. When there are differences in the fields that need to be modified in the SIP signaling data between different manufacturers, the R&D personnel can obtain the newly added or modified matching key fields and / or modification rule fields through analysis, and then add relevant fields to the rule file, or modify the existing fields in the rule file, etc. In this way, the network device can identify the location of the fields that need to be modified and the modification rules of the corresponding fields when processing the SIP signaling data subsequently, and the processing of the SIP signaling data of the video platforms of each manufacturer will not affect each other, so as to truly achieve difference compatibility.
[0061] On the basis of the above embodiment, in order to quickly match the current SIP signaling data with the rule file, after the rule file is configured in the network device, the configured rule file can be parsed first to obtain multiple fields in the rule file, which include multiple matching key fields and modification rule fields, and then the rule file is stored in the memory in the form of multiple fields. In this way, when matching, the current SIP signaling data can be matched with the multiple fields stored in the memory to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0062] For example, a rules file might look like this:
[0063]
[0064]
[0065] The rule file shown above contains 3 examples of packet modification rules. Taking the first rule as an example, the meaning of writing packet modification rules is explained: "From:, f:, sip:, IP, SsrcIP": "From: / f:" means that the field that needs to be modified is matched with the key field (i.e., the key field is matched) From: or the behavior starting with f:; "sip:" means that on the basis of determining the row where the field to be modified is located, the content after matching the key field "sip:" is the field to be modified; "IP" means that the field content to be modified is the IP address; "SsrcIP" means that the IP address to be modified needs to be modified to the five-tuple source IP after NAT.
[0066] To ensure accurate matching, developers can write rule files in a certain format, such as the standard format for writing rule files: lname, sname, ln_str, type, value, and Expect.
[0067] Among them, lname: indicates the matching key field for determining the row where the field to be modified is located;
[0068] sname: indicates that the relationship between the matching key field and lname of the row where the field to be modified is OR, that is, if the previous one is matched, it is determined that the row has content to be modified;
[0069] ln_str: indicates the matching key field for further determining the position of the modified field based on the row where the field to be modified is located;
[0070] type: indicates that the field content to be modified is IP, port, or a combination of IP and port;
[0071] value: indicates the field value to be modified. The options are the following values or a combination of the following values, such as SdstIP:Sdstport, SsrcIP:Ssrcport, etc.
[0072] SdstIP: indicates the modification rule field for automatically changing to the five-tuple destination IP after connecting to NAT;
[0073] SsrcIP: indicates the modification rule field for automatically changing to the five-tuple source IP after connecting to NAT;
[0074] Ssrcport: indicates the modification rule field for automatically changing to the five-tuple source port after connecting to NAT;
[0075] Sdstport: indicates the modification rule field for automatically changing to the five-tuple destination port after connecting to NAT;
[0076] Esrcport: indicates the modification rule field that automatically changes to the expected source port after NAT;
[0077] Edstport: indicates the modification rule field that automatically changes to the destination port expected after NAT;
[0078] XXXX: indicates the modification rule field to the specified IP.
[0079] Therefore, the rule file can be parsed to obtain each field in the rule file, and then each field can be stored in the memory. In this way, when matching, the field can be directly read from the memory for matching, which can achieve fast data matching and improve the processing efficiency of SIP signaling data.
[0080] In order to facilitate the network device to directly identify from the SIP signaling data whether the current SIP signaling data is used to establish a corresponding sub-connection, the rule file may also include a sub-connection field, which is used to indicate whether a corresponding sub-connection needs to be established. In this way, it is convenient to directly know whether a corresponding sub-connection needs to be established by matching the rule file, which is more efficient for establishing a sub-connection.
[0081] For example, Expect is used to indicate whether a sub-connection needs to be established according to this field. Optional sub-connection fields include SIP (used to indicate the establishment of a SIP signaling sub-connection), RTP (used to indicate the establishment of an audio and video RTP sub-connection), and none (used to indicate not to establish a sub-connection).
[0082] The writing rules of the rule file in this application can be defined as follows: the writing of the rule file is mainly written in curly braces, where each line represents a rule, and each field is separated by a comma. The first and second fields can be only one of them according to the form in the signaling, and the missing field is replaced by a single space. The third and fourth field ends are required fields, and the fifth field is a required field, which is used to identify in the processing program which five-tuple contents after NAT need to be modified.
[0083] When actually configuring the rule file, R&D personnel can capture the SIP signaling data of various manufacturers, confirm the fields of IP and port that need to be modified in the SIP signaling data, and then write these fields into the rule file according to the above writing rules. The order of the fields is not required to be consistent with the signaling, but the expression of the fields (uppercase and lowercase letters) must strictly follow the writing in the SIP signaling data. Then save the rule file and import it into the designated directory corresponding to the network device.
[0084] On the basis of the above embodiment, in order to achieve fast matching when matching the current SIP signaling data with the rule file, multiple fields of the rule file obtained by parsing can be stored in the global variable structure array in the memory, and then when matching, the current SIP signaling data is matched with each array member of the global variable structure array in the memory, so as to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0085] Here, the global variable structure array is defined as sip_field, and the array members in the array are defined as follows:
[0086] struct sip_field{
[0087] char lname
[16] ; / / row name in SIP signaling data, corresponding to the first field in the rule file;
[0088] int ln_len; / / Used together with lname to match the row field, its value is calculated by the length of lname;
[0089] char sname[8]; / / The abbreviation of the corresponding row name, corresponding to the second field in the rule file;
[0090] int sn_name; / / Used together with sname to match the row field, its value is calculated by the length of sname;
[0091] char ln_str[8]; / / In the matched line, match the identifier before the field content (IP&port) to be modified, corresponding to the third field in the rule file;
[0092] int type; / / The type of the changed field content, corresponding to the fourth field in the rule file; 1: IP; 2: PORT; 3: IP&PORT;
[0093] char value
[24] ; / / modified field content after NAT;
[0094] int expect; / / corresponds to the Expect field in the rule file; 0: none, 1: SIP, 2: RTP
[0095] }
[0096] According to the above rule file example, multiple fields obtained after parsing the rule file are stored in the array, and the values in the array should be:
[0097] sip_field[0]={lname="From:"; ln_len=[sizeof("From:")-1]; sname="f:"; sn_len=[sizeof("f:")-1], type=1, value="SsrcIP", expect=0}
[0098] sip_field[1]={lname="To:"; ln_len=[sizeof("To:")-1]; sname="t:"; sn_len=[sizeof("t:")-1], type=2, value="SdstIP", expect=0}
[0099] sip_field[2]={lname="Via:"; ln_len=[sizeof("Via:")-1]; sname="v:"; sn_len=[sizeof("v:")-1], type=3, value="SsrcIP:Ssrcport", expect=0}
[0100] Therefore, each line of rules in the rule file can be parsed first, and the multiple fields obtained by parsing can be filled into the constructed panoramic variable structure array according to the set rules. Each line of rules is parsed into an array member. In this way, when processing SIP signaling data, the values of each array member in the global variable structure array can be quickly obtained from the memory, and then matched with the SIP signaling data, and the relevant fields in the SIP signaling data are modified according to the matched values until all array members in the global variable structure array are matched.
[0101] like Figure 2 As shown, after the current SIP signaling data (i.e., data packet) enters the network device, it is processed by the protocol stack. First, field matching is performed according to the member values of the global variable structure array, and whether to place an expectation is determined by the expect value. If not, the relevant fields in the current SIP signaling data are modified directly according to the member values in the array. If yes, the sub-connection expectation is first issued, and then the relevant fields in the current SIP signaling data are modified according to the member values in the array, until all member values in the array are matched, and the fields to be modified in the current SIP signaling data are modified, the current SIP signaling data is sent out.
[0102] In the above implementation process, by storing multiple fields of the rule file in the global variable structure array, each member value of the array can be matched with the SIP signaling data without omission during matching, which is more accurate and efficient.
[0103] In other implementations, the method of storing multiple fields of the rule file in the memory may also be to store them in the form of a linked list, such as storing multiple fields of the rule file in each node of the linked list in the memory. When matching the current SIP signaling data with the rule file, the current SIP signaling data may be matched with each node of the linked list in the memory, thereby obtaining the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0104] Here, each line of rules in the rule file can be parsed to obtain the fields recorded in each line of rules, and then the fields can be stored in a node of the linked list. In this way, when processing SIP signaling data, the values of each node in the linked list can be quickly obtained from the memory, and then matched with the SIP signaling data, and the relevant fields in the SIP signaling data can be modified according to the matched values until all nodes in the linked list are matched.
[0105] The advantage of using a linked list to store multiple fields is that the linked list does not require a continuous area in the memory. It only requires that each node can record the memory address of the next node, and can be quickly searched by reference. This makes the addition and deletion operations of the linked list very time-consuming, making it easier to modify the rule file.
[0106] In the above implementation process, by storing multiple fields of the rule file in the linked list structure, each node value of the linked list can be matched with the SIP signaling data without omission during matching, which is more accurate and efficient.
[0107] On the basis of the above embodiment, in order to quickly match the current SIP signaling data with the rule file, since the rule file is written by parsing the SIP signaling data of each manufacturer, a rule file can be written for each manufacturer, that is, the rule file includes the rule files corresponding to each manufacturer. In this way, when matching the current SIP signaling data with the rule file, the target manufacturer corresponding to the current SIP signaling data can be obtained first, and then the current SIP signaling data can be matched with the pre-configured rule file of the target manufacturer, so as to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0108] Here, when the sender sends SIP signaling data, it can add the identifier of the target manufacturer to which it belongs in the current SIP signaling data. The identifier of the target manufacturer can be manually added by the user of the sender, or the sender can determine the identifier of the target manufacturer based on the relevant information of the video platform. In this way, after the network device obtains the current SIP signaling data, it can obtain the identifier of the target manufacturer by parsing the current SIP signaling data.
[0109] When R&D personnel write rule files, they can write a rule file for each manufacturer for storage, and can store the manufacturer's identifier and rule file in correspondence. In this way, the rule file corresponding to the target manufacturer can be found by obtaining the identifier of the target manufacturer to which the current SIP signaling data belongs. In this way, there is no need to match all rule files during matching, but only the rule file of the target manufacturer needs to be matched in a targeted manner, thereby achieving fast matching and improving matching efficiency, thereby improving the processing efficiency of SIP signaling data, so that network devices can quickly process the SIP signaling data and send it out.
[0110] Therefore, the solution provided by the present application can realize the processing of fields in SIP signaling data of different formats, and realize the network device's support for data communication forwarding of audio and video platforms of different manufacturers based on the SIP protocol. That is, it solves the problem that when the network device acts as an intermediate device to modify the SIP signaling data, there may be differences in the signaling content between different manufacturers, which leads to the inability to correctly modify the package. The network device needs to be customized and developed according to the signaling content of different manufacturers, resulting in low deployment efficiency and low compatibility. The solution of the present application realizes efficient and convenient processing of problems caused by differences in signaling content, while reducing manpower and time costs.
[0111] Please refer to Figure 3 , Figure 3 1 is a structural block diagram of a data processing device 200 provided in an embodiment of the present application. The device 200 may be a module, program segment or code on an electronic device. It should be understood that the device 200 is similar to the above Figure 1 The method embodiment corresponds to and can be executed Figure 1 The various steps involved in the method embodiment and the specific functions of the device 200 can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here.
[0112] Optionally, the device 200 includes:
[0113] The data receiving module 210 is used to receive the current session initiation protocol SIP signaling data;
[0114] The data matching module 220 is used to match the current SIP signaling data with a pre-configured rule file to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, wherein the rule file includes a plurality of matching key fields and a modification rule field of the field to be modified, the plurality of matching key fields are used to indicate the location of the field to be modified in the SIP signaling data, and the modification rule field is used to indicate the modification rule of the field to be modified in the SIP signaling data;
[0115] The field modification module 230 is used to modify the corresponding field in the current SIP signaling data according to the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0116] Optionally, the device 200 further includes:
[0117] A file parsing module, used to parse a pre-configured rule file to obtain a plurality of fields in the rule file, wherein the plurality of fields include a plurality of matching key fields and a modification rule field; and store the rule file in a memory in the form of the plurality of fields;
[0118] The data matching module 220 is used to match the current SIP signaling data with the multiple fields stored in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rules of the corresponding fields.
[0119] Optionally, the file parsing module is used to store multiple fields of the rule file into a global variable structure array in the memory;
[0120] The data matching module 220 is used to match the current SIP signaling data with each array member of the global variable structure array in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0121] Optionally, the file parsing module is used to store multiple fields of the rule file into each node of a linked list in a memory;
[0122] The data matching module 220 is used to match the current SIP signaling data with each node of the linked list in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0123] Optionally, the device 200 further includes:
[0124] The file updating module is used to update the rule file and then configure it when it is necessary to update the matching key field and / or modify the rule field.
[0125] Optionally, the rule file further includes a sub-connection field, and the sub-connection field is used to indicate whether a corresponding sub-connection needs to be established.
[0126] Optionally, the rule file includes rule files corresponding to various manufacturers, and the data matching module 220 is used to obtain the target manufacturer corresponding to the current SIP signaling data; match the current SIP signaling data with the pre-configured rule file of the target manufacturer to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
[0127] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0128] Please refer to Figure 4 , Figure 4A structural diagram of an electronic device for executing a data processing method provided in an embodiment of the present application, the electronic device may include: at least one processor 310, such as a CPU, at least one communication interface 320, at least one memory 330 and at least one communication bus 340. Among them, the communication bus 340 is used to realize direct connection and communication between these components. Among them, the communication interface 320 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The memory 330 can be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 330 can optionally also be at least one storage device located away from the aforementioned processor. The memory 330 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 310, the electronic device executes the above-mentioned Figure 1 The method process is shown.
[0129] Understandably, Figure 4 The structure shown is for illustration only, and the electronic device may also include Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown. Figure 4 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0130] The present application embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the following is performed: Figure 1 The method process in the method embodiment shown is executed by the electronic device.
[0131] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can perform the methods provided by the above method embodiments, for example, including:
[0132] Receive current Session Initiation Protocol SIP signaling data;
[0133] Matching the current SIP signaling data with a pre-configured rule file to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, wherein the rule file includes a plurality of matching key fields and a modification rule field of the field to be modified, the plurality of matching key fields are used to indicate the position of the field to be modified in the SIP signaling data, and the modification rule field is used to indicate the modification rule of the field to be modified in the SIP signaling data;
[0134] According to the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, the corresponding field in the current SIP signaling data is modified.
[0135] In summary, the embodiments of the present application provide a data processing method, device, electronic device and storage medium. By pre-configuring a rule file, since multiple matching key fields and modification rule fields are pre-set in the rule file, the rule file can match SIP signaling data in any format. For SIP signaling data from any manufacturer, the fields that need to be modified can be determined through the rule file, thereby processing SIP signaling data from any manufacturer, with high compatibility and low error rate.
[0136] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0137] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0138] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0139] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0140] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Receive current Session Initiation Protocol SIP signaling data; Matching the current SIP signaling data with a pre-configured rule file to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, wherein the rule file includes a plurality of matching key fields and a modification rule field of the field to be modified, the plurality of matching key fields are used to indicate the position of the field to be modified in the SIP signaling data, and the modification rule field is used to indicate the modification rule of the field to be modified in the SIP signaling data; Modify the corresponding field in the current SIP signaling data according to the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field; The rule file includes rule files corresponding to various manufacturers, and the current SIP signaling data is matched with the pre-configured rule file to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, including: Obtain the target manufacturer corresponding to the current SIP signaling data; The current SIP signaling data is matched with the pre-configured rule file of the target manufacturer to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
2. The method according to claim 1, characterized in that Before receiving the current session initiation protocol SIP signaling data, the method further includes: Parsing a pre-configured rule file to obtain a plurality of fields in the rule file, wherein the plurality of fields include a plurality of matching key fields and a modification rule field; storing the rule file in a memory in the form of the multiple fields; The matching of the current SIP signaling data with a pre-configured rule file to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field includes: The current SIP signaling data is matched with a plurality of fields stored in the memory to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
3. The method according to claim 2, characterized in that The step of storing the rule file in the memory in the form of the multiple fields includes: Storing multiple fields of the rule file into a global variable structure array in memory; The matching of the current SIP signaling data with the multiple fields stored in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field includes: The current SIP signaling data is matched with each array member of the global variable structure array in the memory to obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
4. The method according to claim 2, characterized in that: The step of storing the rule file in the memory in the form of the multiple fields includes: Storing multiple fields of the rule file into each node of the linked list in the memory; The matching of the current SIP signaling data with the multiple fields stored in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field includes: The current SIP signaling data is matched with each node of the linked list in the memory to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
5. The method according to claim 1, characterized in that: The method further comprises: When it is necessary to update the matching key field and / or modify the rule field, the rule file is updated and then configured.
6. The method according to claim 1, characterized in that The rule file further includes a sub-connection field, and the sub-connection field is used to indicate whether a corresponding sub-connection needs to be established.
7. A data processing device, characterized in that: The device comprises: A data receiving module, used for receiving current session initiation protocol SIP signaling data; A data matching module, used to match the current SIP signaling data with a pre-configured rule file, and obtain the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field, wherein the rule file includes a plurality of matching key fields and a modification rule field of the field to be modified, the plurality of matching key fields are used to indicate the position of the field to be modified in the SIP signaling data, and the modification rule field is used to indicate the modification rule of the field to be modified in the SIP signaling data; A field modification module, used to modify the corresponding field in the current SIP signaling data according to the position of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field; Among them, the rule file includes rule files corresponding to various manufacturers, and the data matching module is specifically used to obtain the target manufacturer corresponding to the current SIP signaling data; match the current SIP signaling data with the pre-configured rule file of the target manufacturer to obtain the location of the field to be modified in the current SIP signaling data and the modification rule of the corresponding field.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 6 is executed.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is performed.
Citation Information
Patent Citations
Message modification method and device, equipment and storage medium
CN113691486A