A Freeswitch data reading and writing method, device, equipment and medium

CN115658341BActive Publication Date: 2026-09-11SI-TECH INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211301782.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-24
Publication Date
2026-09-11
Estimated Expiration
2042-10-24

AI Technical Summary

Technical Problem

随着Freeswitch对Redis的连接要求越来越多,现有技术中缺乏一种有效的手段,可以将Freeswitch与Redis哨兵集群进行直连

Benefits of technology

[0031] The technical solution provided by this invention provides an effective way to directly connect Freeswitch and Redis Sentinel cluster by obtaining the driver tool corresponding to the Redis Sentinel cluster and the data read/write commands that match Freeswitch; encapsulating the driver tool and the data read/write commands to obtain a read/write plugin that matches Freeswitch; and registering the read/write plugin in Freeswitch so that Freeswitch can connect to the Redis Sentinel cluster through the read/write plugin and complete data read/write operations in the Redis Sentinel cluster, thereby improving the data read/write efficiency of Freeswitch.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115658341B_ABST
    Figure CN115658341B_ABST
Patent Text Reader

Abstract

The application discloses a Freeswitch data reading and writing method, device, equipment and medium, comprising the following steps: acquiring a driving tool corresponding to a Redis sentinel cluster and a data reading and writing command matched with the Freeswitch; encapsulating the driving tool and the data reading and writing command to obtain a reading and writing plug-in matched with the Freeswitch; and registering the reading and writing plug-in in the Freeswitch, so that the Freeswitch is connected with the Redis sentinel cluster through the reading and writing plug-in, and a data reading and writing operation is completed in the Redis sentinel cluster. The technical scheme of the embodiment of the application can provide an effective way of directly connecting the Freeswitch with the Redis sentinel cluster, and improves the data reading and writing efficiency of the Freeswitch.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for reading and writing data using Freeswitch. Background Technology

[0002] Freeswitch is a softswitch solution for telephones, including a softphone and softswitch to provide voice and chat product drivers. Freeswitch is widely used in switch engines, PBXs, multimedia gateways, and multimedia servers.

[0003] Currently, Freeswitch typically only connects to a single Redis instance when reading and writing data. As Freeswitch's requirements for Redis connectivity increase, there is a lack of effective methods in existing technologies to directly connect Freeswitch to a Redis Sentinel cluster. Summary of the Invention

[0004] This invention provides a method, apparatus, device, and medium for reading and writing data in Freeswitch, which can provide an effective way to directly connect Freeswitch to a Redis Sentinel cluster, thereby improving the data read and write efficiency of Freeswitch.

[0005] According to one aspect of the present invention, a method for reading and writing data in Freeswitch is provided, comprising:

[0006] Obtain the driver tools corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch;

[0007] The driver tool and the data read / write command are encapsulated to obtain a read / write plugin that matches the Freeswitch;

[0008] Register the read / write plugin in Freeswitch so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster.

[0009] Optionally, the data read / write commands include write queue commands, read queue commands, write object commands, and read object commands.

[0010] Optionally, after registering the read / write plugin in Freeswitch, the method further includes:

[0011] After detecting that Freeswitch has started, load the configuration file corresponding to the Redis Sentinel cluster and start the client corresponding to the Redis Sentinel cluster.

[0012] After detecting that the client is running normally, the system controls Freeswitch to connect to the Redis Sentinel cluster through the read / write plugin and sends data read / write commands to the Redis Sentinel cluster to complete the data read / write operation.

[0013] Optionally, after starting the client corresponding to the Redis Sentinel cluster, the following also includes:

[0014] If an abnormality is detected in the client's operation, the client's operating status will be monitored until the client is detected to be operating normally.

[0015] Optionally, send data read / write commands to the Redis Sentinel cluster to complete data read / write operations, including:

[0016] Send a data write command to the Redis Sentinel cluster to complete the data write operation; or,

[0017] Send a data read command to the Redis Sentinel cluster to complete the data read operation.

[0018] Optionally, send a data read command to the Redis Sentinel cluster to complete the data read operation, including:

[0019] Monitor data in the Redis Sentinel cluster;

[0020] After detecting that the Redis Sentinel cluster has completed receiving new data based on the monitoring results, a data read command is sent to the Redis Sentinel cluster to complete the data read operation.

