Method, system, medium and equipment for converting radius protocol and ocs protocol

Through a method and system for converting radius protocol and ocs protocol, the problem of high protocol conversion cost in the existing technology is solved, the adaptation between the radius protocol and the ocs protocol is realized, the cost of upgrading network elements is reduced, and the existing radius network elements are supported to access the new billing system.

CN119967065APending Publication Date: 2025-05-09XIAN XINLU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411435384.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-05-09

Smart Images

  • Figure CN119967065A_ABST
    Figure CN119967065A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of network communication, and discloses a method, a system, a medium and equipment for converting a radius protocol and an ocs protocol. The method comprises the following steps: creating a radius monitoring port, receiving a message, and establishing connection with an ocs server; initializing a session information table and a timer; receiving a user radius authentication request packet through a radius monitoring port, analyzing the user radius authentication request packet, determining whether the user can be successfully online or not according to returned CCA authorization, converting ocs protocol authorization information into radius authorization information, issuing the radius authorization information to an access network element, and recording user online information; receiving a radius update bookkeeping packet through a radius monitoring port, recording user flow change, performing information comparison, calculating incremental flow and duration, comparing with ocs authorization information, and adjusting the online state of the user according to the returned update authorization quantity; obtaining a user radius bookkeeping stopping message, and enabling the user to be offline; wherein the abnormal inactive session is processed through the timer. According to the invention, the problem of communication conversion adaptation before different protocol network elements is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a method, system, medium and equipment for converting a RADIUS protocol into an OCS protocol. Background Art

[0002] RADIUS (Remote Authentication Dial In User Service) protocol is a distributed, client / server information exchange protocol that can protect the network from unauthorized access. It is often used in various network environments that require high security and allow remote user access. RADIUS protocol is a standard protocol that is supported by almost all mainstream devices and is the most widely used in actual networks. RADIUS uses UDP (User Datagram Protocol) as the transmission protocol and has good real-time performance. It also supports retransmission mechanism and backup server mechanism and has good reliability. It is relatively simple to implement and is suitable for the multi-threaded structure of the server side when there are a large number of users.

[0003] The ocs (online charging for mobile services of china telecom) protocol is compiled based on a thorough study and analysis of online charging protocols at home and abroad, and with reference to the online charging interface protocol specifications of international standard organizations such as 3gpp and ietf; the protocol uses TCP as the transport layer protocol.

[0004] Due to its long history and wide industry support, most network devices (such as routers, switches, wireless access points) and operating systems have built-in support for RADIUS. It has become the preferred solution for implementing network access control and an important standard in the field of network authentication, authorization and accounting (AAA). RADIUS is widely used in various network environments, especially in traditional enterprise networks, ISPs (Internet service providers), wireless networks (such as Wi-Fi authentication), VPNs (virtual private networks), and some cloud services. All network elements in the field of broadband authentication and billing use the RADIUS protocol, and various RADIUS protocol management systems have been established.

[0005] However, due to the defects of the RADIUS protocol itself, such as UDP-based transmission, simple packet loss mechanism, no provisions for retransmission and centralized billing services, it is not well suited to the development of the current network and needs further improvement.

[0006] The OCS protocol proposed by China Telecom is transmitted through TCP, and the addition of online billing and other protocol content can provide good support. However, a large number of network elements in the existing network cannot support the new OCS protocol in a short period of time, and the procurement, upgrade and replacement of equipment requires a period of time. Various systems in the existing network that are developed around RADIUS need to make protocol changes, which is very costly.

[0007] Therefore, how to provide a method and system for converting the RADIUS protocol to the OCS protocol to reduce the cost is a problem that needs to be solved urgently. Summary of the invention

[0008] The embodiments of the present invention provide a method, system, medium, and device for converting the RADIUS protocol to the OCS protocol to solve the problem of conversion and adaptation between the original protocol and the new protocol in the prior art. In order to have a basic understanding of some aspects of the disclosed embodiments, a simple summary is given below. This summary is not a general review, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its only purpose is to present some concepts in a simple form as a preface to the detailed description that follows.

[0009] According to a first aspect of an embodiment of the present invention, a method for converting a RADIUS protocol to an OCS protocol is provided.

