Distributed video call recording method and video call recording device
Through the distributed video call recording method, using load balancing and communication fluency judgment, dynamically allocate recording tasks to the optimal SRS service node, solving the problem of resource competition and quality decline in high-concurrent video call recording, and achieving more efficient resource utilization and stability.
Patent Information
- Application Number
- CN202510782615.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-08-15
AI Technical Summary
When realizing high-concurrent video call recording based on FreeSWITCH, there are problems such as serious system resource competition and degradation of call quality. Especially in multi-person meeting scenarios, FreeSWITCH needs to handle signaling processing, media stream synthesis and recording storage at the same time, resulting in resource bottlenecks and affecting the real-time and stability of calls.
The distributed video call recording method is adopted, and the SRS service nodes in the node state library are load balancing calculations, and the optimal SRS service node is selected for video stream forwarding. Combined with the judgment of communication fluency and the scoring enhancement algorithm based on the index change rate, the allocation of recording tasks is dynamically adjusted, and signaling processing and media recording tasks are decoupled to avoid resource competition.
It significantly reduces the resource load of FreeSWITCH, improves call quality and stability of recording tasks, enhances the robustness and scalability of the system, avoids recording failures and call interruptions, and improves resource utilization and scheduling accuracy.
Smart Images

Figure CN120499404A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image communication, and in particular to a distributed video call recording method and a video call recording device. Background Art
[0002] With the continuous development of audio and video communication technologies, IP-based voice and video call systems are widely used in scenarios such as remote work, video conferencing, online education, online customer service, and telemedicine. In these scenarios, users not only expect stable real-time audio and video communication, but also require audio and video recording of the call process to meet regulatory compliance, conduct audits, content backtracking, and data archiving requirements.
[0003] To build stable and scalable real-time communication systems, the open-source communication platform FreeSWITCH is often used. FreeSWITCH offers a variety of communication capabilities, including SIP (Session Initiation Protocol) signaling management, media routing, audio and video codecs, and a built-in MCU (Multipoint Control Unit). It is widely used for audio and video calls, session management, media control, call forwarding, and conference control. FreeSWITCH, through built-in modules such as mod_dptools, mod_av, and mod_conference, can record audio and video during calls and output them to the appropriate media file formats.
[0004] Although FreeSWITCH has built-in recording capabilities, the system is prone to excessive resource consumption in high-concurrency or multi-person video call recording scenarios. Specifically, because each video stream must be encoded and played back during the call for real-time display to the caller, and the recording process also requires simultaneous encoding, mixing, packaging, and writing to disk, as the number of concurrent calls increases, CPU utilization increases significantly, reducing overall system performance, which can lead to recording delays or severe degradation of call quality.
[0005] In addition, since FreeSWITCH's signaling control is highly coupled with media recording tasks, it needs to undertake signaling processing, media stream synthesis and recording storage at the same time, resulting in resource competition between different functions. That is, while FreeSWITCH encodes and decodes audio and video call streams and synthesizes media, it also needs to decode, cache and write recording tasks to the disk. This may cause FreeSWITCH to repeatedly occupy encoding and decoding resources during the transcoding, recording and other processing of the same call stream, which can easily cause resource bottlenecks on the client side. When resource bottlenecks occur, it is very easy to affect the real-time and stability of the call, and even lead to abnormal phenomena such as call interruption or frame loss.
[0006] In summary, when the existing technology implements high-concurrency video call recording based on FreeSWITCH, there are problems such as severe system resource competition and degraded call quality. Summary of the Invention
[0007] Based on this, the purpose of the present invention is to provide a distributed video call recording method.
[0008] A distributed video call recording method includes the following steps:
[0009] S1. Perform load balancing calculation on the status information of the SRS service node in the node status library to obtain the port of the current optimal SRS service node;
[0010] S2. Calculate the communication fluency of the port of the current optimal SRS service node to obtain the communication fluency of the current optimal SRS service node;
[0011] S3. Determine whether the communication fluency meets the forwarding conditions: if yes, execute step S4; if not, execute step S5;
[0012] S4. Forward the current video call stream to the port of the currently optimal SRS service node and generate the corresponding video file and playback address;
[0013] S5. Obtain the status information of all current SRS service nodes, update the node status library, obtain the updated node status library, and continue to execute step S1.
[0014] Compared with the existing technology, the distributed video call recording method described in the present invention decouples the recording tasks originally centrally processed by FreeSWITCH by introducing multiple distributed SRS service nodes, and forwards the video call path to the SRS service node for independent decoding and storage, thereby effectively separating the signaling processing and media recording tasks, significantly reducing the resource load of FreeSWITCH and improving call quality.
[0015] At the same time, by adopting the node status library, load balancing calculations are performed based on the status information of the SRS service node to ensure that the most suitable SRS service node is selected to allocate recording tasks, thereby avoiding node overload or uneven distribution problems, and effectively improving the recording task scheduling capabilities in high-concurrency call scenarios.
[0016] In addition, the present invention further calculates the communication fluency after the load balancing calculation to ensure the port stability of the selected node, avoids recording failures due to sudden network fluctuations or node failures, and thus enhances the robustness of the system.
[0017] Furthermore, the node status library is used to centrally store the status information of all SRS service nodes; the indicators of the status information of the SRS service nodes include CPU utilization, memory usage, network bandwidth throughput, number of executed tasks and disk write rate;
[0018] The load balancing calculation is to obtain the idle score of each SRS service node by normalizing the indicators of the status information and performing weighted summation, and to select the SRS service node with the lowest idle score as the current optimal SRS service node.
[0019] Accordingly, the present invention utilizes the indicators of status information corresponding to all SRS service nodes in the node status library, and performs normalization and weighted summation accordingly, so as to accurately measure the real-time resource load of each SRS service node, and dynamically selects the optimal node according to the comprehensive resource idleness of each SRS service node when allocating recording tasks, effectively avoiding resource misjudgment or scheduling imbalance caused by single indicator judgment, and effectively improving the stability of recording task execution of SRS service nodes.
[0020] Furthermore, the specific calculation of the idle score is as follows:
[0021]
[0022] In the formula, Score i represents the idle score of the i-th SRS service node; represents the normalized CPU utilization of the server corresponding to the i-th SRS service node; w cpu Indicates the weight of the CPU utilization indicator;
[0023] represents the normalized memory usage of the server corresponding to the i-th SRS service node; w mem Indicates the weight of the memory usage indicator;
[0024] represents the normalized disk write rate of the server corresponding to the i-th SRS service node; wdisk Indicates the weight of the disk write rate indicator;
[0025] represents the normalized network bandwidth throughput of the server corresponding to the i-th SRS service node; w net Indicates the weight of the network bandwidth throughput indicator.
[0026] Based on this, the present invention adopts CPU utilization, memory usage, disk write rate and network bandwidth throughput as key indicators for idle score calculation, combines normalization and static weight calculation, and establishes a unified and quantitative node scheduling basic evaluation to ensure the real-time performance of load balancing calculation.
[0027] Furthermore, after calculating the idle score, the method further includes: using a score enhancement algorithm based on an indicator change rate to adaptively enhance the idle score;
[0028] The scoring enhancement algorithm based on the indicator change rate is to calculate the set of change rates of CPU utilization, memory usage, disk write rate and network broadband throughput in the time dimension according to the node status library;
[0029] Next, a score enhancement coefficient function is used to match the set of change rates to obtain a corresponding score enhancement coefficient;
[0030] According to the score enhancement coefficient, the idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score.
[0031] Accordingly, the present invention adopts a scoring enhancement algorithm based on the indicator change rate to extract the resource usage change trend of each SRS service node from the node status library, identify the stage status of its current recording task, and match the scoring enhancement coefficient accordingly, and realize adaptive dynamic adjustment of the original idle score, so that the system not only considers the static occupancy of node resources when making scheduling decisions, but also has the ability to perceive the resource release rhythm and concurrency capabilities, and then judges the possibility of node reallocation in the stages of streaming and disk placement, which significantly improves resource utilization, task concurrent processing capabilities and the scheduling robustness of the overall system.
[0032] In another embodiment, before performing load balancing calculation on the status information of the SRS service nodes in the node status library, a prediction algorithm based on historical data is used to perform trend prediction on the status information of each SRS service node in the node status library to obtain indicators of the status information of the SRS service nodes within a certain period of time in the future;
[0033] After calculating the idle score, the set of change rates of CPU utilization, memory usage, disk write rate, and network broadband throughput in the time dimension is calculated based on the indicators of the node status library and the status information of the SRS service node in a certain period of time in the future. A score enhancement coefficient function is used to match the set of change rates to obtain the corresponding score enhancement coefficient;
[0034] According to the score enhancement coefficient, the actual idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score.
[0035] Based on this, the present invention combines a prediction algorithm based on historical data with a scoring enhancement algorithm based on the indicator change rate. It not only utilizes the current node status, but also introduces the computing resource change trend of the SRS service node in a certain period of time in the future, and performs forward-looking enhancement adjustments to the idle score of the SRS service node. It can thus perceive the upcoming load fluctuations or potential bottlenecks of the SRS service node in advance, and then avoid the corresponding SRS service node, thereby effectively improving the system's scheduling accuracy and recording task stability.
[0036] Furthermore, after the node status library is updated, the following steps are also included:
[0037] Determine whether there is still a video call recording request signal: if so, continue to return to step S1; if not, complete the recording process;
[0038] Among them, the video call recording request signal is a recording request signal triggered by user operation or external system after the user initiates a video call through the FreeSWITCH server. When the user or external system that initiates the recording request signal hangs up the video call or actively terminates the recording task, the recording request signal will be revoked.
[0039] Based on this, the present invention introduces a video call recording request signal as a control condition for the recording process, establishes a scheduling closed loop with user behavior or business system, ensures that the execution of the recording task is strictly controlled by user or business trigger events, and effectively improves the controllability of the recording process.
[0040] A distributed video call recording device, characterized by comprising a load balancing calculation unit, a communication fluency calculation unit, a communication fluency judgment unit, an SRS service node allocation unit, and an SRS service node load status update unit;
[0041] The load balancing calculation unit is used to perform load balancing calculation on the status information of the SRS service node in the node status library to obtain the port of the current optimal SRS service node;
[0042] The communication fluency calculation unit is used to calculate the fluency of the port of the current optimal SRS service node to obtain the communication fluency of the current optimal SRS service node;
[0043] The communication fluency determination unit is configured to determine whether the communication fluency meets the forwarding condition: if so, calling the SRS service node allocation unit; if not, calling the SRS service node load status update unit;
[0044] The SRS service node allocation unit is used to forward the current video call stream to the port of the currently optimal SRS service node and generate the corresponding video file and playback address;
[0045] The SRS service node load status updating unit is used to obtain the status information of all current SRS service nodes, update the node status library, obtain the updated node status library, and continue to call the load balancing calculation unit.
[0046] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is a simplified structural diagram of the distributed video call recording device according to the present invention;
[0048] Figure 2 The figure is a simplified flowchart of the distributed video call recording method according to the present invention. DETAILED DESCRIPTION
[0049] In order to solve the problems of severe system resource competition and degraded call quality when implementing high-concurrency video call recording based on FreeSWITCH in the existing technology, the present invention performs load balancing calculation on the status of each SRS service node in the node status library and obtains the port of the current optimal SRS service node; then, a secondary communication detection is performed on the port to evaluate its communication fluency, and based on this, it is judged whether it meets the video forwarding conditions: if so, the current video call is forwarded to the port of the current optimal SRS service node, so that its service node decodes and deeply corresponds to the video file and playback address, and obtains the load status of all current SRS service nodes, updates the node status library, and continues to perform load balancing calculation; if not, the load status of all current SRS service nodes is directly obtained, and the node status library is updated, and the load balancing calculation is continued.
[0050] Based on this, the present invention decouples the video recording task originally undertaken by FreeSWITCH by utilizing distributed SRS service nodes, thereby avoiding the impact of FreeSWITCH's heavy encoding and decoding and disk writing tasks on call quality, and significantly improving the stability and availability of the system in high-concurrency video communication scenarios.
[0051] In addition, by forwarding the video stream to a dedicated SRS streaming media server, which is responsible for recording, storing and generating playback addresses for high-concurrency video streams, the service-based separation of recording and processing is achieved, effectively improving the scalability and deployment flexibility of the system.
[0052] The present invention also performs preliminary load balancing calculations based on real-time load information from the node status database and further incorporates a port-level communication quality and fluency calculation mechanism to ensure that the ultimately selected recording nodes have good network connectivity and processing capabilities. This effectively improves the stability and accuracy of the video recording scheduling process, reduces the risk of node overload or recording failure, and enhances the overall video recording success rate and service quality.
[0053] Based on the above design, the present invention proposes a distributed video call recording method, and based on this method, proposes a distributed video call recording device.
[0054] Please also see Figure 1 and Figure 2 , Figure 1 This is a simplified structural diagram of the distributed video call recording device according to the present invention. Figure 2 The figure is a simplified flowchart of the distributed video call recording method according to the present invention.
[0055] The distributed video call recording device includes a load balancing calculation unit 1, a communication fluency calculation unit 2, a communication fluency judgment unit 3, an SRS service node allocation unit 4 and an SRS service node load status update unit 5.
[0056] The load balancing calculation unit 1 is configured to execute step S1: perform load balancing calculation on the status information of the SRS service node in the node status library to obtain the port of the current optimal SRS service node.
[0057] Generally speaking, SRS (Simple Realtime Server) is an open source, lightweight, efficient and real-time streaming media server. It is often used in scenarios such as live streaming, RTMP forwarding, HLS generation, and WebRTC interactive playback. It has the advantages of low latency, high compatibility, and flexible deployment. It is widely used in online video, online education, real-time live broadcast, video surveillance and other fields.
[0058] However, traditional SRS is primarily used for media stream transmission and distribution, and rarely directly applied to large-scale video stream recording and storage tasks. When users seek to implement high-concurrency video call recording using SRS, a single SRS node, by default, can only utilize a single CPU. This results in resource limits for direct recording tasks, making it difficult to process the required processing power for simultaneous recording of multiple high-resolution video channels.
[0059] To this end, in order to make full use of the basic functions provided by SRS, such as video stream access, encoding and decoding, and writing storage, the present invention constructs a distributed cluster of SRS service nodes, that is, multiple SRS instances are deployed as independent service nodes in multiple servers respectively. Each node independently takes on the audio and video streams forwarded from FreeSWITCH, and performs the corresponding decoding, recording and playback address generation tasks.
[0060] Specifically, the node status library is used to centrally store the status information of all SRS service nodes. Its initial data is obtained by polling or periodic reporting by each SRS service node by default; the indicators of the status information of the SRS service nodes include CPU utilization, memory usage, network broadband throughput, number of executed tasks and disk write rate.
[0061] The CPU utilization rate is used to characterize the computing resource consumption level generated by the current SRS service node when performing audio and video encoding and decoding or encapsulation processing tasks;
[0062] The memory usage is used to represent the actual occupancy of the frame buffer and buffer space;
[0063] The network bandwidth throughput is used to characterize the network transmission quality during the push or reception of audio and video streams;
[0064] The number of executed tasks is used to reflect the number of recording tasks currently being processed by the SRS service node, thereby measuring the concurrent processing pressure of the node;
[0065] The disk write rate is used to reflect the efficiency of writing recorded data to the disk. If there is any blockage, it will directly affect the stability and continuity of the recording task.
[0066] The load balancing calculation is to obtain the idle score of each SRS service node by normalizing the indicators of the status information and performing weighted summation, and to use the SRS service node with the lowest idle score as the current optimal SRS service node.
[0067] The specific calculation of the idle score is as follows:
[0068]
[0069] In the formula, Score i The idle score of the i-th SRS service node is used to indicate the idleness of the node. The lower the idle score, the lower the load of the SRS service node. represents the normalized CPU utilization of the server corresponding to the i-th SRS service node; w cpu Indicates the weight of the CPU utilization indicator, the default value is 0.4;
[0070] represents the normalized memory usage of the server corresponding to the i-th SRS service node; w mem Indicates the weight of the memory usage indicator, the default value is 0.2;
[0071] represents the normalized disk write rate of the server corresponding to the i-th SRS service node; w disk Indicates the weight of the disk write rate indicator, the default value is 0.2;
[0072] represents the normalized network bandwidth throughput of the server corresponding to the i-th SRS service node; w net Indicates the weight of the network bandwidth throughput indicator, the default value is 0.2.
[0073] Among them, the sum of the weights of all indicators must satisfy: ∑w j =1, and the weights of specific indicators can be flexibly adjusted according to actual conditions; the normalization adopts maximum-minimum normalization (Min-Max normalization), which is specifically expressed as follows:
[0074]
[0075] Where, represents the jth normalized index; X j represents the original value of the jth indicator; X j,min and X j,max Indicates the minimum and maximum values of the j-th indicator.
[0076] Based on this, the present invention performs weighted calculation on the usage of multi-dimensional resources such as CPU, memory, network, disk, etc. of each SRS service node to accurately evaluate the resource idleness and load capacity of each node, thereby dynamically selecting the node that is currently most suitable for the recording task among multiple nodes, avoiding the problems of recording failure, call quality degradation or system freeze caused by overload of a single node.
[0077] In actual deployment environments, the server corresponding to the SRS service node often takes on multiple recording tasks simultaneously, that is, the number of tasks executed is greater than 1. Each recording task will have different load impacts on server resources (CPU, memory, network, disk, etc.) depending on its stage, such as streaming and disk storage.
[0078] For example, when a recording task enters the disk write phase, the disk write rate increases significantly, but CPU and network resource usage is relatively low. If a new video streaming task is pushed in during this phase, the system can primarily process it through the memory cache, without immediately triggering a serious resource conflict. Therefore, from a resource scheduling perspective, even if a recording task is active, the server still has some idle resources and can continue to accept new tasks.
[0079] However, the original statically configured weights were difficult to adjust accurately according to the dynamic stage of the actual task, resulting in a conservative system scheduling strategy and low resource utilization. This led to the phenomenon that "the computing resources of some servers are relatively idle but cannot be scheduled", limiting the system's flexible scheduling capabilities in high-concurrency scenarios.
[0080] To this end, the present invention further adopts a scoring enhancement algorithm based on the indicator change rate to adaptively enhance the idle score, thereby achieving more accurate resource scheduling and effectively improving resource utilization.
[0081] The score enhancement algorithm based on the indicator change rate is to calculate the change rate set of CPU utilization, memory usage, disk write rate and network broadband throughput in the time dimension according to the node status library, and use a score enhancement coefficient function to match the change rate set to obtain the corresponding score enhancement coefficient; according to the score enhancement coefficient, the idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score. The specific calculation example is shown as follows:
[0082] Score i =Score i ×F(state i )
[0083] Where Score′ i Indicates the idle score of the i-th SRS service node after enhancement; state i is the set of change rates of the state information of the server corresponding to the i-th SRS service node, which is specifically expressed as follows:
[0084] state i ={ΔCPU i ,ΔMEM i,ΔDISK i ,ΔNET i}
[0085] Where, ΔCPU i The CPU utilization rate of the i-th SRS service node is represented by the rate of change. It is obtained by differentiating the CPU utilization in the node status database using a sliding window, thus representing the change in CPU utilization over a period of time.
[0086] ΔMEM i It represents the rate of change of the memory usage corresponding to the i-th SRS service node, which is obtained by differentiating the memory usage in the node status library through a sliding window;
[0087] ΔDISK i It represents the rate of change of the disk write rate corresponding to the i-th SRS service node, which is obtained by differentiating the disk write rate in the node status library through a sliding window;
[0088] ΔNET i It represents the rate of change of the network broadband throughput corresponding to the i-th SRS service node, which is obtained by differentiating the network broadband throughput in the node status library through a sliding window;
[0089] F(·) represents the score enhancement coefficient function, which is used to characterize the resource usage change trend of the SRS service node in different recording stages. The corresponding score enhancement coefficient is obtained by matching the change rate set to different recording stages. The recording stages include the streaming stage, the recording storage stage, and the storage blocking stage. The specific matching calculation of the score enhancement coefficient is expressed as follows:
[0090]
[0091] The streaming phase indicates that the server is currently decoding the video call stream, causing an increase in the rate of change of CPU utilization, network bandwidth throughput, and memory usage, while the rate of change of the disk write rate is low or remains unchanged. The specific judgment expression is as follows:
[0092] ifΔCPU i ∈highandΔNET i ∈highandΔMEM i ∈-lowandΔDISK i ∈-low,
[0093] Then the push stage
[0094] In the formula, high means faster change, and its value range defaults to [0.4, 1]; low means slower change, and its value range defaults to [0, 0.6].
[0095] The recording disk phase indicates that the server has completed decoding the video call stream and is packaging and saving the recorded data in the memory to disk. This causes a significant increase in the disk write rate, an increase in the rate of change of CPU utilization, a decrease in the rate of change of memory usage, and a constant or decreasing rate of change of network broadband throughput. The specific judgment expression is as follows:
[0096] ifΔCPU i ∈lowandΔNET i ∈-lowandΔMEM i ∈-lowandΔDISK i ∈high,
[0097] Then record the disk stage
[0098] The disk write blocking phase indicates that the server is currently writing to disk, but there is a write block phenomenon, resulting in a significant increase in the rate of change of memory usage and disk write rate, an increase in the rate of change of CPU utilization, and a constant or decreasing rate of change of network broadband throughput. The specific judgment expression is as follows:
[0099] ifΔCPU i ∈lowandΔNET i ∈-lowandΔMEM i ∈highandΔDISK i ∈high,
[0100] Then the disk blocking stage
[0101] Accordingly, the present invention uses a scoring enhancement algorithm based on the indicator change rate to identify the stage of the recording task according to the dynamic change rate of each resource indicator, and adaptively adjusts the idle score accordingly, thereby realizing the implicit perception capability of the recording task status, so that the system can adjust the scoring strategy according to the dynamic behavior of the node task during the resource scheduling process, thereby effectively avoiding problems such as recording freeze, task failure or resource waste, and further improving the system's stability and resource utilization efficiency in high-concurrency video call recording scenarios.
[0102] Because there is a certain dynamic coupling relationship between various resource indicators (such as CPU, memory, disk, and network) at different stages of the recording task, especially in states such as task streaming, cache storage, and blocking, they exhibit certain linear trends or stage characteristics.
[0103] Therefore, by further introducing a prediction algorithm based on historical data, we can predict the resource change trend of the SRS service node in the short term in the future, thereby achieving early avoidance of potential resource bottlenecks, forward-looking optimization of scheduling strategies, and improving the overall recording consistency and task scheduling stability of the system.
[0104] In one embodiment, before performing load balancing calculation on the status information of the SRS service nodes in the node status library, a prediction algorithm based on historical data is used to perform trend prediction on the status information of each SRS service node in the node status library to obtain indicators of the status information of the SRS service nodes within a certain period of time in the future.
[0105] The specific calculation of the prediction algorithm based on historical data is as follows:
[0106]
[0107] Where, The indicator matrix representing the state information of the i-th SRS service node at the future time t+Δt is the prediction indicator matrix, specifically The default value of Δt is 1 time step, which is the time interval for updating the node status library;
[0108] The indicator matrix representing the state information of the i-th SRS service node from time tk to time t is a real indicator matrix with a dimension of (k+1)×4. k defaults to 10 time steps. The specific representation of the real indicator matrix is as follows:
[0109]
[0110] ∈ is the error term, usually Gaussian noise, which is generally obtained by automatically minimizing the fitting during the training process; β is the coefficient matrix obtained by modeling the historical data of the node state library. β is a two-dimensional matrix of ((k+1)×4)×4, which is the coefficient matrix of the multi-output linear regression model. It is obtained by training and modeling in the following steps:
[0111] Extract input-output data pairs at multiple consecutive moments from the node state library and construct a set of multiple training samples. The specific representation of the set is as follows:
[0112]
[0113] Where n represents the total number of input-output data pairs; The input indicator matrix representing the status information of group j has a dimension of (k+1)×4; The output indicator matrix representing the status information of the jth group has a dimension of 1×4.
[0114] The least squares method is used to fit the coefficient matrix of multiple sets of training samples to obtain the optimal coefficient matrix and complete the modeling of historical data. The solution goal of the least squares method is:
[0115]
[0116] Where, β best is the optimal coefficient matrix.
[0117] Based on this, when the training model is completed, the current and historical indicators can be used to construct the prediction input, and combined with the optimal coefficient matrix, the prediction indicator matrix can be calculated for further scoring enhancement calculation and scheduling optimization.
[0118] It should be noted that in order to ensure the dimensional consistency of matrix multiplication, the input index matrix needs to be Perform a matrix transformation (e.g., expand it into a one-dimensional vector by row) to ensure that its dimensions match the coefficient matrix β, thereby obtaining a structurally consistent output prediction indicator matrix. Since users can adjust the length k of the historical window and the number of indicator types (other resource monitoring indicators besides the current indicator type) based on business needs, this invention does not specifically limit the fixed form of its input dimensions and the vectorization method. It only needs to ensure that the matrix dimensions remain consistent during training, modeling, and predictive reasoning.
[0119] Next, the indicators of the current status information of each SRS service node in the node status library are normalized and weighted summed to obtain the actual idle score of each SRS service node.
[0120] The actual idle score is an idle score calculated based on indicators of current real status information, rather than indicators based on historical or predicted status information, thereby ensuring that the basic idle score is based on real and effective indicators.
[0121] Finally, based on the indicators of the node status library and the status information of the SRS service node in a certain period of time in the future, the change rate set of CPU utilization, memory usage, disk write rate and network broadband throughput in the time dimension is calculated, and the score enhancement coefficient function is used to match the change rate set to obtain the corresponding score enhancement coefficient; according to the score enhancement coefficient, the actual idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score.
[0122] Accordingly, the present invention introduces a prediction algorithm based on historical data. By using the current and historical data in the node status library, it models and predicts resource change trends in the short term. Combined with a scoring enhancement algorithm based on the indicator change rate, this method achieves forward-looking adjustments to idle scores. Compared to scheduling methods based solely on current status, this combined "historical and current-future" trend modeling allows for proactive avoidance of impending overload or congestion, as well as preemptive selection of service nodes about to release resources. This effectively improves the accuracy and robustness of task allocation, further enhancing the system's video recording stability and resource scheduling efficiency in high-concurrency environments.
[0123] The communication fluency calculation unit 2 is configured to execute step S2: performing fluency calculation on the port of the current optimal SRS service node to obtain the communication fluency of the current optimal SRS service node.
[0124] Specifically, the communication fluency is used to characterize the communication quality between the current SRS service node and the server where FreeSWITCH is located, and reflects whether the current SRS service node has the ability to stably undertake streaming tasks.
[0125] The fluency is calculated by sending a short-term connection request to the SRS service node's port (default is 1935) and recording its response time and success rate. The response time is then normalized and weighted summed with the success rate to provide the communication fluency. The short-term connection request can be a TCP probe packet, an ICMP echo request, or other custom low-load handshake probe frame. It only needs to be able to measure response time and determine connection success to support communication quality assessment. The specific implementation is not specifically limited in this invention.
[0126] The communication fluency determination unit 3 is used to execute step S3: determine whether the communication fluency meets the forwarding condition: if so, call the SRS service node allocation unit 4; if not, call the SRS service node load status update unit 5.
[0127] Specifically, the forwarding condition is determined as follows:
[0128]
[0129] Where, Flu is the communication fluency; th flu It is a forwarding condition, which is used to indicate a preset communication quality forwarding threshold. It is usually preset according to the network environment of the SRS server, and its recommended value is 0.8.
[0130] The SRS service node allocation unit 4 is configured to execute step S4: forwarding the current video call stream to the port of the currently optimal SRS service node, and generating a corresponding video file and playback address.
[0131] Specifically, the video call stream is a real-time audio and video mixed data stream generated by the FreeSWITCH server during the call, which is specifically generated by the MCU module in FreeSWITCH through encapsulation and synthesis processing based on RTMP, WebRTC or other standard audio and video transmission protocols.
[0132] The current video call stream is pushed to the port of the current optimal SRS service node through the corresponding standard audio and video transmission protocol.
[0133] When the currently optimal SRS service node receives the video call stream, it decodes the video call stream and extracts the audio and video tracks in the video call stream.
[0134] Then, the audio and video tracks are packaged according to a preset media packaging format and written to the server's local disk or distributed storage system to obtain a media file. The media packaging format includes MP4, FLV, or TS, etc. The user can choose the corresponding media packaging format according to their actual situation.
[0135] Finally, the playback address of the video file, such as a URL, is generated based on the storage path and access configuration of the media file.
[0136] The playback address can be generated as a static URL through recording path mapping, or automatically generated through a Web service (such as an HTTP file server) configured in an SRS service node for on-demand playback or retrieval by a backend management system.
[0137] Based on this, the present invention achieves complete decoupling of FreeSWITCH call media processing and recording processing by forwarding audio and video streams to the optimal SRS node in real time to perform recording tasks, avoiding the FreeSWITCH server resources being occupied by media encoding and decoding and storage operations, thereby significantly improving the system's scalability and call stability, and supporting the horizontal deployment of more SRS nodes to meet high concurrent recording needs.
[0138] The SRS service node load status updating unit 5 is configured to execute step S5: acquiring status information of all current SRS service nodes, and updating a node status library to obtain an updated node status library.
[0139] Furthermore, after the node status library is updated, it is determined whether there is still a video call recording request signal: if so, the process returns to step S1; if not, it indicates that the current call session has ended or the user has terminated the recording request, completing the recording process.
[0140] Among them, the video call recording request signal refers to a recording request signal triggered by user operation or external system after the user initiates a video call through the FreeSWITCH server. When the user or external system that initiates the recording request signal hangs up the call or actively terminates the recording task, the signal will be revoked, and it is judged that the recording task should be stopped based on this.
[0141] In one embodiment, in addition to updating the FreeSWITCH video call stream after pushing it to the corresponding SRS service node, the node status library is also updated at a fixed period to ensure that the status information of the SRS service node stored in the node status library remains up to date, preventing outdated status information from causing incorrect allocation of recording tasks.
[0142] The fixed period can be set to a time interval of not less than 5 seconds, so that the status information of all SRS service nodes is continuously and actively acquired during the period, and the node status library is updated accordingly to ensure that the status data based on which the scheduling decision is based is always in the latest state.
[0143] Accordingly, the present invention realizes the dynamic linkage between call status and resource scheduling by introducing a periodic status update and an exit judgment mechanism of the call recording request signal, thereby effectively improving the scheduling accuracy and resource release efficiency of the system.
[0144] Compared to existing technologies, this invention decouples recording tasks from FreeSWITCH signaling management and media recording tasks by introducing distributed SRS service nodes, effectively avoiding resource contention, call freezes, or call interruptions. Furthermore, a node status database centrally collects status information indicators for each SRS service node and calculates the corresponding idle score based on these indicators. This allows for dynamic allocation of recording tasks to the optimal SRS service node, ensuring more balanced resource scheduling and avoiding system bottlenecks caused by overloading a single SRS service node.
[0145] At the same time, after preliminarily selecting the optimal SRS service node, the present invention also calculates the communication fluency of the SRS service node to ensure that it is not only in a resource-free state but also has good network transmission capabilities, thereby effectively reducing the risk of streaming failure caused by short-term link fluctuations.
[0146] On this basis, the present invention introduces a scoring enhancement algorithm based on the indicator change rate, so as to realize the perception of the current recording stage of the SRS service node and dynamically adjust its idle score accordingly, further improving the accuracy of resource evaluation, realizing the reuse capability of some idle resources, and thus maximizing the node resource utilization.
[0147] In addition, the present invention combines a prediction model based on historical data to perform a linear prediction of the node indicator change trend in a certain period of time in the future, and identifies forward-looking recording stages based on the prediction results, thereby avoiding potential blocked SRS service nodes or performance bottlenecks in advance during scheduling, effectively improving the system's video recording stability and resource scheduling efficiency in a high-concurrency environment.
[0148] Based on the same inventive concept, the present application also provides an electronic device, which can be a terminal device such as a server, desktop computing device, or mobile computing device (e.g., laptop computing device, handheld computing device, tablet computer, netbook, etc.). The device includes one or more processors and a memory, wherein the processor is configured to execute a program to implement the distributed video call recording method according to an embodiment of the present invention; and the memory is configured to store a computer program executable by the processor.
[0149] Based on the same inventive concept, the present application also provides a computer-readable storage medium, corresponding to the embodiment of the aforementioned distributed video call recording method, wherein the computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the distributed video call recording method recorded in any of the aforementioned embodiments.
[0150] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. The information can be computer-readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0151] The above-described embodiments merely represent several implementations of the present invention. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous modifications and improvements without departing from the spirit of the present invention, and the present invention is intended to encompass such modifications and variations.
Claims
1. A distributed video call recording method, characterized in that: The following steps are involved: S1. Perform load balancing calculation on the status information of the SRS service node in the node status library to obtain the port of the current optimal SRS service node; S2. Calculate the communication fluency of the port of the current optimal SRS service node to obtain the communication fluency of the current optimal SRS service node; S3. Determine whether the communication fluency meets the forwarding conditions: if yes, execute step S4; if not, execute step S5; S4. Forward the current video call stream to the port of the currently optimal SRS service node and generate the corresponding video file and playback address; S5. Obtain the status information of all current SRS service nodes, update the node status library, obtain the updated node status library, and continue to execute step S1.
2. The distributed video call recording method according to claim 1, characterized in that: The node status library is used to centrally store the status information of all SRS service nodes; the indicators of the status information of the SRS service nodes include CPU utilization, memory usage, network bandwidth throughput, number of executed tasks and disk write rate; The load balancing calculation is to obtain the idle score of each SRS service node by normalizing the indicators of the status information and performing weighted summation, and to select the SRS service node with the lowest idle score as the current optimal SRS service node.
3. The distributed video call recording method according to claim 2, characterized in that: The specific calculation of the idle score is as follows: In the formula, Score i represents the idle score of the i-th SRS service node; represents the normalized CPU utilization of the server corresponding to the i-th SRS service node; w cpu Indicates the weight of the CPU utilization indicator; represents the normalized memory usage of the server corresponding to the i-th SRS service node; w mem Indicates the weight of the memory usage indicator; Indicates the normalized disk write rate of the server corresponding to the i-th SRS service node; w disk Indicates the weight of the disk write rate indicator; represents the normalized network bandwidth throughput of the server corresponding to the i-th SRS service node; w net Indicates the weight of the network bandwidth throughput indicator.
4. The distributed video call recording method according to claim 3, characterized in that: After calculating the idle score, the method further includes: using a score enhancement algorithm based on an indicator change rate to adaptively enhance the idle score; The scoring enhancement algorithm based on the indicator change rate is to calculate the set of change rates of CPU utilization, memory usage, disk write rate and network broadband throughput in the time dimension according to the node status library; Next, a score enhancement coefficient function is used to match the set of change rates to obtain a corresponding score enhancement coefficient; According to the score enhancement coefficient, the idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score.
5. The distributed video call recording method according to claim 3, characterized in that: Before performing load balancing calculations on the status information of the SRS service nodes in the node status library, a prediction algorithm based on historical data is used to perform trend prediction on the status information of each SRS service node in the node status library to obtain indicators of the status information of the SRS service nodes within a certain period of time in the future; After calculating the idle score, the set of change rates of CPU utilization, memory usage, disk write rate, and network broadband throughput in the time dimension is calculated based on the indicators of the node status library and the status information of the SRS service node in a certain period of time in the future. A score enhancement coefficient function is used to match the set of change rates to obtain the corresponding score enhancement coefficient; According to the score enhancement coefficient, the actual idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score.
6. The distributed video call recording method according to any one of claims 1 to 5, characterized in that: After updating the node status library, the following steps are also included: Determine whether there is still a video call recording request signal: if so, continue to return to step S1; if not, complete the recording process; Among them, the video call recording request signal is a recording request signal triggered by user operation or external system after the user initiates a video call through the FreeSWITCH server. When the user or external system that initiates the recording request signal hangs up the video call or actively terminates the recording task, the recording request signal will be revoked.
7. A distributed video call recording device, characterized in that: It includes a load balancing calculation unit, a communication fluency calculation unit, a communication fluency judgment unit, an SRS service node allocation unit and an SRS service node load status update unit; The load balancing calculation unit is used to perform load balancing calculation on the status information of the SRS service node in the node status library to obtain the port of the current optimal SRS service node; The communication fluency calculation unit is used to calculate the fluency of the port of the current optimal SRS service node to obtain the communication fluency of the current optimal SRS service node; The communication fluency determination unit is configured to determine whether the communication fluency meets the forwarding condition: if so, calling the SRS service node allocation unit; if not, calling the SRS service node load status update unit; The SRS service node allocation unit is used to forward the current video call stream to the port of the currently optimal SRS service node and generate the corresponding video file and playback address; The SRS service node load status updating unit is used to obtain the status information of all current SRS service nodes, update the node status library, obtain the updated node status library, and continue to call the load balancing calculation unit.
8. The distributed video call recording device according to claim 7, characterized in that: The node status library is used to centrally store the status information of all SRS service nodes; the indicators of the status information of the SRS service nodes include CPU utilization, memory usage, network bandwidth throughput, number of executed tasks and disk write rate; The load balancing calculation is to obtain the idle score of each SRS service node by normalizing the indicators of the status information and performing weighted summation, and then taking the SRS service node with the lowest idle score as the current optimal SRS service node. The specific calculation of the idle score is as follows: In the formula, Score i represents the idle score of the i-th SRS service node; represents the normalized CPU utilization of the server corresponding to the i-th SRS service node; w cpu Indicates the weight of the CPU utilization indicator; represents the normalized memory usage of the server corresponding to the i-th SRS service node; w mem Indicates the weight of the memory usage indicator; represents the normalized disk write rate of the server corresponding to the i-th SRS service node; w disk Indicates the weight of the disk write rate indicator; represents the normalized network bandwidth throughput of the server corresponding to the i-th SRS service node; w net Indicates the weight of the network bandwidth throughput indicator.
9. The distributed video call recording device according to claim 8, characterized in that: After calculating the idle score, the method further includes: using a score enhancement algorithm based on an indicator change rate to adaptively enhance the idle score; The scoring enhancement algorithm based on the indicator change rate is to calculate the set of change rates of CPU utilization, memory usage, disk write rate and network broadband throughput in the time dimension according to the node status library; Next, a score enhancement coefficient function is used to match the set of change rates to obtain a corresponding score enhancement coefficient; The recording phase includes the streaming phase, the recording and disk-drop phase, and the disk-drop blocking phase. According to the score enhancement coefficient, the idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score.
10. The distributed video call recording device according to claim 8, characterized in that: Before performing load balancing calculations on the status information of the SRS service nodes in the node status library, a prediction algorithm based on historical data is used to perform trend prediction on the status information of each SRS service node in the node status library to obtain indicators of the status information of the SRS service nodes within a certain period of time in the future; After calculating the idle score, the set of change rates of CPU utilization, memory usage, disk write rate, and network broadband throughput in the time dimension is calculated based on the indicators of the node status library and the status information of the SRS service node in a certain period of time in the future. A score enhancement coefficient function is used to match the set of change rates to obtain the corresponding score enhancement coefficient; According to the score enhancement coefficient, the actual idle score of each current SRS service node is adaptively enhanced to obtain the enhanced idle score of each SRS service node and replace the original idle score.