[0021] According to another aspect of the present invention, a device for reading and writing data in Freeswitch is provided, the device comprising:

[0022] The driver acquisition module is used to obtain the driver tools corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch.

[0023] The read / write plugin generation module is used to encapsulate the driver tool and the data read / write command to obtain a read / write plugin that matches the Freeswitch.

[0024] The data read / write module is used to register the read / write plugin in Freeswitch, so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster.

[0025] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0026] At least one processor; and

[0027] A memory communicatively connected to the at least one processor; wherein,

[0028] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the Freeswitch read / write data method according to any embodiment of the present invention.

[0029] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the Freeswitch data reading and writing method according to any embodiment of the present invention.

[0030] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the Freeswitch data reading and writing method described in any embodiment of the present invention.

[0031] The technical solution provided by this invention provides an effective way to directly connect Freeswitch and Redis Sentinel cluster by obtaining the driver tool corresponding to the Redis Sentinel cluster and the data read / write commands that match Freeswitch; encapsulating the driver tool and the data read / write commands to obtain a read / write plugin that matches Freeswitch; and registering the read / write plugin in Freeswitch so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster, thereby improving the data read / write efficiency of Freeswitch.

[0032] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1This is a flowchart of a method for reading and writing data using Freeswitch according to an embodiment of the present invention;

[0035] Figure 2 This is a flowchart of another method for reading and writing data using Freeswitch according to an embodiment of the present invention;

[0036] Figure 3 This is a flowchart of another method for reading and writing data using Freeswitch according to an embodiment of the present invention;

[0037] Figure 4 This is a schematic diagram of a Freeswitch data reading and writing device according to an embodiment of the present invention;

[0038] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the Freeswitch data reading and writing method according to an embodiment of the present invention. Detailed Implementation

[0039] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0040] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0041] The data acquisition and monitoring processes involved in the technical solutions of this invention comply with relevant laws and regulations and do not violate public order and good morals.

[0042] Figure 1This is a flowchart illustrating a method for reading and writing data using Freeswitch according to Embodiment 1 of the present invention. This embodiment is applicable to situations where Freeswitch reads and writes data in a Redis Sentinel cluster. The method can be executed by a Freeswitch data reading and writing device, which can be implemented in hardware and / or software. This device can be configured in an electronic device (e.g., a terminal or server) with data processing capabilities. Figure 1 As shown, the method includes:

[0043] Step 110: Obtain the driver tool corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch.

[0044] In this embodiment, the Redis Sentinel cluster is a cluster deployment method for Redis nodes. Multiple Redis nodes can be started in a Redis Sentinel cluster to ensure data uniqueness. The difference between a Redis Sentinel cluster and a single-node Redis cluster is that a single-node Redis cluster is at risk of failure, while in a Redis Sentinel cluster, because there are multiple Redis nodes, when one or more Redis nodes fail, the other nodes can take over the service of the failed node.

[0045] Optionally, in this step, the driver tool corresponding to the Redis Sentinel cluster can be obtained from the Redis Sentinel cluster's configuration file. The data read / write commands can be understood as pre-defined commands used to indicate data read / write operations after Freeswitch connects to the Redis Sentinel cluster.

[0046] In one embodiment of the present invention, the data read / write commands include a write queue command, a read queue command, a write object command, and a read object command.

[0047] In one specific embodiment, the write queue command can be:

[0048] SWITCH_ADD_API(commands_api_interface,"push_resis_sentinel_rpush","lpush redis message",push_resis_sentinel_rpush," <key> <message>");

[0049] The write queue command is used by Freeswitch to add queue information to the Redis Sentinel cluster.

[0050] In one specific embodiment, the queue read command can be:

[0051] SWITCH_ADD_API(commands_api_interface,"pop_resis_sentinel_lpop","lpopredis message",pop_resis_sentinel_lpop," <key>");

[0052] The read queue command is used by Freeswitch to read queue information from the Redis Sentinel cluster.

[0053] In one specific embodiment, the write object command can be:

[0054] SWITCH_ADD_API(commands_api_interface,"get_resis_sentinel_value","getredis message",get_resis_sentinel_value," <key>");

[0055] The write object command is used by Freeswitch to write data objects to the Redis Sentinel cluster.

[0056] In one specific embodiment, the command to read an object can be:

[0057] SWITCH_ADD_API(commands_api_interface,"set_resis_sentinel_value","setredis message",set_resis_sentinel_value," <key> <value>");