[0010] In one embodiment, the method comprises: Create a RADIUS listening port, receive messages, and establish a connection with the OCS server; Initialize the session information table and timer, and establish the online user information table; Receive the user's RADIUS authentication request packet through the RADIUS listening port, parse it, encapsulate the OCS CCR-Initial message service request, and decide whether the user can go online successfully based on the returned CCA authorization. If the user goes online successfully, convert the OCS protocol authorization information into RADIUS authorization information, send it to the access network element, and record the user's online information; Receive the RADIUS update accounting package through the RADIUS listening port, record the user traffic changes, compare the information with the online user information table, calculate the incremental traffic and duration, and compare it with the OCS authorization information, and adjust the user online status according to the returned updated authorization amount; Obtain the user's radius accounting stop message, send the ocs CCR-Final message, and take the user offline; Among them, abnormal inactive sessions are processed through a timer.

[0011] Based on the above solution, the steps of creating a RADIUS listening port, receiving messages, and establishing a connection with the OCS server specifically include: Create a RADIUS authentication protocol listening port, create a RADIUS accounting message listening port, and create an OCS socket connection. All of them establish connections with the OCS server, launch an initial packet, initialize the connection, and obtain confirmation of a successful connection from the OCS server.

[0012] On the basis of the above scheme, the user's radius authentication request packet is received through the radius listening port, parsed, and encapsulated into an ocs CCR-Initial message service request, and whether the user can successfully go online is determined according to the returned CCA authorization. If the user goes online successfully, the ocs protocol authorization information is converted into radius authorization information, and the access network element is sent down to record the user's online information. The steps of parsing the user's radius authentication request packet specifically include: (1) Parse the user's radius authentication request packet to obtain user information; (2) Encapsulate the OCS CCR-Initial message request packet based on the obtained user field information, and request authorization from the OCS server; (3) After obtaining authorization from the OCS server, check the user authorization result; If the authorization is denied, the user fails to go online, and the RADIUS authentication failure message is returned with the failure reason. If the authorization is successful, the user can go online successfully, parse the ocs CCA-Initial authorization information, encapsulate the radius authorization information, return the radius online success, carry the authorization information, and record the user online information; (4) If the OCS server returns the message that the user needs offline billing, it replies that the RADIUS user authentication is successful, records the user's online information, generates an offline call record, and subsequently sends it to the OCS server via FTP; (5) Set the request timeout timer. If OCS cannot reply within the set time, it will be marked as response timeout. First reply that RADIUS authentication is successful, and the user will go online first. Then, according to the set number of retries, silently request the OCS server. If the number of retries exceeds and the OCS server does not respond, a RADIUS control packet is sent to log the user offline. If the OCS server responds, resend the relevant message information.

[0013] On the basis of the above scheme, the step of receiving the RADIUS update accounting package through the RADIUS listening port, recording the user traffic change, performing information comparison according to the online user information table, calculating the incremental traffic and duration, and comparing with the OCS authorization information, and adjusting the user online status according to the returned updated authorization amount, wherein the user online processing method specifically includes the following steps: (1) Parse the user's radius update accounting package, obtain user information, and query the user's online information based on acct-session-id; If the user is not online, a radius control packet is sent to log the user offline, and the process ends; If the user is online, calculate the increment of duration and traffic from the last message based on historical online records; (2) Encapsulate the ocs CCR-update message according to the incremental information, report the information to the ocs server, and obtain the authorized ocs CCR-update message result: If the user authorization expires and can no longer be used, a radius control packet is sent to log the user offline, and the process ends; If the user can continue to use the service, the online record table is updated, the user usage status is updated, and the process ends.

[0014] On the basis of the above scheme, the step of obtaining the user's radius stop accounting message, sending the ocs CCR-Final message message, and taking the user offline, wherein the user online processing method specifically includes the following steps: (1) Parse the user's radius stop packet, obtain user information, and query the user's online information based on acct-session-id: If the user is not online, the process ends; If the user is online, calculate the increment of duration and traffic from the last message based on historical online records; (2) Encapsulate the OCS CCR-final message according to the incremental information, report the information to the OCS server, and obtain the CCA-final message result; (3) Execute the user offline action, clear the online information table, and the process ends.

