A method, apparatus, processor, and readable storage medium for automatically matching and uploading audio files based on call status monitoring.
By dynamically adapting the recording storage directory through cloud configuration and dual monitoring mechanisms, combined with multi-level delay scanning and breakpoint resume mechanisms, the problem of path differences and inconsistent naming rules of recording files between different mobile phone manufacturers is solved, ensuring that recording data is not lost in abnormal scenarios, and realizing automatic matching and reliable uploading of recording files.
Patent Information
- Application Number
- CN202611236335.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, the association between audio files and call logs is constrained by differences in paths and naming rules among various manufacturers. Call status monitoring is unstable, audio data is easily lost in abnormal scenarios, and the upload process lacks reliability assurance, resulting in poor audio data integrity and inability to be uploaded to the server in a timely manner.
By dynamically adapting to the recording storage directories of various manufacturers through cloud configuration and successful path learning mechanism of the same model, and combining dual monitoring mechanism to stably capture changes in call status, the system uses multi-level delay scanning and a two-layer matching strategy of merging number and time window to locate recording files, and uses graded retry and breakpoint resume mechanism to ensure upload reliability, supplemented by compensation tasks and persistent retry queue to ensure that tasks are not lost in abnormal scenarios.
It achieves cross-vendor compatibility and adaptation, improves the integrity of recording data and the success rate of uploading, reduces maintenance costs, ensures that recording data is not lost in abnormal scenarios, and improves the timeliness and integrity of recording data.
Smart Images