[0058] The read object command is used by Freeswitch to read data objects from the Redis Sentinel cluster.

[0059] Step 120: Encapsulate the driver tool and the data read / write command to obtain a read / write plugin that matches the Freeswitch.

[0060] In this step, the driver tools and data read / write commands can be encapsulated to obtain a plugin (i.e., a read / write plugin) for Freeswitch to read and write data in a Redis Sentinel cluster.

[0061] Step 130: Register the read / write plugin in Freeswitch so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster.

[0062] Optionally, in this step, the read / write plugin can be associated with a Freeswitch working module, allowing Freeswitch to connect to the Redis Sentinel cluster via command line and perform read / write operations. In practical use, Freeswitch can leverage Redis's Sentinel mode to synchronize its messages to other services and receive messages from other services.

[0063] In practical applications, Freeswitch is not limited to C and C++. Some functional modules (such as routing control, call line connection and disconnection, and conference events) are generally implemented using Lua or Java scripts. These events are communicated and notified to various servers through scripts.

[0064] In existing technologies, when connecting Freeswitch to a Redis Sentinel cluster, the functionality of the script can be directly used to handle the Redis Sentinel cluster. However, this approach results in very complex scripts that are difficult to maintain. Therefore, this embodiment provides a Freeswitch matching read / write plugin that requires no script modifications, reducing the development difficulty of Freeswitch data read / write operations and improving Freeswitch's data read / write efficiency. Furthermore, the read / write plugin can be deployed independently in Freeswitch, is easy to install, and does not affect the Freeswitch kernel.

[0065] The technical solution provided by this invention provides an effective way to directly connect Freeswitch and Redis Sentinel cluster by obtaining the driver tool corresponding to the Redis Sentinel cluster and the data read / write commands that match Freeswitch; encapsulating the driver tool and the data read / write commands to obtain a read / write plugin that matches Freeswitch; and registering the read / write plugin in Freeswitch so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster, thereby improving the data read / write efficiency of Freeswitch.

[0066] Figure 2 This is a flowchart illustrating a method for reading and writing data using Freeswitch according to Embodiment 2 of the present invention. This embodiment is a further refinement of the above embodiment. Figure 2 As shown, the method includes:

[0067] Step 210: Obtain the driver tool corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch.

[0068] Step 220: Encapsulate the driver tool and the data read / write command to obtain a read / write plugin that matches the Freeswitch.

[0069] Step 230: Register the read / write plugin in Freeswitch.

[0070] Step 240: After detecting that Freeswitch has started, load the configuration file corresponding to the Redis Sentinel cluster and start the client corresponding to the Redis Sentinel cluster.

[0071] In this step, optionally, the configuration file corresponding to the Redis Sentinel cluster can be retrieved and loaded from a preset storage location.

[0072] Step 250: After detecting that the client is running normally, control Freeswitch to connect to the Redis Sentinel cluster through the read / write plugin, and send data read / write commands to the Redis Sentinel cluster to complete the data read / write operation.

[0073] In this step, optionally, the running status of the client can be monitored. After detecting that the client is running normally, the Freeswitch can be controlled to connect to the Redis Sentinel cluster through the read / write plugin, and data read / write commands can be sent to the Redis Sentinel cluster through Freeswitch.

[0074] After Freeswitch sends data read and write commands to the Redis Sentinel cluster, it can receive the messages returned by the Redis Sentinel cluster through Freeswitch and send these messages back to the corresponding callback interface of Freeswitch (such as the Lua callback interface).

[0075] The technical solution provided by this invention obtains the driver tool corresponding to the Redis Sentinel cluster and the data read / write commands matching Freeswitch. It then encapsulates the driver tool and data read / write commands to obtain a read / write plugin matching Freeswitch, registers the read / write plugin in Freeswitch, and upon detecting Freeswitch startup, loads the configuration file corresponding to the Redis Sentinel cluster and starts the client corresponding to the Redis Sentinel cluster. After detecting that the client is running normally, it controls Freeswitch to connect to the Redis Sentinel cluster through the read / write plugin and sends data read / write commands to the Redis Sentinel cluster to complete data read / write operations. This provides an effective way to directly connect Freeswitch and the Redis Sentinel cluster, improving the data read / write efficiency of Freeswitch.