[0015] Based on the above solution, the step of processing the abnormal inactive session by using the timer specifically includes: The processing method includes online session cleanup, radius cleanup, and ocs cleanup offline when processing abnormal inactive sessions.

[0016] According to a second aspect of an embodiment of the present invention, a RADIUS protocol and an OCS protocol conversion system is provided.

[0017] In one embodiment, a conversion system comprises: The user resource block management component is used to create a RADIUS listening port, receive messages, establish a connection with the OCS server, initialize the session information table and timer, and establish an online user information table; The radius protocol processing component is used to receive the user's radius authentication request packet through the radius listening port, parse it, encapsulate the ocs CCR-Initial message service request, and decide whether the user can go online successfully based on the returned CCA authorization. If the user goes online successfully, the ocs protocol authorization information is converted into radius authorization information, and sent to the access network element to record the user's online information; receive the radius update accounting packet through the radius listening port, record the user's traffic changes, compare the information according to the online user information table, calculate the incremental traffic and duration, and compare it with the ocs authorization information, and adjust the user's online status according to the returned updated authorization amount; The ocs protocol processing component is used to obtain the user's radius accounting stop message, send the ocs CCR-Final message message, and take the user offline; The exception handling component is used to handle abnormal inactive sessions through a timer.

[0018] According to a third aspect of an embodiment of the present invention, a computer device is provided.

[0019] In some embodiments, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0020] The technical solution provided by the embodiment of the present invention may have the following beneficial effects: The present invention can complete the conversion of protocols to adapt to the connection between different types of network elements (RADIUS protocol network elements, OCS protocol network elements. Before the system, the two network elements cannot be connected, and the authorization messages are not interoperable. In addition, the current network status is that (a large number of access network network elements use the RADIUS protocol, but the core network uses the OCS protocol). Through the present invention, the RADIUS network elements of the existing network are not upgraded or replaced, but the protocol conversion is uniformly performed through the system. The method and system for converting the RADIUS protocol to the OCS protocol proposed by the present invention can solve the adaptation problem between the protocols, so that the existing RADIUS-related network elements and systems can be converted to the OCS protocol and access the new billing system of telecommunications.

[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0023] Figure 1 is a flowchart of a method for converting a RADIUS protocol to an OCS protocol according to an exemplary embodiment; Figure 2 is a flow chart showing steps of user online processing according to an exemplary embodiment; Figure 3 is a flow chart of steps for processing a user update message according to an exemplary embodiment; Figure 4 is a flow chart showing steps for processing user offline according to an exemplary embodiment; Figure 5 is a flowchart of abnormal session processing according to an exemplary embodiment; Figure 6 is a schematic diagram of a RADIUS protocol and an OCS protocol conversion system according to an exemplary embodiment; Figure 7 The figure is a schematic diagram showing the structure of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION

[0024] The following description and accompanying drawings fully illustrate the specific embodiments of this article so that those skilled in the art can practice them. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of this article includes the entire scope of the claims, as well as all available equivalents of the claims. Herein, the terms "first", "second", etc. are only used to distinguish one element from another, without requiring or implying any actual relationship or order between these elements. In fact, the first element can also be called the second element, and vice versa. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the structure, device or equipment including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such structure, device or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the structure, device or equipment including the elements. Each embodiment is described in a progressive manner herein, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other.

[0025] The terms "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. in this document indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In the description of this document, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a mechanical connection or an electrical connection, it can also be the internal communication of two elements, it can be a direct connection, or it can be an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0026] As used herein, the term "plurality" means two or more than two, unless otherwise specified.

[0027] In this document, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B means: A or B.

[0028] In this article, the term "and / or" is a description of the association relationship between objects, indicating that three relationships may exist. For example, A and / or B means: A or B, or, A and B.

[0029] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0030] Figure 1 An embodiment of a method for converting a RADIUS protocol to an OCS protocol according to the present invention is shown.

