A method and apparatus for recording calls based on dual-track audio stream separation
By using a dual-track audio stream separation method, audio frame data from the user sender and receiver is acquired, aligned, and merged. After being encrypted in the user-mode aggregation buffer, the data is written to disk, which solves the problems of audio loss and file incompleteness when an IP dedicated switch carries hundreds of concurrent call recordings, thus improving the security of the recording data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN XINGZONG DIGITAL TECH CO LTD
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies suffer from audio frame loss and incomplete recording files when IP dedicated switches handle hundreds of concurrent call recordings. Furthermore, they cannot distinguish the voice content of the two parties in the call, resulting in insufficient security of the recording data.
The method adopts a dual-track audio stream separation approach to obtain audio frame data from the user sender and receiver. After batch alignment, merging, and encryption processing through a user-mode aggregation buffer, the data is written to the disk, avoiding the existing technology's mode of writing to the disk once for each received frame.
It effectively avoids audio frame loss and incomplete recording files, improves the security of recording data, and ensures that the recording data is not leaked.
Smart Images

Figure CN122137912A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a call recording method and apparatus based on dual-track audio stream separation. Background Technology
[0002] Call recording is the act of recording and saving the conversation between two parties during a telephone call using technical means. Currently, call recording can be achieved through IP Private Branch Exchanges (IP PBXs). Specifically, IP switches transmit voice over a network, and their recording function is usually directly integrated into the system software. The system uses "port mirroring" technology or software modules to directly copy the voice data packets from the network and send them to disk for storage.
[0003] However, existing recording technology employs a "write to disk once per frame received" model, meaning that the file is immediately written to disk after every 20 milliseconds of audio frame arrival, and single-channel plaintext recording is performed using a mixed audio stream from both the sender and receiver. Therefore, when a dedicated IP switch handles hundreds of concurrent call recordings, not only are there issues with audio frame loss and incomplete recording files, but the individual voice content of the two parties in the call cannot be distinguished. Summary of the Invention
[0004] This invention provides a call recording method and apparatus based on dual-track audio stream separation. This method acquires the first audio frame data from the sender and the second audio frame data from the receiver, avoiding the problem in existing technologies where recording is done using a mixed audio stream from both the sender and receiver, making it impossible to distinguish the individual voice content of each party. Furthermore, by using a user-mode aggregation buffer to batch align and merge the first and second audio frame data before writing them to disk for recording, it avoids the "write to disk once for each received frame" mode used in existing technologies. This solves the problem of audio frame loss and incomplete recording files when an IP dedicated switch handles hundreds of concurrent call recordings. Moreover, the encryption processing of the merged stereo audio frame data improves the security of the recorded data storage, preventing data leakage.
[0005] To achieve the above objectives, in a first aspect, embodiments of the present invention provide a call recording method based on dual-track audio stream separation, comprising:
[0006] In response to the user's input recording command, the system acquires the first audio frame data from the user's sender and the second audio frame data from the user's receiver. The system iteratively saves the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer. It then performs alignment and merging processing on the first and second audio frame data to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer. This process continues until the recording ends. The first buffer size of the first user-mode temporary buffer and the second buffer size of the second user-mode temporary buffer are the same. The third buffer size of the user-mode aggregation buffer is determined based on the first and second buffer sizes. After the merged stereo audio frame data is saved to the user-mode aggregation buffer, the merged stereo audio frame data in the user-mode aggregation buffer is encrypted and written to the disk for recording in a loop until the recording ends.
[0007] In one embodiment, the third cache size of the user-space aggregation buffer is determined based on the first cache size and the second cache size, including: The size of the third cache space is determined by summing the sizes of the first and second cache spaces.
[0008] In one embodiment, the calling channel corresponding to the user sender and the called channel corresponding to the user receiver are respectively equipped with audio hooks, and the audio hooks are equipped with recording flags. The recording flags are used to trigger the start of recording operation or the end of recording operation.
[0009] In one embodiment, the iterative process of saving the first audio frame data to a first user-space temporary buffer and the second audio frame data to a second user-space temporary buffer, followed by alignment and merging of the first and second audio frame data to obtain dual-channel merged stereo audio frame data, is then saved to a user-space aggregation buffer until recording ends. This includes: The first audio frame data is saved to the first user-mode temporary buffer, and the second audio frame data is saved to the second user-mode temporary buffer; When the first remaining buffer size of the first user-mode temporary buffer and the second remaining buffer size of the second user-mode temporary buffer are both 0, the first audio frame data and the second audio frame data are aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer. After saving the merged stereo audio frame data to the user-mode aggregation buffer, the saved first and second audio frame data in the current first and second user-mode temporary buffers are discarded, and the process returns to saving the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer until the recording ends.
[0010] In one embodiment, the step of aligning and merging the first audio frame data and the second audio frame data to obtain dual-channel merged stereo audio frame data includes: Detect whether the first data length of the first audio frame data and the second data length of the second audio frame data are aligned; If not, perform all-zero audio frame alignment processing on the first audio frame data and the second audio frame data; Based on the audio data sampling points, the aligned first audio frame data and the second audio frame data are merged to obtain the merged stereo audio frame data.
[0011] In one embodiment, the step of iteratively encrypting and writing the merged stereo audio frame data in the user-mode aggregation buffer to the disk for recording after saving the merged stereo audio frame data to the user-mode aggregation buffer until the recording ends includes: After the merged stereo audio frame data is saved to the user-mode aggregation buffer, if the remaining buffer space of the current user-mode aggregation buffer is smaller than the size of the merged stereo audio frame data, the merged stereo audio frame data in the current user-mode aggregation buffer is encrypted and written to the disk. After encrypting the merged stereo audio frame data in the current user-mode aggregation buffer and writing it to the disk, the merged stereo audio frame data in the current user-mode aggregation buffer is discarded, and the process returns to saving the merged stereo audio frame data to the user-mode aggregation buffer until the recording ends.
[0012] In one embodiment, encrypting the merged stereo audio frame data of the current user-mode aggregation buffer includes: The merged stereo audio frame data is encrypted based on the position indices corresponding to the first and second audio frame data, respectively, and a preset original key seed.
[0013] In one embodiment, the step of encrypting the merged stereo audio frame data based on the position indices corresponding to the first audio frame data and the second audio frame data, respectively, and a preset original key seed, includes: The perturbation factor is obtained based on the position indices corresponding to the first audio frame data and the second audio frame data, respectively. The merged stereo audio frame data is encrypted based on the perturbation factor and the preset original key seed.
[0014] In one embodiment, the method further includes: When the merged stereo audio frame data is encrypted and written to the disk for recording, the recording operation ends if an error code is received.
[0015] Secondly, embodiments of the present invention provide a call recording device based on dual-track audio stream separation, comprising: The audio frame data acquisition module is used to respond to the recording command input by the user and acquire the first audio frame data from the user sender and the second audio frame data from the user receiver. The stereo audio frame data acquisition module is used to iteratively save the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer. The first audio frame data and the second audio frame data are aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer until the recording ends. The first buffer size of the first user-mode temporary buffer and the second buffer size of the second user-mode temporary buffer are the same. The third buffer size of the user-mode aggregation buffer is determined based on the first buffer size and the second buffer size. The recording module is used to iteratively encrypt the merged stereo audio frame data in the user-mode aggregation buffer and write it to the disk for recording after saving the merged stereo audio frame data to the user-mode aggregation buffer, until the recording ends.
[0016] The above technical solution has the following technical effects: Thus, the call recording method based on dual-track audio stream separation provided in this embodiment obtains the first audio frame data from the sender and the second audio frame data from the receiver in response to the user's input recording command. Iteratively, the first audio frame data is saved to a first user-mode temporary buffer, and the second audio frame data is saved to a second user-mode temporary buffer. The first and second audio frame data are then aligned and merged to obtain dual-channel merged stereo audio frame data, which is saved to a user-mode aggregation buffer until recording ends. The first buffer size of the first user-mode temporary buffer and the second buffer size of the second user-mode temporary buffer are the same, and the third buffer size of the user-mode aggregation buffer is determined based on the first and second buffer sizes. After saving the merged stereo audio frame data to the user-mode aggregation buffer, the merged stereo audio frame data in the user-mode aggregation buffer is iteratively encrypted and written to disk for recording until recording ends. This method enables the acquisition of the first audio frame data from the sender and the second audio frame data from the receiver, avoiding the problem in existing technologies that record mixed audio streams from both the sender and receiver, making it impossible to distinguish the individual voice content of each party in the call. Furthermore, by using a user-mode aggregation buffer to batch align and merge the first and second audio frame data before writing them to disk for recording, it avoids the "write to disk once for each received frame" mode used in existing technologies. This solves the problem of audio frame loss and incomplete recording files when a dedicated IP switch handles hundreds of concurrent call recordings. Moreover, the encryption of the merged stereo audio frame data improves the security of the recorded data storage, preventing data leakage. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating a call recording method based on dual-track audio stream separation according to an embodiment of the present invention. Figure 2 This is a schematic diagram of a call recording device based on dual-track audio stream separation, provided in an embodiment of the present invention. Detailed Implementation
[0018] To further illustrate the various embodiments, the present invention provides accompanying drawings. These drawings are part of the disclosure of the present invention, primarily used to illustrate the embodiments and to explain the operating principles of the embodiments in conjunction with the relevant descriptions in the specification. With reference to these drawings, those skilled in the art should be able to understand other possible implementations and the advantages of the present invention. Components in the drawings are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0019] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments.
[0020] Example 1: Figure 1 This is a flowchart illustrating a call recording method based on dual-track audio stream separation according to an embodiment of the present invention. This embodiment specifically includes the following steps: S10: Respond to the user's input recording command, obtain the first audio frame data from the user's sender, and the second audio frame data from the user's receiver.
[0021] The recording command is used to instruct the start of the recording operation. It should be noted that the recording command carries identification information for the first audio frame data from the sender and the second audio frame data from the receiver, such as channel name, file name, and flag bits. However, this is not a limitation; this embodiment is not specifically restrictive, and those skilled in the art can set it according to actual conditions.
[0022] Specifically, when a user inputs a recording command, the system responds to the recording command by acquiring the first audio frame data of the user sending the call and the second audio frame data of the user receiving the call.
[0023] For example, in this embodiment, the first audio frame data of the user sender and the second audio frame data of the user receiver are obtained simultaneously through the audio hook framework layer of the IP dedicated switch and through the first audio frame and second audio frame reading interfaces. However, this is not limited to this. This embodiment is not specifically limited, and those skilled in the art can set it according to the actual situation.
[0024] It should be noted that the first audio frame data and the second audio frame data carry metadata such as the number of audio frame data samples, frame type and subclass codec identifier. This metadata is used for subsequent audio frame data transcoding operations between the user sender and the user receiver.
[0025] Optionally, based on the above embodiments, in some embodiments of the present invention, audio hooks are respectively set for the calling channel corresponding to the user sender and the called channel of the user receiver. The audio hooks are set with recording flags, which are used to trigger the start of recording operation or the end of recording operation.
[0026] For example, in this embodiment, a Boolean recording flag is set on the audio hook object. When an external management interface or bridging feature code triggers a start recording operation, the recording flag is directly set to false; or when the recording operation ends, the recording flag is directly set to true. However, this is not a limitation, and this embodiment is not specifically restrictive. Those skilled in the art can set it according to actual conditions.
[0027] Thus, this embodiment achieves zero-lock switching by setting a boolean recording flag on the audio hook object, without acquiring any channel-level or bridge-level exclusive control locks, touching the file system handle, or modifying the audio hook's state machine when performing start or end recording operations. This avoids the problem in existing technologies where acquiring global exclusive control locks for the calling and called channels during start or end recording operations leads to severe lock contention with the call signaling processing thread in high-concurrency scenarios, resulting in signaling processing latency jitter of tens of milliseconds.
[0028] S11: Iteratively save the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer. Align and merge the first and second audio frame data to obtain dual-channel merged stereo audio frame data, and save it to the user-mode aggregation buffer until the recording ends.
[0029] In this embodiment, the first cache size of the first user-mode temporary buffer and the second cache size of the second user-mode temporary buffer are the same, and the third cache size of the user-mode aggregate buffer is determined based on the first cache size and the second cache size. For example, the first cache size and the second cache size can be 32KB, but are not limited thereto. This embodiment is not specifically limited, and those skilled in the art can set them according to actual conditions.
[0030] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of determining the third cache space size of the user-space aggregation buffer based on the first cache space size and the second cache space size may be: The size of the third cache space is determined by summing the sizes of the first and second cache spaces.
[0031] For example, following the above embodiments, the size of the first cache space and the size of the second cache space can be 32KB, and the size of the third cache space can be 64KB, but it is not limited thereto. This embodiment is not specifically limited, and those skilled in the art can set it according to the actual situation.
[0032] Specifically, after obtaining the first audio frame data from the user sender and the second audio frame data from the user receiver, the system iteratively saves the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer. The first and second audio frame data are then aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer until the recording ends.
[0033] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of S11 may be: S111: Save the first audio frame data to the first user-mode temporary buffer, and save the second audio frame data to the second user-mode temporary buffer.
[0034] S112: When the first remaining buffer size of the first user-mode temporary buffer and the second remaining buffer size of the second user-mode temporary buffer are both 0, the first audio frame data and the second audio frame data are aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer.
[0035] Specifically, after obtaining the first audio frame data from the user sender and the second audio frame data from the user receiver, the first audio frame data is saved to the first user-mode temporary buffer, and the second audio frame data is saved to the second user-mode temporary buffer. When it is detected that the first remaining buffer space size of the first user-mode temporary buffer and the second remaining buffer space size of the second user-mode temporary buffer are both 0, it indicates that the first user-mode temporary buffer and the second user-mode temporary buffer cannot cache the first audio frame data from the user sender and the second audio frame data from the user receiver. Then, the first audio frame data and the second audio frame data are aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer.
[0036] S113: After saving the merged stereo audio frame data to the user-mode aggregation buffer, discard the first audio frame data and the second audio frame data saved in the current first user-mode temporary buffer and the second user-mode temporary buffer, and return to execute saving the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer until the recording ends.
[0037] Specifically, after saving the merged stereo audio frame data to the user-mode aggregation buffer, the first audio frame data and the second audio frame data saved in the current first user-mode temporary buffer and the second user-mode temporary buffer are discarded respectively, and the process continues to return to save the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer until the recording ends.
[0038] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of aligning and merging the first audio frame data and the second audio frame data to obtain dual-channel merged stereo audio frame data can be: S20: Detect whether the first data length of the first audio frame data and the second data length of the second audio frame data are aligned.
[0039] Specifically, the system obtains the first data length of the first audio frame data and the second data length of the second audio frame data stored in the first user-mode temporary buffer and the second user-mode temporary buffer, and checks whether the first data length and the second data length are aligned.
[0040] S21: If not, perform all-zero audio frame alignment processing on the first audio frame data and the second audio frame data.
[0041] Specifically, when it is determined that the first data length of the first audio frame data and the second data length of the second audio frame data are not aligned, the first audio frame data and the second audio frame data are subjected to all-zero audio frame alignment processing.
[0042] For example, the empty buffer containing the first audio frame data and the second audio frame data is filled with all-zero silence frames, so that the first data length of the first audio frame data and the second data length of the second audio frame data are aligned. However, this is not a limitation, and this embodiment is not specifically limited. Those skilled in the art can set it according to the actual situation.
[0043] S22: Based on the audio data sampling points, merge the aligned first audio frame data and the second audio frame data to obtain merged stereo audio frame data.
[0044] Specifically, after the first audio frame data and the second audio frame data are aligned to all zeros, the aligned first audio frame data and the second audio frame data are merged according to the audio data sampling points of the first audio frame data and the second audio frame data to obtain merged stereo audio frame data.
[0045] Thus, this embodiment improves the recording quality of subsequent operations by aligning the first data length of the first audio frame data and the second data length of the second audio frame data.
[0046] S12: After saving the merged stereo audio frame data to the user-mode aggregation buffer, the merged stereo audio frame data in the user-mode aggregation buffer is encrypted and written to the disk for recording in a loop until the recording ends.
[0047] Specifically, after the merged stereo audio frame data is saved to the user-space aggregation buffer, the merged stereo audio frame data in the user-space aggregation buffer is iteratively encrypted and written to the disk for recording until the recording ends.
[0048] Optionally, based on the above embodiments, in some embodiments of the present invention, S12 may be implemented as follows: S121: After saving the merged stereo audio frame data to the user-mode aggregation buffer, if the remaining buffer space of the current user-mode aggregation buffer is smaller than the size of the merged stereo audio frame data, the merged stereo audio frame data in the current user-mode aggregation buffer is encrypted and written to the disk.
[0049] Specifically, after saving the merged stereo audio frame data to the user-mode aggregation buffer, it is determined whether the remaining buffer space of the current user-mode aggregation buffer is less than the size of the merged stereo audio frame data. If it is determined that the remaining buffer space of the current user-mode aggregation buffer is less than the size of the merged stereo audio frame data, the merged stereo audio frame data in the current user-mode aggregation buffer is encrypted and written to the disk.
[0050] Optionally, based on the above embodiments, in some embodiments of the present invention, one way to encrypt the merged stereo audio frame data of the current user-mode aggregation buffer can be: S30: Encrypt the merged stereo audio frame data according to the position indexes corresponding to the first audio frame data and the second audio frame data, and the preset original key seed.
[0051] The preset original key seed can be obtained by reading it from the configuration file.
[0052] Specifically, for the merged stereo audio frame data in the current user-mode aggregation buffer, the merged stereo audio frame data is encrypted according to the position indexes corresponding to the first audio frame data and the second audio frame data, as well as the preset original key seed.
[0053] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of S30 may be: S301: Obtain the perturbation factor based on the position indices corresponding to the first audio frame data and the second audio frame data, respectively.
[0054] Specifically, the position indices corresponding to the first audio frame data and the second audio frame data are obtained respectively, and the perturbation factor is obtained based on the position indices corresponding to the first audio frame data and the second audio frame data respectively.
[0055] Optionally, based on the above embodiments, the disturbance factor can be determined by the following calculation formula:
[0056] Where i represents the position index corresponding to the first audio frame data, or the position index corresponding to the second audio frame data.
[0057] S302: Encrypt the merged stereo audio frame data according to the perturbation factor and the preset original key seed.
[0058] Specifically, after obtaining the perturbation factor, the merged stereo audio frame data is encrypted based on the perturbation factor and the preset original key seed.
[0059] Optionally, based on the above embodiments, one implementation method for encrypting the merged stereo audio frame data according to the perturbation factor and the preset original key seed can be: according to The merged stereo audio frame data is encrypted byte-by-byte. Here, `position` represents the circular cursor of the key stream. This indicates the preset original key seed.
[0060] In this way, this embodiment uses the position indexes corresponding to the first audio frame data and the second audio frame data respectively, as well as the preset original key seed, to encrypt the merged stereo audio frame data. This ensures that even if the same audio frame data appears in different positions in the file, the ciphertext result will be completely different, effectively resisting known plaintext attacks.
[0061] S122: After encrypting the merged stereo audio frame data in the current user-mode aggregation buffer and writing it to the disk, discard the merged stereo audio frame data in the current user-mode aggregation buffer and return to the previous state. After saving the merged stereo audio frame data to the user-mode aggregation buffer, continue until the recording ends.
[0062] Specifically, after encrypting and writing the merged stereo audio frame data in the current user-mode aggregation buffer to disk, the merged stereo audio frame data in the current user-mode aggregation buffer is discarded, and the process returns to saving the merged stereo audio frame data to the user-mode aggregation buffer until the recording ends, thus completing the call recording.
[0063] Thus, the call recording method based on dual-track audio stream separation provided in this embodiment obtains the first audio frame data from the sender and the second audio frame data from the receiver in response to the user's input recording command. Iteratively, the first audio frame data is saved to a first user-mode temporary buffer, and the second audio frame data is saved to a second user-mode temporary buffer. The first and second audio frame data are then aligned and merged to obtain dual-channel merged stereo audio frame data, which is saved to a user-mode aggregation buffer until recording ends. The first buffer size of the first user-mode temporary buffer and the second buffer size of the second user-mode temporary buffer are the same, and the third buffer size of the user-mode aggregation buffer is determined based on the first and second buffer sizes. After saving the merged stereo audio frame data to the user-mode aggregation buffer, the merged stereo audio frame data in the user-mode aggregation buffer is iteratively encrypted and written to disk for recording until recording ends. This method enables the acquisition of the first audio frame data from the sender and the second audio frame data from the receiver, avoiding the problem in existing technologies that record mixed audio streams from both the sender and receiver, making it impossible to distinguish the individual voice content of each party in the call. Furthermore, by using a user-mode aggregation buffer to batch align and merge the first and second audio frame data before writing them to disk for recording, it avoids the "write to disk once for each received frame" mode used in existing technologies. This solves the problem of audio frame loss and incomplete recording files when a dedicated IP switch handles hundreds of concurrent call recordings. Moreover, the encryption of the merged stereo audio frame data improves the security of the recorded data storage, preventing data leakage.
[0064] Optionally, based on the above embodiments, some embodiments of the present invention further include: When encrypting the merged stereo audio frame data and writing it to the disk for recording, the recording operation will end if an error code is received.
[0065] The error code indicates that an error has occurred during the current recording operation and the recording operation needs to be terminated.
[0066] Specifically, during the process of encrypting the merged stereo audio frame data and writing it to the disk for recording, when an error code is received, it indicates that an abnormality has occurred in the current recording operation, and the current recording operation is immediately terminated.
[0067] In this way, this embodiment can immediately terminate the recording operation if an error code is received during the process of encrypting the merged stereo audio frame data and writing it to the disk to complete the recording, thereby avoiding the situation where system resources are continuously occupied when the recording data storage is abnormal.
[0068] Optionally, based on the above embodiments, some embodiments of the present invention further include: Based on the recording status, the system will coordinate with the indicator lights driven by the changed interface to display the current recording status.
[0069] The recording status includes both a recording operation in progress and a recording operation not in progress. For example, when the recording operation is in progress, the system will push an INUSE red light; when the recording operation is not in progress, it will push a NOT_INUSE green light, so that the indicator lights on the phone terminal can reflect the current recording status in real time.
[0070] Example 2: Figure 2 This is a schematic diagram of a call recording device based on dual-track audio stream separation according to an embodiment of the present invention, as shown below. Figure 2 As shown, it includes: an audio frame data acquisition module 10, a stereo audio frame data acquisition module 11, and a recording module 12.
[0071] The audio frame data acquisition module 10 is used to respond to the recording command input by the user and acquire the first audio frame data of the user sender and the second audio frame data of the user receiver.
[0072] The stereo audio frame data acquisition module 11 is used to iteratively save the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer. The first audio frame data and the second audio frame data are aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer until the recording ends. The first buffer space size of the first user-mode temporary buffer and the second buffer space size of the second user-mode temporary buffer are the same. The third buffer space size of the user-mode aggregation buffer is determined based on the first buffer space size and the second buffer space size.
[0073] The recording module 12 is used to iteratively encrypt the merged stereo audio frame data in the user-mode aggregation buffer and write it to the disk for recording after saving the merged stereo audio frame data to the user-mode aggregation buffer, until the recording ends.
[0074] In this embodiment, the audio frame data acquisition module responds to the user's input recording command, acquiring the first audio frame data from the user's sender and the second audio frame data from the user's receiver. The stereo audio frame data acquisition module iteratively saves the first audio frame data to a first user-mode temporary buffer and the second audio frame data to a second user-mode temporary buffer. It then aligns and merges the first and second audio frame data to obtain dual-channel merged stereo audio frame data, which is saved to the user-mode aggregation buffer until recording ends. The first buffer size of the first user-mode temporary buffer and the second buffer size of the second user-mode temporary buffer are the same. The third buffer size of the user-mode aggregation buffer is determined based on the first and second buffer sizes. After saving the merged stereo audio frame data to the user-mode aggregation buffer, the recording module iteratively encrypts the merged stereo audio frame data in the user-mode aggregation buffer and writes it to disk for recording until recording ends. This method enables the acquisition of the first audio frame data from the sender and the second audio frame data from the receiver, avoiding the problem in existing technologies that record mixed audio streams from both the sender and receiver, making it impossible to distinguish the individual voice content of each party in the call. Furthermore, by using a user-mode aggregation buffer to batch align and merge the first and second audio frame data before writing them to disk for recording, it avoids the "write to disk once for each received frame" mode used in existing technologies. This solves the problem of audio frame loss and incomplete recording files when a dedicated IP switch handles hundreds of concurrent call recordings. Moreover, the encryption of the merged stereo audio frame data improves the security of the recorded data storage, preventing data leakage.
[0075] Although the invention has been specifically shown and described in conjunction with preferred embodiments, those skilled in the art should understand that various changes in form and detail may be made to the invention without departing from the spirit and scope of the invention as defined in the appended claims, all of which shall be within the scope of protection of the invention.
Claims
1. A call recording method based on dual-track audio stream separation, characterized in that, The method includes: In response to the user's input recording command, the system acquires the first audio frame data from the user's sender and the second audio frame data from the user's receiver. The system iteratively saves the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer. It then performs alignment and merging processing on the first and second audio frame data to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer. This process continues until the recording ends. The first buffer size of the first user-mode temporary buffer and the second buffer size of the second user-mode temporary buffer are the same. The third buffer size of the user-mode aggregation buffer is determined based on the first and second buffer sizes. After the merged stereo audio frame data is saved to the user-mode aggregation buffer, the merged stereo audio frame data in the user-mode aggregation buffer is encrypted and written to the disk for recording in a loop until the recording ends.
2. The method according to claim 1, characterized in that, The third cache size of the user-mode aggregation buffer is determined based on the first cache size and the second cache size, including: The size of the third cache space is determined by summing the sizes of the first and second cache spaces.
3. The method according to claim 2, characterized in that, The calling channel corresponding to the user sender and the called channel corresponding to the user receiver are respectively equipped with audio hooks. The audio hooks are equipped with recording flags, which are used to trigger the start of recording or the end of recording.
4. The method according to claim 3, characterized in that, The iterative process of saving the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer, followed by alignment and merging of the first and second audio frame data to obtain dual-channel merged stereo audio frame data, is then saved to the user-mode aggregation buffer until recording ends. This includes: The first audio frame data is saved to the first user-mode temporary buffer, and the second audio frame data is saved to the second user-mode temporary buffer; When the first remaining buffer size of the first user-mode temporary buffer and the second remaining buffer size of the second user-mode temporary buffer are both 0, the first audio frame data and the second audio frame data are aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer. After saving the merged stereo audio frame data to the user-mode aggregation buffer, the saved first and second audio frame data in the current first and second user-mode temporary buffers are discarded, and the process returns to saving the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer until the recording ends.
5. The method according to claim 4, characterized in that, The step of aligning and merging the first audio frame data and the second audio frame data to obtain dual-channel merged stereo audio frame data includes: Detect whether the first data length of the first audio frame data and the second data length of the second audio frame data are aligned; If not, perform all-zero audio frame alignment processing on the first audio frame data and the second audio frame data; Based on the audio data sampling points, the aligned first audio frame data and the second audio frame data are merged to obtain the merged stereo audio frame data.
6. The method according to claim 5, characterized in that, After saving the merged stereo audio frame data to the user-mode aggregation buffer, the merged stereo audio frame data in the user-mode aggregation buffer is iteratively encrypted and written to the disk for recording until the recording ends, including: After the merged stereo audio frame data is saved to the user-mode aggregation buffer, if the remaining buffer space of the current user-mode aggregation buffer is smaller than the size of the merged stereo audio frame data, the merged stereo audio frame data in the current user-mode aggregation buffer is encrypted and written to the disk. After encrypting the merged stereo audio frame data in the current user-mode aggregation buffer and writing it to the disk, the merged stereo audio frame data in the current user-mode aggregation buffer is discarded, and the process returns to saving the merged stereo audio frame data to the user-mode aggregation buffer until the recording ends.
7. The method according to claim 6, characterized in that, The step of encrypting the merged stereo audio frame data in the current user-mode aggregation buffer includes: The merged stereo audio frame data is encrypted based on the position indices corresponding to the first and second audio frame data, respectively, and a preset original key seed.
8. The method according to claim 7, characterized in that, The step of encrypting the merged stereo audio frame data based on the position indices corresponding to the first audio frame data and the second audio frame data, and a preset original key seed, includes: The perturbation factor is obtained based on the position indices corresponding to the first audio frame data and the second audio frame data, respectively. The merged stereo audio frame data is encrypted based on the perturbation factor and the preset original key seed.
9. The method according to claim 8, characterized in that, The method further includes: When the merged stereo audio frame data is encrypted and written to the disk for recording, the recording operation ends if an error code is received.
10. A call recording device based on dual-track audio stream separation, characterized in that, include: The audio frame data acquisition module is used to respond to the recording command input by the user and acquire the first audio frame data from the user sender and the second audio frame data from the user receiver. The stereo audio frame data acquisition module is used to iteratively save the first audio frame data to the first user-mode temporary buffer and the second audio frame data to the second user-mode temporary buffer. The first audio frame data and the second audio frame data are aligned and merged to obtain dual-channel merged stereo audio frame data, which is then saved to the user-mode aggregation buffer until the recording ends. The first buffer size of the first user-mode temporary buffer and the second buffer size of the second user-mode temporary buffer are the same. The third buffer size of the user-mode aggregation buffer is determined based on the first buffer size and the second buffer size. The recording module is used to iteratively encrypt the merged stereo audio frame data in the user-mode aggregation buffer and write it to the disk for recording after saving the merged stereo audio frame data to the user-mode aggregation buffer, until the recording ends.