[0076] Figure 3 This is a flowchart illustrating a method for reading and writing data using Freeswitch according to Embodiment 3 of the present invention. This embodiment is a further refinement of the above embodiments. Figure 3 As shown, the method includes:

[0077] Step 310: Obtain the driver tool corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch.

[0078] Step 320: Encapsulate the driver tool and the data read / write command to obtain a read / write plugin that matches the Freeswitch.

[0079] Step 330: Register the read / write plugin in Freeswitch.

[0080] Step 340: After detecting that Freeswitch has started, load the configuration file corresponding to the Redis Sentinel cluster and start the client corresponding to the Redis Sentinel cluster.

[0081] Step 350: Determine whether the client is running normally. If yes, proceed to step 360; otherwise, proceed to step 370.

[0082] Step 360: After detecting that the client is running normally, control Freeswitch to connect to the Redis Sentinel cluster through the read / write plugin, and send data read / write commands to the Redis Sentinel cluster to complete the data read / write operation.

[0083] In one embodiment of the present invention, sending data read / write commands to the Redis Sentinel cluster to complete data read / write operations includes: sending a data write command to the Redis Sentinel cluster to complete a data write operation; or sending a data read command to the Redis Sentinel cluster to complete a data read operation.

[0084] In one specific embodiment, the data writing command may include a write queue command and a write object command; the data reading command may include a read queue command and a read object command.

[0085] In one specific embodiment, sending a data read command to the Redis Sentinel cluster to complete the data read operation includes: monitoring the data in the Redis Sentinel cluster; and after detecting that the Redis Sentinel cluster has completed receiving new data based on the monitoring results, sending a data read command to the Redis Sentinel cluster to complete the data read operation.

[0086] In one embodiment of this example, a data listening thread can be created in advance and used to listen to the data in the Redis Sentinel cluster. After detecting that new data has been stored in the Redis Sentinel cluster based on the listening results, a data read command is sent to the Redis Sentinel cluster.

[0087] The advantage of this setting is that it can avoid missing data results, thereby improving the effectiveness of the data reading results.

[0088] Step 370: Monitor the running status of the client and return to the operation in step 350 to determine whether the client is running normally, until the client is detected to be running normally.

[0089] In this embodiment, if an abnormality is detected in the client's operation, the client's operating status continues to be monitored until the client is detected to be operating normally. After the client is detected to be operating normally, the operation in step 360 is repeated.

[0090] The technical solution provided by this invention obtains the driver tool corresponding to the Redis Sentinel cluster and the data read / write commands matching Freeswitch, encapsulates the driver tool and the data read / write commands to obtain a read / write plugin matching Freeswitch, registers the read / write plugin in Freeswitch, and after detecting that Freeswitch has started, loads the configuration file corresponding to the Redis Sentinel cluster and starts the client corresponding to the Redis Sentinel cluster. It determines whether the client is running normally. If so, it controls Freeswitch to connect to the Redis Sentinel cluster through the read / write plugin and sends data read / write commands to the Redis Sentinel cluster to complete the data read / write operation. If not, it monitors the running status of the client until it detects that the client is running normally. This technical means provides an effective way to directly connect Freeswitch and the Redis Sentinel cluster, improving the data read / write efficiency of Freeswitch.

[0091] Figure 4 This is a schematic diagram of a Freeswitch data reading and writing device provided in Embodiment 4 of the present invention, as shown below. Figure 4 As shown, the device includes: a driver acquisition module 410, a read / write plug-in generation module 420, and a data read / write module 430.

[0092] Among them, the driver acquisition module 410 is used to acquire the driver tool corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch;

[0093] The read / write plugin generation module 420 is used to encapsulate the driver tool and the data read / write command to obtain a read / write plugin that matches the Freeswitch.

[0094] The data read / write module 430 is used to register the read / write plugin in Freeswitch, so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster.

[0095] The technical solution provided by this invention provides an effective way to directly connect Freeswitch and Redis Sentinel cluster by obtaining the driver tool corresponding to the Redis Sentinel cluster and the data read / write commands that match Freeswitch; encapsulating the driver tool and the data read / write commands to obtain a read / write plugin that matches Freeswitch; and registering the read / write plugin in Freeswitch so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster, thereby improving the data read / write efficiency of Freeswitch.