[0031] In this optional embodiment, the method for converting the RADIUS protocol to the OCS protocol includes the following steps: S101, initialize the connection, create a RADIUS port monitor, start receiving messages, and establish a connection with the OCS server; Specifically include: creating a RADIUS authentication protocol listening port, creating a RADIUS accounting message listening port, creating an OCS socket connection, establishing a connection with the OCS server, launching an initial packet, initializing the connection, and obtaining confirmation of a successful connection from the OCS server.

[0032] S102, initializing the session information table, initializing the timer, and establishing an online user information table; Initialization is to create the session information interface and create the corresponding data structure in memory.

[0033] The information in the online information table includes UserName, acct-session-id, frame-ip-address, starttime, nasip, mac, acct-Input-Octets, and Acct-Output-Octets.

[0034] Specifically, after the user goes online, a user online information table is created to calculate the user's incremental information record; it is also used to query the user's historical online information in the user update message and end message; the user's UserName, MAC, and port information are also recorded for creating an offline call record after an exception occurs with the ocs server.

[0035] S103, receiving the user's RADIUS authentication request packet, parsing the request packet, encapsulating the OCS CCR-Initial message service request, and determining whether the user can successfully go online based on the returned CCA authorization. If the user successfully goes online, convert the OCS protocol authorization information into RADIUS authorization information, and send it to the access network element to record the user's online information; When processing the user's radius authentication request package, including: Figure 2 The user online processing steps shown are as follows: (1) Parse the user's RADIUS authentication request packet to obtain user IP, acct-session-id, username, MAC and other information; (2) Encapsulate the OCS CCR-Initial message request packet based on the obtained user field information, and request authorization from the OCS server; (3) After obtaining authorization from the OCS server, check the user authorization result; If authorization is denied, the user fails to go online and a radius authentication failure message is returned with the reason for the failure. If the authorization is successful, the user can go online successfully, parse the ocs CCA-Initial authorization information, encapsulate the radius authorization information, return the radius online success, carry the authorization information, and record the user online information; (4) If the OCS server returns that the user needs offline billing, it replies that the RADIUS user authentication is successful, records the user's online information, generates an offline call record, and subsequently sends it to the OCS server via FTP.

[0036] (5) Set the request timeout timer. If OCS fails to reply within the timeout period (set N milliseconds), it is marked as a response timeout. The RADIUS authentication is successful and the user goes online first. Subsequently, according to the set number of retries, the OCS server is silently requested. If the number of retries exceeds and the OCS server does not respond, a RADIUS control packet is sent to log the user offline. If the OCS server responds, resend the relevant message information.

[0037] S104, continue to receive the user's radius update accounting package, record the user's traffic changes, and compare them with the authorization information: The incremental traffic and duration are sent via the ocs CCR-update message, and the user policy is adjusted based on the returned updated authorization amount. If the authorization is exceeded and the user is in arrears, the user is taken offline, that is, the access network element is notified via the radius COA message. When processing the user radius update accounting package, including: Figure 3 The user online processing steps shown are as follows: (1) Parse the user's radius update accounting package to obtain the user's IP, acct-session-id, username, mac and other information, and query the user's online information based on the acct-session-id; If the user is not online, a radius control packet is sent to log the user offline, and the process ends; If the user is online, calculate the increment of duration and traffic from the last message based on historical online records; (2) Encapsulate the ocs CCR-update message according to the incremental information, report the information to the ocs server, and obtain the authorized ocs CCR-update message result: If the user authorization expires and can no longer be used, a radius control packet is sent to log the user offline, and the process ends; If the user can continue to use the service, the online record table is updated, the user usage status is updated, and the process ends.

[0038] S105: Receive the user's radius accounting stop message, send an ocs CCR-final message, and log the user offline; When processing user radius stop, including: Figure 4 The user online processing steps shown are as follows: (1) Parse the user's RADIUS stop packet to obtain the user's IP, acct-session-id, username, mac and other information, and query the user's online information based on the acct-session-id: If the user is not online, the process ends; If the user is online, calculate the increment of duration and traffic from the last message based on historical online records; (2) Encapsulate the OCS CCR-final message according to the incremental information, report the information to the OCS server, and obtain the CCA-final message result; (3) Execute the user offline action, clear the online information table, and the process ends.