Figure CN123123504A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of mobile communication technology, and more particularly to the field of call recording processing. Specifically, it relates to a method, apparatus, processor, and computer-readable storage medium for automatically matching and uploading recording files based on call status monitoring. Background Technology
[0002] In the telemarketing industry, call recordings are crucial for quality control, customer complaint handling, performance review, and business traceability. Companies typically require sales staff to automatically record calls and upload the recordings to a back-end system for administrator review. However, in practice, the process from the end of a call to the upload of the recording to the server presents numerous technical hurdles: Different mobile phone manufacturers use different storage paths and naming rules for recording files—some store them in a specific directory on internal storage, while others store them on the SD card; some filenames include the phone number, while others are named only with a timestamp. This makes it impossible to locate the correct recording file using a unified method, resulting in the loss of call recordings.
[0003] Call status monitoring is unstable. When monitoring call status, the system is susceptible to interference from unusual numbers—such as command codes entered via the dial pad or hidden phone numbers marked with asterisks—which can lead to incorrect status assessments. Furthermore, some mobile phone manufacturers have imposed restrictions on call broadcasting, potentially preventing traditional statically registered broadcast receivers from triggering correctly. These issues ultimately result in inaccurate call status capture, leading to the loss of corresponding call logs and recordings.
[0004] The timing of post-hang-up processing is difficult to determine. After a call is ended, the phone system's call log is not written immediately; there is a certain writing delay. If you query immediately after hanging up, you may not be able to obtain key information such as the call start / end time and call duration because the data has not yet been generated, leading to subsequent matching failures and lost recordings. Furthermore, in scenarios with multiple concurrent calls, such as "hanging up the incoming call first," simple hang-up handling logic can easily miss some call hang-up events, resulting in corresponding recordings not being processed.
[0005] Insufficient ability to handle abnormal situations. When the app is killed by the system, the device restarts, or becomes unresponsive, recorded calls cannot be processed in a timely manner. These recordings are neither matched nor uploaded, resulting in data loss.
[0006] Duplicate dialing generates redundant data. When sales personnel repeatedly dial the same number within a short period, multiple duplicate call records are generated, interfering with normal recording matching. This leads to mismatches between recordings and call logs, ultimately resulting in data loss.
[0007] The upload process is unstable. Network fluctuations, device restarts, and other factors can easily cause audio file uploads to fail. There is no mechanism to resume interrupted uploads; the process must start all over again. Furthermore, there is no effective retry mechanism for failed uploads, meaning the audio files will never reach the server, resulting in lost recordings.
[0008] The adaptation costs are high for each manufacturer. The recording storage paths of different mobile phone manufacturers vary greatly. Each time a new model is adapted, the path needs to be re-investigated and hard-coded. Unadapted models cannot find the recording storage directory, resulting in the loss of recordings.
[0009] Insufficient phone storage space may lead to abnormal call logs or failure to save recording files, further increasing the risk of data loss.
[0010] In summary, the main problem with the existing solutions is that the matching and uploading of audio recordings lack a unified automated mechanism and fault tolerance, making it difficult to guarantee data integrity and timeliness. Summary of the Invention
[0011] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, apparatus, processor and computer-readable storage medium for automatically matching and uploading recording files based on call status monitoring, which meets the requirements of high timeliness, good data integrity and wide applicability.
[0012] To achieve the above objectives, the present invention provides a method, apparatus, processor, and computer-readable storage medium for automatically matching and uploading recording files based on call status monitoring, as follows: The method for automatically matching and uploading recording files based on call status monitoring is characterized by the following steps: (1) When the application starts, obtain the recording storage directory configuration information from the server. The recording storage directory configuration information includes at least the mapping relationship between the terminal manufacturer and the recording storage directory. (2) Monitor the call status. When a call hang-up event is detected, wait for the first preset time and then obtain the system call record. (3) Determine whether the call is connected based on the system call records; (4) If the call is connected, the target recording directory is determined according to the recording directory configuration information, and the files in the target recording directory are matched according to the preset delay matching strategy to obtain the recording file corresponding to the call; (5) Upload the audio file to the server.
[0013] Preferably, step (1) specifically includes the following steps: Retrieve the configuration file mapping the mobile phone manufacturer to the recording storage directory from the server, and synchronize the list of recording storage directories that have been successfully matched for the same mobile phone model from the server. The step of determining the target recording directory based on the recording directory configuration information includes using the corresponding recording storage directory in the configuration file or the list of recording storage directories that have been successfully matched for the same device model as candidate recording directories.
[0014] Preferably, step (1) further includes the following steps: When the application starts, perform a permission self-check, checking at least one or more of the following permissions: recording permission, phone status and dialing permission, read call log permission, read audio / storage permission, auto-start permission, background pop-up interface permission, battery optimization whitelist, and notification permission.
[0015] Preferably, the step (2) of monitoring the call status specifically includes the following steps: Simultaneous monitoring via system broadcast and call status listener to capture changes in call status; When listening for incoming calls, the system obtains the caller ID and filters out abnormal numbers. If customer information is matched locally, the system binds the customer ID and writes the call log to the local database. When a user initiates an outbound call, check if the same number has been dialed repeatedly within a preset time window. If so, prevent the dialing. Otherwise, write the dialing data to the local database, establish a mapping relationship between the call number and the call identifier, and then call the system dialing interface.
[0016] Preferably, step (2) of monitoring the call status further includes the following steps: Maintain the list of ongoing numbers during a call; If a hang-up event is received and the number list contains multiple numbers, a mixed call processing procedure is performed, specifically: Check if the call is still ongoing. If so, do not process the current hang-up event; otherwise, record the corresponding hang-up call log as the "post-hang-up" state, record the other call log as the "previous-hang-up" state, and select the recording file based on the time corresponding to the previous and subsequent hang-up states when matching the recording file.
[0017] Preferably, step (4) involves matching files in the target recording directory according to a preset delayed matching strategy, specifically including the following steps: The first matching will be performed after the third preset time interval following the end of the call. If no match is found, the second matching will be performed after the fourth preset time interval. If no match is found again, the third matching will be performed after the fifth preset time interval. During the matching process, the rule that the file name contains the call number and the file time is within the call time window is given priority. If no match is found, the rule that the file time is within the call time window and the hang-up time is extended by a preset offset is used.
[0018] Preferably, step (4) further includes the following steps: If no recording file is obtained after three matching attempts, the recording matching task of the call is added to the local retry queue and retried using a tiered retry strategy; if the number of matching retries reaches the first maximum number, the recording matching status of the call is marked as abnormal and automatic retry is stopped.
[0019] Preferably, step (5) specifically includes the following steps: Calculate the digital digest of the audio file and compare it with the digital digest of files already uploaded to the server to remove duplicates; The audio file is cached in a local sandbox and then uploaded to the server using a resume upload method. If the upload fails, the upload task will be added to the retry queue and retried using a tiered retry strategy. If the number of upload failures reaches the second maximum number, the task will be marked as an abnormal state.
[0020] Preferably, the tiered retry strategy is as follows: The delay time for the nth retry is 3000 milliseconds multiplied by 2 to the power of n-1, and the maximum delay does not exceed 5 minutes; the retry queue is triggered when the application starts, after the call is hung up, or when the application switches to the foreground.
[0021] Preferably, the method further includes the following steps: When the application starts, it retrieves incomplete call records from the local database that are in dialing, ringing, or pending status. The incomplete call records are re-executed for hang-up processing, audio file matching, and uploading.
[0022] Preferably, the method further includes the following steps: Before dialing, the device checks the available storage space. When the available storage space is lower than a preset threshold, the user is prompted to clean up disk space.
[0023] The device for automatically matching and uploading recording files based on call status monitoring is characterized in that the device includes: A processor is configured to execute computer-executable instructions; The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the various steps of the above-described method for automatically matching and uploading recording files based on call status monitoring.
[0024] The processor for automatically matching and uploading recording files based on call status monitoring is characterized in that the processor is configured to execute computer-executable instructions, and when the computer-executable instructions are executed by the processor, the various steps of the above-mentioned method for automatically matching and uploading recording files based on call status monitoring are implemented.
[0025] The main feature of this computer-readable storage medium is that it stores a computer program thereon, which can be executed by a processor to implement the various steps of the above-described method for automatically matching and uploading recording files based on call status monitoring.
[0026] This invention employs a method, apparatus, processor, and computer-readable storage medium for automatic matching and uploading of recording files based on call status monitoring. It dynamically adapts to various manufacturers' recording storage directories through cloud configuration and a successful path learning mechanism for the same device model. Combined with a dual-monitoring mechanism, it stably captures changes in call status. After hanging up, it uses a multi-level delayed scanning and a dual-layer matching strategy combining number and time windows to locate the recording file. Simultaneously, it ensures upload reliability through tiered retry and breakpoint resumption mechanisms, supplemented by compensation tasks and persistent retry queues to ensure no task loss in abnormal scenarios. This eliminates recording loss problems caused by differences in manufacturer paths, inconsistent naming rules, system write delays, and process termination, improving the integrity of recording data and the upload success rate. It achieves cross-manufacturer compatibility and reduces maintenance costs. Attached Figure Description
[0027] Figure 1 This is a flowchart of the method for automatically matching and uploading recording files based on call status monitoring according to the present invention. Detailed Implementation
[0028] To more clearly describe the technical content of the present invention, the following description is provided in conjunction with specific embodiments.
[0029] The method for automatically matching and uploading recording files based on call status monitoring according to the present invention includes the following steps: (1) When the application starts, obtain the recording storage directory configuration information from the server. The recording storage directory configuration information includes at least the mapping relationship between the terminal manufacturer and the recording storage directory. (2) Monitor the call status. When a call hang-up event is detected, wait for the first preset time and then obtain the system call record. (3) Determine whether the call is connected based on the system call records; (4) If the call is connected, the target recording directory is determined according to the recording directory configuration information, and the files in the target recording directory are matched according to the preset delay matching strategy to obtain the recording file corresponding to the call; (5) Upload the audio file to the server.
[0030] In a preferred embodiment of the present invention, step (1) specifically includes the following steps: Retrieve the configuration file mapping the mobile phone manufacturer to the recording storage directory from the server, and synchronize the list of recording storage directories that have been successfully matched for the same mobile phone model from the server. The step of determining the target recording directory based on the recording directory configuration information includes using the corresponding recording storage directory in the configuration file or the list of recording storage directories that have been successfully matched for the same device model as candidate recording directories.
[0031] In a preferred embodiment of the present invention, step (1) further includes the following steps: When the application starts, perform a permission self-check, checking at least one or more of the following permissions: recording permission, phone status and dialing permission, read call log permission, read audio / storage permission, auto-start permission, background pop-up interface permission, battery optimization whitelist, and notification permission.
[0032] In a preferred embodiment of the present invention, the step (2) of monitoring the call status specifically includes the following steps: Simultaneous monitoring via system broadcast and call status listener to capture changes in call status; When listening for incoming calls, the system obtains the caller ID and filters out abnormal numbers. If customer information is matched locally, the system binds the customer ID and writes the call log to the local database. When a user initiates an outbound call, check if the same number has been dialed repeatedly within a preset time window. If so, prevent the dialing. Otherwise, write the dialing data to the local database, establish a mapping relationship between the call number and the call identifier, and then call the system dialing interface.
[0033] In a preferred embodiment of the present invention, step (2) of monitoring the call status further includes the following steps: Maintain the list of ongoing numbers during a call; If a hang-up event is received and the number list contains multiple numbers, a mixed call processing procedure is performed, specifically: Check if the call is still ongoing. If so, do not process the current hang-up event; otherwise, record the corresponding hang-up call log as the "post-hang-up" state, record the other call log as the "previous-hang-up" state, and select the recording file based on the time corresponding to the previous and subsequent hang-up states when matching the recording file.
[0034] In a preferred embodiment of the present invention, step (4) involves matching files in the target recording directory according to a preset delay matching strategy, specifically including the following steps: The first matching will be performed after the third preset time interval following the end of the call. If no match is found, the second matching will be performed after the fourth preset time interval. If no match is found again, the third matching will be performed after the fifth preset time interval. During the matching process, the rule that the file name contains the call number and the file time is within the call time window is given priority. If no match is found, the rule that the file time is within the call time window and the hang-up time is extended by a preset offset is used.
[0035] In a preferred embodiment of the present invention, step (4) further includes the following steps: If no recording file is obtained after three matching attempts, the recording matching task of the call is added to the local retry queue and retried using a tiered retry strategy; if the number of matching retries reaches the first maximum number, the recording matching status of the call is marked as abnormal and automatic retry is stopped.
[0036] In a preferred embodiment of the present invention, step (5) specifically includes the following steps: Calculate the digital digest of the audio file and compare it with the digital digest of files already uploaded to the server to remove duplicates; The audio file is cached in a local sandbox and then uploaded to the server using a resume upload method. If the upload fails, the upload task will be added to the retry queue and retried using a tiered retry strategy. If the number of upload failures reaches the second maximum number, the task will be marked as an abnormal state.
[0037] In a preferred embodiment of the present invention, the graded retry strategy is specifically as follows: The delay time for the nth retry is 3000 milliseconds multiplied by 2 to the power of n-1, and the maximum delay does not exceed 5 minutes; the retry queue is triggered when the application starts, after the call is hung up, or when the application switches to the foreground.
[0038] In a preferred embodiment of the present invention, the method further includes the following steps: When the application starts, it retrieves incomplete call records from the local database that are in dialing, ringing, or pending status. The incomplete call records are re-executed for hang-up processing, audio file matching, and uploading.
[0039] In a preferred embodiment of the present invention, the method further includes the following steps: Before dialing, the device checks the available storage space. When the available storage space is lower than a preset threshold, the user is prompted to clean up disk space.
[0040] The apparatus of the present invention for automatically matching and uploading recording files based on call status monitoring, wherein the apparatus includes: A processor is configured to execute computer-executable instructions; The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the various steps of the above-described method for automatically matching and uploading recording files based on call status monitoring.
[0041] The processor of the present invention for automatically matching and uploading recording files based on call status monitoring is configured to execute computer-executable instructions. When the computer-executable instructions are executed by the processor, the various steps of the above-mentioned method for automatically matching and uploading recording files based on call status monitoring are implemented.
[0042] The computer-readable storage medium of the present invention stores a computer program thereon, which can be executed by a processor to implement the various steps of the above-described method for automatically matching and uploading recording files based on call status monitoring.
[0043] This invention relates to the field of mobile communication technology, and specifically to a method and system for automatically matching and uploading audio files by monitoring call status in a telemarketing scenario.
[0044] The technical problem to be solved by this invention is that in existing call recording management solutions, the association between recording files and call records is constrained by the differences in paths and naming rules among various manufacturers, the call status monitoring is unstable, the recording data is easily lost in abnormal scenarios, and the upload process lacks reliability assurance. These factors together lead to poor integrity of the recording data, and a large number of call recordings ultimately fail to reach the server.
[0045] This invention provides a method and system for automating the entire process from call monitoring to recording file matching and uploading, ensuring that call recordings are neither lost nor missed. Simultaneously, the system automatically performs these mechanical operations, freeing sales personnel from worrying about uploading recordings and allowing them to focus on business communication itself.
[0046] The core idea of this invention is as follows: During system startup, configuration preloading and permission self-checks are performed to provide a stable operating environment for subsequent processing. The system then continuously monitors the call status, and upon a hang-up event, it enters an optimized hang-up processing flow, automatically uploading the recorded audio file to the server after matching. Both the matching and uploading stages have retry mechanisms; automatic retries are performed upon failure to ensure that recorded data is not lost under various abnormal scenarios.
[0047] The specific steps of this invention are as follows: Step 1: Preload configuration and perform permission self-check.
[0048] When the application starts, it retrieves a JSON configuration file from a remote server showing the mapping between phone manufacturers and recording storage directories. Simultaneously, it synchronizes a list of successfully matched recording storage directories for the same phone model from the server. This aims to resolve the issue of inconsistent paths across manufacturers: instead of relying on hard-coded paths, it dynamically retrieves recording directories through cloud configuration and learning from successful paths for the same phone model. New phone models can be adapted by using the successful paths shared by users of the same model. The server provides query and save functions.
[0049] In terms of permission self-checking, a full self-check of execution permissions is performed. Mandatory permissions include recording permission, call status and dialing permission, call log reading permission, audio / storage reading permission, auto-start permission, background pop-up interface permission, battery optimization whitelist, and notification permission. Users are guided to the settings page to enable any permissions not yet enabled. After the permission check passes, a local SQLite database is initialized to store call log records (including fields such as unique ID, number, call type, call status, recording status, and upload status). A foreground keep-alive service is started, using persistent notifications to ensure the monitoring service is not killed by the system. Subsequently, a call status monitoring service is started, dynamically registering broadcast receivers to monitor call status changes in real time. Finally, a compensation task is executed: incomplete call logs are read from the local database, and the hang-up, matching, and upload logic is executed to ensure that recordings are not lost during application termination.
[0050] Step 2: Call status monitoring and data recording.
[0051] For outbound calls initiated by sales personnel from the application, the system performs pre-checks and processing: First, it checks for duplicate dialing, detecting whether the same number is dialed repeatedly within a preset time window (3 seconds). If so, the dialing is blocked. Then, it checks the status of the phone's automatic call recording function. If not, it guides the user to enable it. It determines whether the current phone status supports dialing, identifies dual SIM cards and records the SIM card slot ID. It saves the data to be dialed to the local database and marks it as dialing status. Using the phone number to be called as the key, it establishes a mapping relationship between the unique dialing ID, customer ID, and call type (outbound), and then calls the system dialing API to make the call.
[0052] For customer callback calls, the system retrieves the caller ID when the call rings, filters out abnormal numbers such as hidden numbers, special numbers, and command codes, matches the customer information locally (if a match is successful, it is bound to the customer ID; otherwise, it is marked as an unknown call), and writes it to the local database (unique ID, number, call type = callback, status = ringing), establishing a call mapping relationship. After the call is connected, the status is updated to "in call," and after hanging up, the optimized hang-up event handling process begins.
[0053] Call status monitoring employs a dual-monitoring mechanism: simultaneous monitoring via system broadcast and a call status listener ensures stable capture of call status changes across different vendor-customized systems, preventing call log and recording loss due to monitoring failure. During monitoring, abnormal numbers (including dial pad command codes and hidden asterisked phone numbers) are filtered and cleaned in real time, and the correct number for the current call is obtained by combining this with the number information from outgoing call data. The number and dialing type are recorded in the currently active number dictionary data structure for unified judgment and handling when multiple calls occur simultaneously.
[0054] Step 3: Optimize the process for handling idle events.
[0055] When a hang-up event is detected, the following unified processing flow is executed: First, handle the hang-up event of the current call status; then, determine if there are other calls in the current call, and if so, process the hang-up status of those other calls sequentially; delay for a preset duration (4 seconds) to wait for the system call record to be generated, avoiding data loss due to write delays. Next, retrieve data of the same number in the local database that is in dialing or ringing status, and mark its status as pending transmission; query the call records of the same number and call type in the mobile phone system, and determine whether the corresponding call is connected based on the start and end times of the call record. If the call is not connected, the process ends; if the call is connected, proceed to the audio file matching step.
[0056] In terms of handling hang-up compensation events, instead of using a single timestamp comparison, a dynamic time window with a buffer is constructed by combining the reference time and the last recording time. This effectively improves the data association success rate under high system load or asynchronous writing conditions, and avoids recording loss due to association failure. A separate judgment logic branch is set up specifically for the abnormal scenario of "hanging up the incoming call first", which enhances the robustness of hang-up processing.
[0057] Step 4: Matching audio files.
[0058] If the call is connected, the corresponding recording files for the call are matched. First, based on the preloaded configuration information, it is determined whether the relevant recording directory exists in the current phone, and an initial list of recording matching directories is obtained.
[0059] The matching process employs a three-level delayed scanning strategy to address the delay in audio file generation: the first matching attempt occurs 3 seconds after the connection is closed; if this fails, a second matching attempt occurs after another 5 seconds (8 seconds total); if this also fails, a third matching attempt occurs after another 10 seconds (18 seconds total). If all three attempts fail, the file is placed in the local retry queue.
[0060] The matching rules employ a two-tiered strategy: the priority strategy selects files with phone numbers included in the filename and matching within the call time window; the fallback strategy matches only within the call time window, with the hang-up time delayed by 6 seconds to accommodate recording generation delays. This two-tiered strategy effectively addresses the issue of differing naming conventions for recording files from different manufacturers—some include phone numbers in the filename, while others only use time identifiers—avoiding the inability to find recording files due to mismatched names.
[0061] If the audio file fails to match, it enters the local retry queue, employing a tiered retry strategy of 20 seconds, 40 seconds, and 60 seconds. The local data matching retry count is incremented by 1. When the maximum matching retry count (4 times) is reached, it is marked as an abnormal state and automatic retrying stops. To prevent continuous retries consuming resources in abnormal scenarios, failed call logs are only retried at three time points: immediately after application startup, immediately after hanging up a call, and when switching to the foreground.
[0062] Step 5: Upload the audio recording.
[0063] After a successful audio recording match, the following upload process is executed: the file enters the upload queue, deduplication is performed using file MD5 to avoid duplicate uploads, local sandbox caching ensures file security, and a mechanism for resuming interrupted uploads and automatically retrying on failure is adopted. Uploads use a tiered retry strategy with 20-second, 40-second, and 60-second intervals. Uploads automatically resume after network recovery. Upon successful upload, the status is updated to "uploaded"; if an upload fails, the failure count is incremented by 1, and if the maximum number of failed uploads (4 times) is exceeded, the upload is marked as abnormal.
[0064] Step 6: Abnormal compensation handling.
[0065] When an application is killed by the system or becomes unresponsive, making it unable to handle the call hang-up status, the system retrieves all data in the dialing, ringing, or pending state from the local database each time the application is opened, and performs compensation processing for the hang-up logic.
[0066] Step 7: Spatial Detection.
[0067] Before dialing, the system checks the phone's available space. When the available space is less than 2MB, the user is prompted to clear disk space to avoid abnormal call data due to insufficient space.
[0068] The local retry queues involved in steps four, five, and six above use persistent SQLite storage, ensuring that unfinished task data is not lost even if the process is killed or the device restarts. The queue supports three task types: audio recording matching, file upload, and call compensation. Scheduling employs an exponential backoff algorithm: the delay for the nth retry is 3000 milliseconds multiplied by 2 to the power of n-1, with a maximum delay of no more than 5 minutes.
[0069] In summary, from the moment a call is dialed or received, the system automatically completes the search, matching, and uploading of the recording file according to the steps described above. Even if an anomaly occurs midway, such as the application being killed, network interruption, or device restart, the compensation mechanism ensures that data is not lost and is automatically restored upon the next startup.
[0070] In specific embodiments of the present invention, the following describes the embodiments of the present invention in detail with reference to specific scenarios.
[0071] Data Preparation. After the enterprise deploys this system application on the mobile phone, the application automatically retrieves a JSON configuration file from the remote server showing the mapping relationship between the mobile phone manufacturer and the recording storage directory upon startup. It also obtains a list of recording storage directories successfully matched by other users of the same device model. Upon first use, the application automatically performs a full permission self-check, examining eight mandatory permissions, including recording permission, call status and dialing permission, and call log reading permission. For any permissions not enabled, the user is guided to the system settings page to enable them. After the user enables these permissions, the application starts a foreground keep-alive service (a persistent "Call recording service running" notification appears in the notification bar), dynamically registers a system broadcast receiver and call status listener, and completes initialization.
[0072] Step 1: Outbound Call Scenario. Salesperson Zhang clicks on the phone number of customer "Mr. Li" in the application's customer list, triggering the outbound call process. The system first performs a duplicate dialing check; Zhang has not dialed the same number within 3 seconds, so the check passes. Next, the system checks the phone's automatic call recording function; Zhang's phone has this function enabled, so it passes. The system recognizes Zhang's phone as a dual-SIM phone and records the currently used SIM card slot ID (subId=1). The dialing data is written to the local database: Unique ID=call_001, Employee ID=emp_100, Customer ID=cust_200, Number=138xxxx1234, Call Type=Outbound, Status=1 (Dialing). A global mapping is established: "138xxxx1234→call_001+emp_100+cust_200". The system dialing API is called to initiate the call, and the dialing start log is reported.
[0073] During the call, the system continuously monitors the call status through a dual-monitoring mechanism. When Mr. Li answers, the call is connected, the system updates the local database status, and reports the connection log.
[0074] Step 2: Hang Up and Match. The call is disconnected after 5 minutes. The system detects the disconnection event and delays for 4 seconds to wait for the system call record to be generated. After 4 seconds, the system call record is queried, and the start time 14:00:00, end time 14:05:00, and call duration 300 seconds are obtained, confirming that the call has been connected. The status of call_001 in the local database is updated to 2 (pending transmission).
[0075] The system proceeds to match the recorded audio file. Based on the pre-loaded configuration: Xiao Zhang's phone is an Android 13 model of a certain brand, and the configured recording directory is / internal storage / CallRecord / . This directory is also included in the successful path for the same model sent from the cloud. The system confirms the existence of this directory and begins the first matching (3 seconds after hanging up): scanning the directory for files whose filenames contain "138xxxx1234" and whose modification time is within the time window of 14:05:00. The first match is successful; the file "138xxxx1234_20250723_140500.amr" was found, with a modification time of 14:05:02, within the time window. Matching complete; the recorded audio file path is recorded.
[0076] Step 3: Upload. Upon successful matching, the file automatically enters the upload queue. The system calculates the MD5 value of the recording file ("a1b2c3d4e5...") and compares it with the server's already uploaded MD5 list to confirm no duplicate uploads. The file is copied to the local sandbox cache. It is then uploaded to the server interface via the network, using a resume-from-breakpoint upload method. If the upload is interrupted by brief network fluctuations, the system automatically resumes uploading from the breakpoint upon recovery, and the upload is successful. After the server returns a success message, the local database call_001 status is updated to 3 (uploaded), and an upload success log is reported.
[0077] Step 4: Anomaly Compensation Scenarios. In another scenario, salesperson Xiao Wang's application is killed by the system during a call. The call had actually been connected for 5 minutes when the customer finished communicating and hung up. At this point, the application was in a killed state and could not handle the hang-up event or record matching.
[0078] The next day, Xiao Wang opened the application, and the system initiated a compensation task: it queried the local database for all call records with a status of 1 (dialing / ringing) or 2 (pending transmission). It found that call_002 had a status of 1 and phoneTalkingTime > 0 (indicating the call was actually connected). The system executed the compensation hang-up logic, queried the system call records after a 4-second delay, confirmed the connection, and updated the status to 2. Then, it entered a three-level delay matching process: the first match failed after 3 seconds and entered the retry queue; after 20 seconds, it retried and matched successfully. It then entered the upload queue, uploaded successfully, and updated the status to 3. The entire process required no manual intervention, and the data remained intact without loss.
[0079] Thus, this invention completes an automated process from call status monitoring and recording matching to uploading, and ensures data integrity through a compensation mechanism in abnormal scenarios.
[0080] Regarding the instability caused by external factors, this invention proposes a new solution to the following problem: 1. Regarding the issue of the system being abnormally closed while a call is in progress, since the system is abnormally closed, all matching functions of the system will not be executed and will become invalid, resulting in unstable matching of recordings.
[0081] The present invention adopts the following solution: Each time the system initiates a call, it records the transaction data with status 1 (initial state) to the system's local database, and then invokes the call interface. When the call is disconnected, the status is set to 2 (disconnected state).
[0082] Each time the application is reopened, each time a call is ended, and each time the system listens for network recovery, it reads the transaction data in the local database where the status is 1 (initial state) and actively calls the logic processing function for the call ending event.
[0083] 2. Regarding the issue where the call network is normal, but the system traffic or Wi-Fi network is abnormal or the remote server is abnormal, resulting in the failure to upload files and synchronize server status.
[0084] The present invention adopts the following solution: Each time the application is reopened, each time a call is disconnected, and each time the system listens for network updates, the system reads transaction data with a status of 2 (disconnected) from the local database and checks if the number of failed matches has reached the maximum value of 20. If the maximum value of 20 is reached, it is considered that there are no real recording files in the current stream. To prevent false positives, the system will check whether the current directory is the actual recording storage directory based on the file list attributes of the currently accessible directory, thus achieving a more accurate result without false positives or omissions.
[0085] If the maximum value of 20 is not reached, the matching and uploading logic will be re-executed. If there is a failure due to network issues, the number of failed matching and uploading will be incremented by 1, and the system will wait for a better opportunity to trigger it again.
[0086] If the upload is successfully matched, the status in the local database will be recorded as 3 (completed). Data with a status of 3 (completed) from the previous 7 days will be cleared each time the system starts.
[0087] 3. Regarding the issue of other calls interrupting the current call or prematurely ending the current call, different mobile phone manufacturers have different logics for handling other calls during a call, which can easily lead to confusion and misjudgment in the original matching logic.
[0088] A multi-feature fusion-based dynamic retrieval and association matching scheme for recorded files is proposed. To address the issue of inconsistent naming and storage paths for recorded files, a comprehensive retrieval model based on time windows, number similarity, and media library metadata is constructed. After a call ends, the system listens for a multimedia scan completion event and retrieves newly added audio files from the relevant call recording paths.
[0089] By comparing the overlap between the file creation time and the call time window, whether the file name contains fragments of the other party's number, and combining multimedia metadata such as generation time and name for weighted matching, the recording file corresponding to this call can be uniquely identified.
[0090] The present invention adopts the following solution: Because it is not possible to directly determine whether the current recording file belongs to an incoming or outgoing call scenario from the call recording file.
[0091] In systems where many recording files are named using the contact's nickname instead of a phone number, or where recording files are named using timestamps, simply matching the start and end times of the call log provided by the time window and media library metadata can lead to serious misjudgments.
[0092] The current system is incompatible with the different event handling methods of various manufacturers for suspending, disconnecting, and connecting incoming calls midway, resulting in the following situations: 1. When a call is suspended, there are no event notifications, and the system cannot detect that the current call has been suspended.
[0093] 2. When the current call is resumed after being suspended, there is no event notification, the system cannot detect it, and can only obtain the final hang-up event.
[0094] 3. When hanging up and connecting, some services will not notify you of the hang-up in the middle, but will only notify you of the hang-up event after all the hang-ups are completed.
[0095] To address the aforementioned issues, the system stores all numbers in a list each time it receives an incoming call notification or initiates a call itself.
[0096] When a hang-up event is received, check if the list length is greater than 1. If it is greater than 1, then it is a mixed call. After the system hangs up, it checks if the call is still ongoing. If it is, for compatibility reasons, the vendor responsible for the hang-up event will only be notified at the very end, and the hang-up event itself will not be processed. If a mixed call is hung up and the user is no longer in a call, the corresponding hang-up record will be marked as the "post-hang-up" state, and the other record in the list will be marked as the "previous-hang-up" state (all vendors adhere to the rule that there can only be one outgoing and one incoming call at a time; otherwise, a busy signal will be displayed).
[0097] Using the previous matching logic, if multiple recording files match, the correct recording file is selected based on the recording time of the previous and subsequent hang-up states.
[0098] 4. The inconsistent storage directories for recording files across different systems have led many users to manually set the correct storage directory.
[0099] The present invention adopts the following solution: To prevent frequent changes to the default recording file storage directory, manually change it to the correct directory. Add recording directory deletion and synchronization logic based on device model and manufacturer: 1. When the system starts, obtain a list of storage directories for the server model corresponding to this system. If a match fails, try using the list.
[0100] 2. When a successful match is found in the system, check if the server has saved the current directory. If not, save the current directory to the server based on the manufacturer and model of the current system. This information will be used to automatically repair the recording storage directory with the same manufacturer and model.
[0101] This invention upgrades to an adaptive dynamic latency matching algorithm. Current fixed latencies (3 seconds, 5 seconds, 10 seconds) are based on conventional polling methods. The introduced algorithm dynamically calculates the data generation latency for each manufacturer based on device hardware performance (such as CPU load and IO write speed) and historical statistical models of specific mobile phone brands. The system intelligently adapts to different hardware environments, rather than using hard-coded values, highlighting innovation at the algorithmic level.
[0102] This invention introduces a one-dimensional cross-validation recording matching mechanism, as relying solely on filenames and time windows may lead to misjudgments. An additional step is added to extract the actual duration (metadata) of the audio file and compare it with the call duration recorded by the system using a dynamic fault-tolerance threshold. For example, if the call lasts 45 seconds, the media duration of the matched audio file must be 45 seconds ± 2 seconds. This 2-second dynamic fault-tolerance threshold is achieved through a lightweight multi-task learning model directly deployed on the device side. This model is trained by reading historical files. Real-time device context (CPU load, memory pressure, I / O queue and battery status, device model) is used as input features, and multiple output targets are predicted simultaneously: the expected recording time delay, etc.
[0103] The path configuration in this invention adopts a heuristic discovery mechanism. The current method involves "pulling configuration from the server," which is standard client-server logic. However, if a directory doesn't exist, the client needs to manually set the correct directory before synchronization. To address this issue, a heuristic path discovery mechanism is introduced. When a device encounters an unconfigured phone model, a file scanner is used to find the most recent audio files, which are verified through duration association. This new mapping is then reported to the server. To prevent misjudgment, the server subsequently uses a consensus algorithm to confirm across multiple devices of the same model before adding the new directory and triggering retransmission logic. This elevates the system to an automated, self-learning system.
[0104] This invention enables storage pre-allocation and dynamic buffer release. Currently, the system only warns the user when storage space falls below a threshold before dialing. It introduces a method to predict the average call duration based on the user's historical call history and pre-allocate placeholder files within a sandbox, reserving specific block spaces. If system storage suddenly becomes full during a call, the system can dynamically release this pre-allocated buffer to ensure the current call recording is successfully written.
[0105] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) A systematic solution is provided to address the technical obstacles in each stage of audio recording upload. In existing solutions, the association between audio files and call logs is limited by differences in paths and naming rules among various manufacturers. The timing of post-hang-up processing is affected by system write delays, and the upload process lacks effective retry and resume mechanisms—these technical obstacles can lead to the loss of recordings at multiple stages. This invention identifies the above obstacles one by one and solves them through cloud path configuration, three-level delay scanning, graded retry, and breakpoint resume, ensuring that call recordings are not lost due to technical obstacles.
[0106] (2) Significantly improves the integrity of recording data. In existing solutions, recordings are often lost when the application is killed, uploads fail after network interruption, and recordings cannot be found due to mismatched vendor paths. This invention ensures that recording data is not lost under various abnormal scenarios through multiple safeguards such as startup compensation mechanism, breakpoint resume, cloud path configuration, and local retry queue.
[0107] (3) It has cross-vendor compatibility and adaptability. Existing solutions rely on hard-coded recording paths, which need to be redeveloped for each new model. This invention uses cloud configuration and a successful path learning mechanism for the same model, so that new models can be automatically adapted through the successful paths shared by users of the same model, which greatly reduces maintenance costs.
[0108] (4) Task status is persisted and is not affected by the process lifecycle. In existing solutions, unfinished matching and uploading tasks are lost and cannot be recovered after the application process is killed or the device is restarted. This invention uses SQLite to persistently store the local retry queue. Even if the process terminates or the device restarts, the unfinished task data is still retained and will be automatically resumed upon the next startup.
[0109] For the specific implementation scheme of this embodiment, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0110] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.
[0111] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means at least two.
[0112] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0113] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0114] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The corresponding program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.
[0115] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0116] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.
[0117] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0118] This invention employs a method, apparatus, processor, and computer-readable storage medium for automatic matching and uploading of recording files based on call status monitoring. It dynamically adapts to various manufacturers' recording storage directories through cloud configuration and a successful path learning mechanism for the same device model. Combined with a dual-monitoring mechanism, it stably captures changes in call status. After hanging up, it uses a multi-level delayed scanning and a dual-layer matching strategy combining number and time windows to locate the recording file. Simultaneously, it ensures upload reliability through tiered retry and breakpoint resumption mechanisms, supplemented by compensation tasks and persistent retry queues to ensure no task loss in abnormal scenarios. This eliminates recording loss problems caused by differences in manufacturer paths, inconsistent naming rules, system write delays, and process termination, improving the integrity of recording data and the upload success rate. It achieves cross-manufacturer compatibility and reduces maintenance costs.
[0119] In this specification, the invention has been described with reference to specific embodiments thereof. However, it will be apparent that various modifications and variations can be made without departing from the spirit and scope of the invention. Therefore, the specification and drawings should be considered illustrative rather than restrictive.
Claims
1. A method for automatically matching and uploading recording files based on call status monitoring, characterized in that, The method includes the following steps: (1) When the application starts, obtain the recording storage directory configuration information from the server. The recording storage directory configuration information includes at least the mapping relationship between the terminal manufacturer and the recording storage directory. (2) Monitor the call status. When a call hang-up event is detected, wait for the first preset time and then obtain the system call record. (3) Determine whether the call is connected based on the system call records; (4) If the call is connected, the target recording directory is determined according to the recording directory configuration information, and the files in the target recording directory are matched according to the preset delay matching strategy to obtain the recording file corresponding to the call; (5) Upload the audio file to the server.
2. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, Step (1) specifically includes the following steps: Retrieve the configuration file mapping the mobile phone manufacturer to the recording storage directory from the server, and synchronize the list of recording storage directories that have been successfully matched for the same mobile phone model from the server. The step of determining the target recording directory based on the recording directory configuration information includes using the corresponding recording storage directory in the configuration file or the list of recording storage directories that have been successfully matched for the same device model as candidate recording directories.
3. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, Step (1) further includes the following steps: When the application starts, perform a permission self-check, checking at least one or more of the following permissions: recording permission, phone status and dialing permission, read call log permission, read audio / storage permission, auto-start permission, background pop-up interface permission, battery optimization whitelist, and notification permission.
4. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, The step (2) of monitoring the call status specifically includes the following steps: Simultaneous monitoring via system broadcast and call status listener to capture changes in call status; When listening for incoming calls, the system obtains the caller ID and filters out abnormal numbers. If customer information is matched locally, the system binds the customer ID and writes the call log to the local database. When a user initiates an outbound call, check if the same number has been dialed repeatedly within a preset time window. If so, prevent the dialing. Otherwise, write the dialing data to the local database, establish a mapping relationship between the call number and the call identifier, and then call the system dialing interface.
5. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, The step (2) of monitoring the call status also includes the following steps: Maintain the list of ongoing numbers during a call; If a hang-up event is received and the number list contains multiple numbers, a mixed call processing procedure is performed, specifically: Check if the call is still ongoing. If so, do not process the current hang-up event; otherwise, record the corresponding hang-up call log as the "post-hang-up" state, record the other call log as the "previous-hang-up" state, and select the recording file based on the time corresponding to the previous and subsequent hang-up states when matching the recording file.
6. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, Step (4) involves matching files in the target recording directory according to a preset delayed matching strategy, specifically including the following steps: The first matching will be performed after the third preset time interval following the end of the call. If no match is found, the second matching will be performed after the fourth preset time interval. If no match is found again, the third matching will be performed after the fifth preset time interval. During the matching process, the rule that the file name contains the call number and the file time is within the call time window is given priority. If no match is found, the rule that the file time is within the call time window and the hang-up time is extended by a preset offset is used.
7. The method for automatically matching and uploading recording files based on call status monitoring according to claim 6, characterized in that, Step (4) further includes the following steps: If no recording file is obtained after three matching attempts, the recording matching task of the call is added to the local retry queue and retried using a tiered retry strategy; if the number of matching retries reaches the first maximum number, the recording matching status of the call is marked as abnormal and automatic retry is stopped.
8. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, Step (5) specifically includes the following steps: Calculate the digital digest of the audio file and compare it with the digital digest of files already uploaded to the server to remove duplicates; The audio file is cached in a local sandbox and then uploaded to the server using a resume upload method. If the upload fails, the upload task will be added to the retry queue and retried using a tiered retry strategy. If the number of upload failures reaches the second maximum number, the task will be marked as an abnormal state.
9. The method for automatically matching and uploading recording files based on call status monitoring according to claim 7 or 8, characterized in that, The tiered retry strategy is as follows: The delay time for the nth retry is 3000 milliseconds multiplied by 2 to the power of n-1, and the maximum delay does not exceed 5 minutes; the retry queue is triggered when the application starts, after the call is hung up, or when the application switches to the foreground.
10. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, The method further includes the following steps: When the application starts, it retrieves incomplete call records from the local database that are in dialing, ringing, or pending status. The incomplete call records are re-executed for hang-up processing, audio file matching, and uploading.
11. The method for automatically matching and uploading recording files based on call status monitoring according to claim 1, characterized in that, The method further includes the following steps: Before dialing, the device checks the available storage space. When the available storage space is lower than a preset threshold, the user is prompted to clean up disk space.
12. A device for automatically matching and uploading recorded files based on call status monitoring, characterized in that, The device includes: A processor is configured to execute computer-executable instructions; The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the steps of the method for automatically matching and uploading recording files based on call status monitoring as described in any one of claims 1 to 11.
13. A processor for automatically matching and uploading recording files based on call status monitoring, characterized in that, The processor is configured to execute computer-executable instructions, which, when executed by the processor, implement the steps of the method for automatically matching and uploading recording files based on call status monitoring as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by a processor to implement the steps of the method for automatically matching and uploading recording files based on call status monitoring as described in any one of claims 1 to 11.