[0096] Based on the above embodiments, the data read / write commands include a write queue command, a read queue command, a write object command, and a read object command.

[0097] The data read / write module 430 includes:

[0098] The client startup unit is used to load the configuration file corresponding to the Redis Sentinel cluster and start the client corresponding to the Redis Sentinel cluster after detecting that Freeswitch has started.

[0099] The command sending unit is used to control Freeswitch to connect to the Redis Sentinel cluster through the read / write plugin after detecting that the client is running normally, and to send data read / write commands to the Redis Sentinel cluster to complete the data read / write operation;

[0100] The status monitoring unit is used to monitor the running status of the client if an abnormality is detected in the client's operation, until the client is detected to be running normally.

[0101] The write command sending unit is used to send data write commands to the Redis Sentinel cluster to complete the data write operation;

[0102] The read command sending unit is used to send data read commands to the Redis Sentinel cluster to complete the data read operation;

[0103] The data monitoring unit is used to monitor the data in the Redis Sentinel cluster;

[0104] The data reading unit is used to send a data reading command to the Redis Sentinel cluster after detecting that the Redis Sentinel cluster has finished receiving new data based on the monitoring results, so as to complete the data reading operation.

[0105] The above-described apparatus can execute the methods provided in all the foregoing embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the above methods. Technical details not described in detail in the embodiments of the present invention can be found in the methods provided in all the foregoing embodiments of the present invention.

[0106] Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0107] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0108] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0109] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the Freeswitch method of reading and writing data.

[0110] In some embodiments, the Freeswitch data reading and writing method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the Freeswitch data reading and writing method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the Freeswitch data reading and writing method by any other suitable means (e.g., by means of firmware).

[0111] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0112] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0113] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0114] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0115] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0116] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0117] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0118] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.< / value> < / key> < / key> < / key> < / message> < / key>

Claims

1. A method for reading and writing data in Freeswitch, characterized in that, include: Obtain the driver tools corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch; The driver tool and the data read / write command are encapsulated to obtain a read / write plugin that matches the Freeswitch; Register the read / write plugin in Freeswitch so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster.

2. The method according to claim 1, characterized in that, The data read / write commands include write queue commands, read queue commands, write object commands, and read object commands.

3. The method according to claim 1, characterized in that, After registering the read / write plugin in Freeswitch, the following is also included: After detecting that Freeswitch has started, load the configuration file corresponding to the Redis Sentinel cluster and start the client corresponding to the Redis Sentinel cluster. After detecting that the client is running normally, the system controls Freeswitch to connect to the Redis Sentinel cluster through the read / write plugin and sends data read / write commands to the Redis Sentinel cluster to complete the data read / write operation.

4. The method according to claim 3, characterized in that, After starting the client for the Redis Sentinel cluster, the following is also included: If an abnormality is detected in the client's operation, the client's operating status will be monitored until the client is detected to be operating normally.

5. The method according to claim 3, characterized in that, Send data read and write commands to the Redis Sentinel cluster to complete data read and write operations, including: Send a data write command to the Redis Sentinel cluster to complete the data write operation; or, Send a data read command to the Redis Sentinel cluster to complete the data read operation.

6. The method according to claim 5, characterized in that, Send a data read command to the Redis Sentinel cluster to complete the data read operation, including: Monitor data in the Redis Sentinel cluster; After detecting that the Redis Sentinel cluster has completed receiving new data based on the monitoring results, a data read command is sent to the Redis Sentinel cluster to complete the data read operation.

7. A device for reading and writing data in Freeswitch, characterized in that, include: The driver acquisition module is used to obtain the driver tools corresponding to the Redis Sentinel cluster, as well as the data read and write commands that match Freeswitch; The read / write plugin generation module is used to encapsulate the driver tool and the data read / write command to obtain a read / write plugin that matches the Freeswitch. The data read / write module is used to register the read / write plugin in Freeswitch, so that Freeswitch can connect to the Redis Sentinel cluster through the read / write plugin and complete data read / write operations in the Redis Sentinel cluster.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the Freeswitch read / write data method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the Freeswitch method for reading and writing data as described in any one of claims 1-6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the Freeswitch method for reading and writing data according to any one of claims 1-6.

Citation Information

Patent Citations

  • Link performance test method and device, server and storage medium

    CN113259201A

  • Read-write method and device of eMMC device, equipment and storage medium

    CN114936173A