[0039] S106, the timer processes abnormal inactive sessions, including online session cleanup, radius cleanup, and OCS cleanup and offline; When handling abnormal inactive sessions, including: Figure 5 The following figure shows the process flow of user online processing. The execution process is as follows: (1) Check abnormal sessions; (2) Clean up abnormal sessions: OCS processing and RADIUS processing.

[0040] In the method provided in the present application, it is only used to initialize the connection, create a RADIUS port listener, start receiving messages, and establish a connection with the OCS server; initialize the session information table and the timer; establish an online user information table; receive the user RADIUS authentication request packet, parse the request packet, encapsulate the OCS CCR-initial message service request, and decide whether the user can go online successfully based on the returned CCA authorization. If the user goes online successfully, the OCS protocol authorization information is converted into RADIUS authorization information, and sent to the access network element to record the user's online information; continuously receive the user RADIUS update accounting package, record the user traffic changes, and compare them with the authorization information; the incremental traffic and duration are sent through the OCS CCR-update message, and the user policy is adjusted according to the returned updated authorization amount. If the user has exceeded the authorization and is in arrears, the user will be offline (notify the access network element through the radius COA message; after receiving the user's radius accounting stop message, send an ocs CCR-Final message message to offline the user; the timer handles abnormal inactive sessions: online session cleanup, radius cleanup or ocs cleanup offline. This method solves the conversion and adaptation problem between the radius protocol and the ocs protocol, and connects the radius protocol network element to the ocs service after conversion, realizing the unified policy delivery of the network element.

[0041] In the above scheme, the OCS protocol message types are divided into the following types: 1. Credit-Control-Request (CCR) (there are three types of requests here: Initial, update, and Final) corresponding to authentication request, update request, and end request respectively (the request message is always sent as CCR); That is, ocs CCR-Initial is an authentication request, ocs CCR-update is an update request, and ocs CCR-update is an end request.

[0042] 2. Credit-Control-Answer (CCA) (All received response messages are CCA) radius COA (Change of Authorization) is the change of radius authorization information.

[0043] like Figure 6 As shown, an embodiment of the present application discloses a RADIUS protocol and OCS protocol conversion system.

[0044] In this optional embodiment, the protocol conversion system includes: a user resource block management component 601, a radius protocol processing component 602, an ocs protocol processing component 603, and an exception processing component 604.

[0045] User resource block management component 601. After the user goes online, it creates a user online information table and calculates the user incremental information record; it is also used to query the user's historical online information in the user update message and end message; it also records the user's username, MAC, and port information, which is used to create an offline call record after an exception with the OCS server.

[0046] The radius protocol processing component 602 is used to process the analysis of the radius authentication message and the accounting message. It is also used to encapsulate the radius control message and process the user offline operation. It is also used to find and calculate the user traffic and duration according to the user session information. It is also used to communicate with the access network element and the authentication and billing related system.

[0047] The OCS protocol processing component 603 is used to establish communication with the OCS server, send an initial packet, and establish a connection; it is also used to encapsulate the CCR request message of the reply, send it to the OCS server, and obtain the CCA response; it is also used to receive the OCS control message protocol and process the prepaid, postpaid and other service policies.

[0048] The exception handling component 604 is used to check the abnormality of the user session and handle abnormal online sessions for the user, including OCS exception handling, RADIUS exception handling, etc.

[0049] The protocol processing process is as follows: User->Basic network element (send RADIUS protocol)->This program (parse RADIUS protocol) (send OCS protocol)->OCS server; This system can complete the protocol conversion to adapt to the connection between different types of network elements (RADIUS protocol network elements, OCS protocol network elements. Before this system, the two network elements could not be connected and the authorization messages were not interoperable. In addition, the current network status is (a large number of access network network elements use the RADIUS protocol, but the core network uses the OCS protocol). Through this system, the RADIUS network elements of the existing network can be converted to protocols uniformly without upgrading or replacing them.

[0050] This system has three main working modules 1. Initialize various status information; 2. Receive the RADIUS protocol (there are two types of messages [authentication message, accounting message]), among which the accounting request message has three states [start, update, end], authentication); the authentication request message has only one state (request authentication), and the authentication response message has two states (pass [pass will carry authorization information], reject [reject carry rejection reason]), perform relevant conversion, and convert to the OCS protocol (three states [CCR-initial, CCR-Update, CCR-Final]); 2.1. Receive the RADIUS authentication request packet from the downstream network element and convert it into ->CCR-initial authentication request packet, then wait for a response (the waiting here cannot be unlimited, a timeout will be set, which is also a timer), receive the CCR-initial response message (which contains authorization information), parse this message and convert it into RADIUS authorization information, and return it to the downstream network element (RADIUS authentication passed (with RADIUS authorization information)); 2.2 Receive the radius billing message (start, update) message from the downstream network element. Generally speaking, after receiving the "authentication success message" in the previous step, the downstream network element will immediately generate a billing start message, and then send an update message every 15 minutes (the user's duration and traffic usage information are updated in the message time). This conversion system checks the first "start message"; if the previous step is processed normally due to timeout (upstream did not respond), corresponding processing exceptions, etc., a CCR-initial request message will be sent here to apply for an authentication request.

[0051] For the second type of "update message", it is converted into a CCR-Update message, sent out, and waits for a response. The result returned by the upstream may have two states (users can continue to use [with authorization], and users cannot use [rejected]). For the "can continue to use" type, no additional processing is performed. For requests to refuse to use, the radius COA (radius authorization change) message is actively encapsulated to kick the user off (let the user session end). When the network element receives the coa message, it will take the user offline (will end the user's billing, and will send an "end message" [stop accounting]), and reply to the coa processing result.

[0052] 2.3. Receive the RADIUS billing message (end) from the downstream network element, convert the message into CCR-Final, which means the session is ended, and clear the information related to the session; 3. The system will have a global timer to handle various abnormal information (due to abnormal sessions), such as failure to receive the (start, update, end messages) from the downstream network element due to network problems. There will be several strategies: if the "update message" of a certain session is not received within several billing intervals, the session is considered offline and cleanup is performed. If the "end message" from the network element that should have been received is not received, cleanup is performed.

[0053] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store static information and dynamic information data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in the above method embodiment are implemented.

[0054] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0055] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiment when executing the computer program.

[0056] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0057] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0058] The present invention is not limited to the structures which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for converting a RADIUS protocol to an OCS protocol, characterized in that: The following steps are involved: Create a RADIUS listening port, receive messages, and establish a connection with the OCS server; Initialize the session information table and timer, and establish the online user information table; Receive the user's RADIUS authentication request packet through the RADIUS listening port, parse it, encapsulate the OCS CCR-Initial message service request, and decide whether the user can go online successfully based on the returned CCA authorization. If the user goes online successfully, convert the OCS protocol authorization information into RADIUS authorization information, send it to the access network element, and record the user's online information; Receive the RADIUS update accounting package through the RADIUS listening port, record the user traffic changes, compare the information with the online user information table, calculate the incremental traffic and duration, and compare it with the OCS authorization information, and adjust the user online status according to the returned updated authorization amount; Obtain the user's radius accounting stop message, send the ocs CCR-Final message, and take the user offline; Among them, abnormal inactive sessions are processed through a timer.

2. The method for converting the RADIUS protocol to the OCS protocol according to claim 1, characterized in that: The steps of creating a RADIUS listening port, receiving messages, and establishing a connection with the OCS server specifically include: Create a RADIUS authentication protocol listening port, create a RADIUS accounting message listening port, and create an OCS socket connection. All of them establish a connection with the OCS server, launch an initial packet, initialize the connection, and obtain confirmation of a successful connection from the OCS server.

3. The method for converting the RADIUS protocol to the OCS protocol according to claim 1, characterized in that: The step of receiving the user's RADIUS authentication request packet through the RADIUS listening port, parsing it, encapsulating the OCS CCR-Initial message service request, and determining whether the user can successfully go online based on the returned CCA authorization, and if the user successfully goes online, converting the OCS protocol authorization information into RADIUS authorization information, and sending it to the access network element, and recording the user's online information, wherein the user's RADIUS authentication request packet is parsed, specifically including: (1) Parse the user's radius authentication request packet to obtain user information; (2) Encapsulate the OCS CCR-Initial message request packet based on the obtained user field information, and request authorization from the OCS server; (3) After obtaining authorization from the OCS server, check the user authorization result; If the authorization is denied, the user fails to go online, and the RADIUS authentication failure message is returned with the failure reason. If the authorization is successful, the user can go online successfully, parse the ocs CCA-Initial authorization information, encapsulate the radius authorization information, return the radius online success, carry the authorization information, and record the user online information; (4) If the OCS server returns the message that the user needs offline billing, it replies that the RADIUS user authentication is successful, records the user's online information, generates an offline call record, and subsequently sends it to the OCS server via FTP; (5) Set the request timeout timer. If OCS cannot reply within the set time, it will be marked as response timeout. First reply that RADIUS authentication is successful, and the user will go online first. Then, according to the set number of retries, silently request the OCS server. If the number of retries exceeds and the OCS server does not respond, a RADIUS control packet is sent to log the user offline. If the OCS server responds, resend the relevant message information.

4. The method for converting the RADIUS protocol to the OCS protocol according to claim 1, characterized in that: The step of receiving the RADIUS update accounting package through the RADIUS listening port, recording the user traffic change, performing information comparison according to the online user information table, calculating the incremental traffic and duration, and comparing them with the OCS authorization information, and adjusting the user online status according to the returned updated authorization amount, wherein the user online processing method specifically includes the following steps: (1) Parse the user's radius update accounting package, obtain user information, and query the user's online information based on acct-session-id; If the user is not online, a radius control packet is sent to log the user offline, and the process ends; If the user is online, calculate the increment of duration and traffic from the last message based on historical online records; (2) Encapsulate the ocs CCR-update message according to the incremental information, report the information to the ocs server, and obtain the authorized ocs CCR-update message result: If the user authorization expires and can no longer be used, a radius control packet is sent to log the user offline, and the process ends; If the user can continue to use the service, the online record table is updated, the user usage status is updated, and the process ends.

5. The method for converting the RADIUS protocol to the OCS protocol according to claim 1, characterized in that: The step of obtaining the user's radius stop accounting message, sending the ocs CCR-Final message message, and taking the user offline, wherein the user online processing method specifically includes the following steps: (1) Parse the user's radius stop packet, obtain user information, and query the user's online information based on acct-session-id: If the user is not online, the process ends; If the user is online, calculate the increment of duration and traffic from the last message based on historical online records; (2) Encapsulate the OCS CCR-final message according to the incremental information, report the information to the OCS server, and obtain the CCA-final message result; (3) Execute the user offline action, clear the online information table, and the process ends.

6. The method for converting the RADIUS protocol to the OCS protocol according to claim 1, characterized in that: The step of processing the abnormal inactive session by using a timer specifically includes: The processing method includes online session cleanup, radius cleanup, and ocs cleanup offline when processing abnormal inactive sessions.

7. A system for converting RADIUS protocol to OCS protocol, characterized in that: include: The user resource block management component (601) is used to create a RADIUS listening port, receive messages, establish a connection with the OCS server, initialize the session information table and timer, and establish an online user information table; The radius protocol processing component (602) is used to receive the user's radius authentication request packet through the radius listening port, parse it, encapsulate the ocs CCR-Initial message service request, and determine whether the user can successfully go online based on the returned CCA authorization. If the user successfully goes online, the ocs protocol authorization information is converted into radius authorization information, and sent to the access network element to record the user's online information; Receive the RADIUS update accounting package through the RADIUS listening port, record the user traffic changes, compare the information with the online user information table, calculate the incremental traffic and duration, and compare it with the OCS authorization information, and adjust the user online status according to the returned updated authorization amount; The ocs protocol processing component (603) is used to obtain the user's radius stop accounting message, send an ocs CCR-Final message, and log the user offline; The exception handling component (604) is used to handle abnormal inactive sessions through a timer.

8. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the method for converting the RADIUS protocol to the OCS protocol as described in any one of claims 1 to 6 is implemented.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.