Voice message-based companion terminal message flow conversion method and system

By assigning server-side sequence numbers to voice messages and sorting them on the terminal according to these numbers, the problem of voice message sequence offset after the receiving terminal goes offline is solved, thus achieving accurate binding of voice commands and correctness of message status on the screenless terminal.

CN123164149APending Publication Date: 2026-11-24HUNAN ANZHI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611669038.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-27
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

When the receiving terminal is restored from offline to online, the sequence of voice messages sent from the cloud and the sequence that can be operated on the terminal are prone to deviation, which can lead to playback errors and inaccurate binding of voice commands. This is especially true on screenless terminals where users cannot visually confirm the operation.

Method used

The server assigns a unique server sequence number to each voice message and sorts them by sequence number on the terminal, establishing a unified sorting benchmark across the four stages of delivery, arrival, caching, and notification. Consistency verification is performed in conjunction with the operable sequence version number to ensure that voice commands are accurately bound to the target message.

Benefits of technology

It resolves sequence offsets caused by retransmissions, delays, or out-of-order arrivals, ensuring that voice commands on the screenless terminal are accurately bound to the target message, reducing erroneous operations caused by network problems or inconsistent status, and protecting the correctness of the message status on the server side.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123164149A_ABST
    Figure CN123164149A_ABST
Patent Text Reader

Abstract

This invention provides a method and system for message flow in a companion terminal based on voice messaging, relating to the field of information transmission technology. It includes: using a message identifier as the unique object, and through continuous constraints of server sequence number, operable sequence version, presentation record, and receipt verification, the voice message, from issuance, reminder, playback, command binding to receipt submission, always revolves around the same message identifier to achieve a closed-loop flow. This technical solution solves the dynamic offset between the message issuance sequence and the terminal's operable sequence after weak network reconnection, stabilizes the specific message instances that should be affected by playback or deletion receipts, maintains the consistency of voice message playback, deletion, and status feedback, and solves the problem of users being unable to visually detect errors on existing screenless terminals, leading to the continuous accumulation of misoperations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of information transmission technology, specifically a method and system for message flow in a companion terminal based on voice messages. Background Technology

[0002] With the rapid development of AI smart toys, smart companion toys are evolving from traditional one-way voice playback devices into smart terminals with deep interaction, personalized services, and emotional companionship capabilities. The application scenarios of companion toy terminals are also rapidly expanding, covering multiple scenarios of daily companionship and emotional care. The use of voice messages places higher demands on the message transmission capabilities of companion terminals.

[0003] In existing companion terminal voice messaging scenarios, when multiple sending companion terminals send one or more voice messages to the same receiving companion terminal, the receiving terminal is in a long-term offline state. After the receiving companion terminal recovers from offline status and reconnects to the network, the server usually batch sends all voice messages to be delivered to the companion terminal. The terminal then sequentially forms message reminders, a queue of messages to be played, and local message instances. When the receiving companion terminal presents the message through voice reminders and voice message playback, the receiving user receives a reminder of the voice message to be played. Subsequently, the receiving user issues a voice command to play the message, and the companion terminal plays the voice message after receiving the voice command. If the user issues a voice command to pause, the companion terminal binds to a specific message instance and pauses the playback of the voice message.

[0004] For example, Chinese invention patent CN110896376B discloses a message reminder method and device. The message data packet includes a message header and a message body. The message header carries fields such as sender, receiver, and reminder type. The server forwards the message according to the receiver's identity identifier, and the terminal provides differentiated reminders according to the reminder type, thereby ensuring that important messages can reach the message receiver in a timely and effective manner.

[0005] For example, Chinese invention patent application CN121771251A discloses an IoT control system and method. The system includes a connection management module and a dynamic device mapping module. The system maps data from IoT devices to an MQTT server through a configuration file. When the system detects that the MQTT client instance is offline, the message queue and network disconnection resume module puts the message at the end of the message queue for resume transmission.

[0006] However, the aforementioned existing technology has at least the following technical problems:

[0007] In existing technologies, after the receiving companion terminal recovers from offline status and reconnects to the network, the server typically sends all voice messages to the companion terminal in batches. A dynamic offset occurs between the message sending sequence and the terminal's operable message sequence. During weak network reconnection, messages may arrive repeatedly, arrive late, or enter the terminal in batches. The same message may have different sequential positions at the communication layer, caching layer, and playback layer. For example, when a user says "play the first message," does it mean the first message sent from the cloud, the first message arriving via the protocol, the first message on the local instance, or the first message after a voice prompt has been completed? The "first message" at different layers may be inconsistent, leading to playback errors.

[0008] Furthermore, companion terminals typically only have eye-tracking and voice interaction capabilities, lacking a screen and visual feedback. When the companion terminal presents messages via voice prompts and voice message playback, and the user subsequently issues a voice command, the system can only resolve the precise binding relationship between the command and the message instance on its own. Because the microphone capture window simultaneously contains the user's voice, the device's audio playback, and ambient noise while the terminal's speaker is playing a new message notification or message content, the correspondence between the voice command event, confidence level, and the target message instance fluctuates. This can lead to playback or deletion receipts being submitted to voice messages that are not intended by the user. For example, after the companion terminal reconnects to the network and receives multiple voice message notifications, if the user says to delete the current message, the terminal might have just finished playing the previous voice message and is already prompting for the next one, or the server might be resending a new voice message. The terminal cannot reliably determine which voice message the voice control command corresponds to, potentially resulting in the deletion of a previously notified, unplayable voice message. The user may unknowingly perform an operation on a message that is not intended by them, causing a loss. Since the companion terminal has no screen, users cannot visually detect errors in voice commands. Instead, they have to confirm them by swiping through a list, just like with other terminals, causing errors to accumulate. Summary of the Invention

[0009] To address the above problems, this invention provides a method and system for message flow in a companion terminal based on voice messages. This addresses the issues in the prior art where, after the receiving companion terminal reconnects from offline, there are offsets between the cloud-downloaded sequence, the terminal's locally instantiated sequence, and the voice reminder presentation sequence. Furthermore, when the user's voice command acquisition window overlaps with the terminal's prompt sound or message playback audio, the reliability of the binding between the voice command event and the specific message instance fluctuates, leading to the inability to reliably determine whether the playback or deletion receipt applies to the specific message instance.

[0010] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0011] According to one aspect of the present invention, a message flow method for a companion terminal based on voice messaging is provided, executed by a server, comprising:

[0012] The system receives and stores the voice messages submitted by the sender, generates a unique message identifier for each voice message, and assigns a server sequence number based on the receiver's identifier. The server sequence number remains unchanged throughout the message's lifecycle.

[0013] When the receiving end reconnects from an offline state, the server responds to the receiving end's reconnection request by reading the maximum confirmed server sequence number corresponding to the receiving end using the receiving end identifier, determining the resend range, reading message records whose server sequence number is greater than the maximum confirmed server sequence number of the receiving end and have not been deleted, generating a resend frame, the resend frame carrying the message identifier and server sequence number, and sending the resend frame to the receiving end.

[0014] The receiving end deduplicates the resent frames according to the message identifier and sorts them according to the server sequence number. The operable sequence version record includes the mapping relationship between the receiving end identifier, operable sequence version number, message identifier, server sequence number and operable sequence number. After saving the operable sequence version record, the receiving end returns a version saving confirmation to the receiving end.

[0015] When the receiving end receives the confirmation, it sets the operable sequence version to the current operable sequence version, and performs voice prompts or playback, generates presentation records, and binds voice commands to the target message identifier based on the current operable sequence version. After generating the operation request, it receives the operation request submitted by the receiving end. The operation request carries the operation type, target message identifier, server sequence number, operable sequence version number, command event identifier, and operable sequence number, and performs consistency verification on the operation request.

[0016] The verification result is sent to the receiving end, which updates the local message status based on the verification result. If the verification result is "accepted", an operable sequence version is regenerated. If the verification result is "rejected", an operable sequence version is reconstructed according to the mapping relationship.

[0017] According to another aspect of the present invention, a companion terminal message flow system based on voice messaging is provided, comprising:

[0018] The message entry module is used to receive the voice message content, sender identifier, and receiver identifier submitted by the sending terminal, generate a message identifier for the voice message, generate a server sequence number based on the receiver identifier, and write the message identifier, sender identifier, receiver identifier, server sequence number, voice content storage address, and undelivered flag into the server message record.

[0019] The retransmission frame generation module is used to determine the scope of this retransmission based on the maximum server sequence number confirmed by the receiving end and the current maximum server sequence number after the receiving end companion terminal reconnects; generate retransmission frames for message records that have not been deleted within the scope of this retransmission; write the server sequence number of message records that have been deleted within the scope of this retransmission into the deleted skip sequence number set; and send the retransmission frame set and the deleted skip sequence number set to the receiving end companion terminal.

[0020] The version record saving module is used to save the operable sequence version record submitted by the receiving end companion terminal. The operable sequence version record includes at least the mapping relationship between the receiving end identifier, operable sequence version number, message identifier, server sequence number and operable sequence number. After successful saving, the module returns a version saving confirmation to the receiving end companion terminal.

[0021] The operation verification module receives operation requests, identifies duplicate requests based on the instruction event identifier, and performs consistency verification based on the message identifier, server sequence number, operable sequence version number, and operable sequence number. When the consistency verification passes and the message does not have a deleted mark, the corresponding operation is executed and an accepted result is returned. When the consistency verification fails or the message already has a deleted mark, the message status is not changed, and a rejected result and the current valid mapping relationship are returned.

[0022] According to another aspect of the present invention, a message transfer method for a companion terminal based on voice messaging is provided, executed by a receiving end, comprising:

[0023] After the receiving end receives the voice message from the server, each message carries a unique message identifier generated by the server, and a server sequence number is assigned based on the receiving end identifier. The server sequence number remains unchanged throughout the message's lifecycle.

[0024] When the receiving end recovers from offline to online, it sends a reconnection request to the server and establishes a communication connection with the server. After the receiving end reconnects, it receives a retransmission frame from the server. The retransmission frame is generated by the server reading the message records that have not been deleted after the confirmed maximum server sequence number. The retransmission frame carries the message identifier and the server sequence number.

[0025] After receiving the retransmitted frame, the receiving end first removes duplicates according to the message identifier, sorts them according to the server sequence number and checks their continuity to form an operable sequence version. Each message in the operable sequence version has a message identifier, a server sequence number and an operable sequence number.

[0026] The receiving end selects a voice message from the currently available operational sequence version for operation. When the voice prompt or the message is played, a presentation record is generated. The presentation record records the message identifier, operational sequence version number, and voice output time of the message.

[0027] The receiving end binds the voice command to the target message identifier based on the voice command and the presentation record, and generates an operation request that includes the operation type, target message identifier, server sequence number, operable sequence version number, command event identifier, and operable sequence number.

[0028] Submit an operation request to the server and receive the verification result returned by the server. The verification result is generated by the server after performing a consistency check based on the server sequence number, operable sequence version number and operable sequence number in the operation request.

[0029] The receiving end updates the local message status based on the verification result and regenerates an operable sequence version after the deletion operation is successful.

[0030] The beneficial effects achieved by the technical solutions provided in the embodiments of the present invention include at least the following:

[0031] By assigning a server-side sequence number to each voice message on the server side and then reconstructing an operable sequence version on the terminal according to the server-side sequence number, the operable sequence numbers are strictly arranged according to the server-side sequence number. Compared to existing technologies where dynamic offsets occur between the cloud-deployed sequence, protocol arrival sequence, terminal local instantiation sequence, and voice reminder presentation sequence due to weak network reconnection, message retransmission, and delayed arrival, this solution establishes a unified sorting benchmark across the four stages of deployment, arrival, caching, and reminder through the server-side sequence number. This solves the sequence offset caused by retransmission, delay, or out-of-order arrival, enabling sequence-based voice commands to be accurately bound to the target message on the screenless terminal. Because the companion terminal is screenless, users cannot confirm specific messages by swiping through a list as they would on a terminal with a screen. Therefore, this solution automatically ensures that the first message is always correctly identified, allowing users to trust the execution result of voice commands without relying on visual confirmation. This ensures that sequence-based voice commands are accurately bound to the target message on the screenless companion terminal, resolving user loss caused by the lack of screen confirmation.

[0032] By coordinating the server-side sequence number and the operable sequence version number, a two-way adjustment closed loop is established between message sequence offset and voice command binding reliability. When the retransmission rate increases or queue backlog leads to increased sequence offset, the operable sequence version blocks messages with missing sequence numbers from entering the current version through continuity checks, reducing the density of continuous reminders and thus improving the accuracy of command acquisition in continuous broadcast scenarios on screenless terminals. When the server-side verification finds that the operable sequence version number in the operation request is inconsistent with the current valid version, it returns the current valid mapping relationship for the terminal to reconstruct the sequence version, ensuring that subsequent voice commands only apply to the new version. In screenless scenarios, users cannot visually confirm changes in the current message queue version. This solution automatically synchronizes and switches versions, ensuring that users always face the operable sequence number in the current valid version and avoid erroneous operations due to version discrepancies. In existing technologies, message queue disturbances and decreased voice command binding reliability affect each other, and a unified adjustment mechanism has not yet been formed. This solution incorporates sequence offset and binding reliability fluctuations into the same closed-loop processing, providing a unified adjustment approach for receipt attribution in scenarios where continuous delivery and voice control coexist.

[0033] By sending three independent parameters—server sequence number, operable sequence version number, and operable sequence number—to the operation request, the server performs a consistency check on these three parameters. The operation is only executed if all three can be mapped to the same message identifier. If any comparison is inconsistent, the operation is rejected and the current valid mapping relationship is returned. Compared to the problem in existing technologies where local deletion or playback operations on the terminal may be submitted to the wrong message instance due to incorrect command binding, resulting in incorrect updates to the server message status, this solution addresses the issue of incorrect receipt submissions caused by inconsistencies between the terminal's local status and the server's status. In situations where screenless terminal users cannot visually detect errors, the server proactively intercepts these errors during the verification process, resolving the possibility of erroneous commands affecting the server message status and protecting the correctness of the server message status.

[0034] The pending confirmation deletion mechanism marks the message as pending confirmation deletion before the server returns the verification result, without actually deleting the voice content. The message is actually deleted after the server confirms it. If the server rejects the deletion, the mark is removed and the message is restored. Compared with the existing technology, where deletion operations take effect immediately after being executed locally, and if the server rejects the deletion due to network problems or inconsistent status, the locally deleted voice content cannot be recovered, this solution reduces the risk of misoperation caused by outdated sequence number mapping and inconsistent request fields, and avoids the loss of local data due to network problems or inconsistent status. This ensures that local data is not lost, and users will not suffer irreversible losses due to a single failed operation. Attached Figure Description

[0035] Figure 1 This invention provides an architecture diagram of message flow for a voice messaging companion terminal.

[0036] Figure 2 This invention provides an overall flowchart of message flow for a voice messaging companion terminal.

[0037] Figure 3 This is a flowchart of the server-side resend frame generation process provided in an embodiment of the present invention;

[0038] Figure 4 A flowchart of the receiver operable sequence version reconstruction process provided in an embodiment of the present invention;

[0039] Figure 5 The flowchart illustrates the interaction between voice command binding and server-side verification provided in this embodiment of the invention. Detailed Implementation

[0040] To enable those skilled in the art to better understand the technical solution, the present invention will be described in detail below with reference to embodiments. The description in this part is only exemplary and explanatory, and should not be used to limit the scope of protection of the present invention in any way.

[0041] The sending companion terminal is used to collect or generate voice messages and submit them to the server. The server is used to save voice messages, assign server sequence numbers, generate retransmission frames after the receiving companion terminal reconnects, save operable sequence version records, and verify operation requests submitted by the receiving companion terminal. The receiving companion terminal is used to receive retransmission frames, reconstruct operable sequence versions, output voice prompts or play voice messages, recognize user voice commands, bind voice commands to target messages, and adjust the local message status based on the server's verification results. Figure 1 As shown, the system involves a sending companion terminal, a server, and a receiving companion terminal. The sending companion terminal generates voice message data and sends the voice message data packet to the server. After receiving the message, the server performs a message storage operation to complete the storage of the voice message. The receiving companion terminal initiates an operation request to the server, requesting to retrieve the voice message and synchronize related operation instructions. After receiving the operation request, the server verifies the legality, permissions, and data integrity of the request through its internal operation verification unit. After verification, the server sends the verification result back to the receiving companion terminal, informing it whether the operation request is compliant and valid. If there is data loss at the receiving end, the server internally generates a retransmission frame and sends it to the receiving companion terminal. After receiving the retransmission frame, verification result, and message-related data, the receiving companion terminal performs sequence reconstruction, reordering the voice or command data. When the user makes an operation request, the voice message is associated and bound with the corresponding operation instruction. Based on the bound message and voice instruction, the receiving companion terminal adjusts its device operating status to complete this interaction process.

[0042] For ease of description, the list of messages that the receiving companion terminal can currently manipulate by sequence number is referred to as the operable sequence version. An operable sequence version is uniquely identified by its operable sequence version number. The user-facing sequence number of a message within an operable sequence version is called its operable sequence number. The operable sequence number differs from the server-side sequence number. The server-side sequence number indicates the order in which the server generates voice messages according to the receiver's perspective, while the operable sequence number indicates the order in which the receiving companion terminal presents and receives voice commands to the user within the current operable sequence version.

[0043] The message identifier is a unique identifier generated by the server for each voice message. The server sequence number is a consecutive sequence number assigned by the server to voice messages based on the receiver identifier. This assignment is independent for each receiver; the server sequence numbers of different receivers do not affect or interfere with each other. All messages received by the same receiver are consecutively numbered from a preset initial sequence number according to the order in which they were received by the server. Different receivers do not share or compete for the same sequence number; the message sequence number assignment for one receiver does not affect the sequence number assignment for other receivers. Once generated, the server sequence number remains unchanged throughout the entire lifecycle of a voice message—from message entry, resending, notification, playback, binding, verification to deletion or completion of playback—and is not released or reused even if the voice message is subsequently played, deleted, resent, paused, or hidden. The deleted skipped sequence number set is the set of server sequence numbers within the current resending range that have been marked as deleted by the server and therefore will not be resent. Presentation records are generated by the receiving terminal when outputting a voice reminder or playing a voice message. They are used to bind voice commands pointing to the currently presented object, such as "current message," "this message," "pause," and "delete current message," to the message that the user actually hears or is interacting with.

[0044] Example 1 provides a message flow method for companion terminals based on voice messaging. The processing entities in this example include a server-side companion terminal and a receiving-side companion terminal. The server-side and receiving-side companion terminals transmit resend frames, missing sequence number resend requests, operable sequence version records, operation requests, and operation verification results via a network connection.

[0045] The server receives the voice message content, sender identifier, and receiver identifier submitted by the sending terminal. The server generates a unique message identifier for the voice message and reads the current maximum server sequence number corresponding to that receiver identifier, such as... Figure 2The server first stores the voice messages in the database and generates a unique message identifier. The server then increments the receiver's current maximum server sequence number to obtain the message's server sequence number. To ensure that multiple voice messages arrive simultaneously in high-concurrency scenarios and that their server sequence numbers are unique, the server employs an atomic sequence number allocation mechanism. Specifically, the server maintains an independent sequence number counter for each receiver identifier, stored in persistent storage. Whenever a new message needs a server sequence number, the server performs a read, increment, and write operation on the counter using atomic increment operations. These atomic increment operations are uninterruptible single operations, meaning they cannot be interrupted by other threads or processes, ensuring that multiple concurrent requests from the same receiver each obtain different sequence numbers. The atomic increment operation returns the incremented value as the message's server sequence number. If the receiver identifier does not currently have a server sequence number, the server uses a preset initial sequence number as the first voice message's server sequence number.

[0046] In one specific implementation, the server uses Redis's INCR command to achieve atomic allocation of server sequence numbers. The server stores the current maximum server sequence number for the receiving end in Redis, using the receiving end identifier as the key. When a new message arrives, the server executes the INCR command, which atomically increments the value of the corresponding key and returns the incremented value as the message's server sequence number. Because Redis uses a single-threaded processing model, the INCR command will not be interrupted by other commands during execution, and multiple concurrent requests will each receive different return values, ensuring the uniqueness and monotonically increasing nature of the sequence numbers.

[0047] In another specific implementation, the server uses an auto-incrementing column in the database to achieve atomic allocation of the server sequence number. The server maintains a record in the database for each receiver, and this record contains an auto-incrementing column. When a new message arrives, the server inserts a new record into the database table, automatically obtaining a new sequence number using the database's auto-incrementing column feature, which serves as the server sequence number for that message. The database's auto-incrementing column uses an internal locking mechanism to ensure that each record receives a different auto-incrementing value during concurrent insertions.

[0048] In another specific implementation, the server uses a distributed lock to achieve atomic allocation of server sequence numbers. When a new message arrives, the server acquires the distributed lock using the receiver's identifier as the lock key, such as a Redisson lock based on Redis or a distributed lock based on ZooKeeper. Under the lock's protection, it reads the current maximum sequence number, increments it by one, writes it back to storage, and then releases the lock. Since only one thread can hold the lock at a time, two concurrent requests will not be assigned the same sequence number.

[0049] The server writes the voice message content to the voice content storage area, generates a voice content storage address, and writes the message identifier, sender identifier, receiver identifier, server sequence number, voice content storage address, and undelivered flag into the server's message record. The undelivered flag indicates that the message has not yet been confirmed by the receiving terminal as an operable version. The server sequence number remains unchanged after the message record is written; even if the message is subsequently deleted, the server sequence number is not released or reused during the message's lifecycle.

[0050] When the receiving companion terminal reconnects from offline to online status, it sends a reconnection request to the server. The reconnection request includes at least the receiver's identifier and the maximum server sequence number confirmed by the receiver. The maximum server sequence number confirmed by the receiver indicates the maximum server sequence number that the receiving companion terminal has confirmed in a consecutive order. This confirmation process includes the receiver having received the corresponding retransmission frame and included the corresponding message in the operable sequence version, or the receiver having learned that the corresponding server sequence number belongs to the set of deleted skipped sequence numbers.

[0051] Because the receiving terminal cannot receive voice messages from the server while offline, messages received by the server during this period cannot be delivered to the receiving terminal and need to be resent after the receiving terminal reconnects, thus creating a resending requirement. Simultaneously, in weak network environments, even if the receiving terminal is online, some messages may not be successfully received due to network jitter, unstable signal, or message transmission timeouts. The server needs to identify messages that have been confirmed as received by the receiving terminal and messages that have not yet been received, and only resend the unreceived messages after the receiving terminal reconnects to avoid duplicate resending of already received messages. The server determines the message reception progress of the receiving terminal using the largest confirmed server sequence number, and determines the resending range accordingly. Specifically, the resending range is determined based on the server sequence number assigned to each message by the server and the largest confirmed server sequence number by the receiving terminal, indicating the progress of messages that the receiving terminal has successfully processed. Figure 3When the receiving end reconnects, the server reads the largest confirmed server sequence number using the receiving end's identifier. It then filters the message records for all messages with server sequence numbers greater than this value that are not marked as deleted, designating them as a candidate retransmission range. While traversing this range, if a sequence number with a deleted skipped sequence number is encountered, it is skipped and added to the deleted skipped sequence number set, not considered missing. If a sequence number does not exist in either the retransmission frame set or the deleted skipped sequence number set, it is determined to be a truly missing server sequence number. The message corresponding to this missing server sequence number is then included in the retransmission range, and the retransmission of messages after this missing sequence number is temporarily suspended until the missing message is successfully retransmitted. This ensures the continuity and correct order of the operable sequence versions at the receiving end. The server arranges the messages within the retransmission range in ascending order of server sequence number, generates a retransmission frame set, and sends it to the receiving end for processing. Figure 4 As shown, the receiving end then deduplicates the resent frames according to the message identifier, sorts them by sequence number, and performs a continuity check to determine if the sequence number exists. If it exists, the sequence number is added to the operable sequence version and assigned an operable sequence number. If it has been deleted, the sequence number is skipped. If the sequence number is missing, a resentment request is generated, blocking subsequent messages, and finally a new operable sequence version is reconstructed.

[0052] Meanwhile, since the sequence number confirmed by the receiving end during offline periods only increases and never decreases, even if the receiving end learns through other means that some messages have been deleted during offline periods, it will not roll back the largest confirmed server sequence number, ensuring that the server and the receiving end remain consistent on the basis of the resend range.

[0053] In one specific implementation scenario, the receiving companion terminal remains offline due to prolonged periods in areas without network coverage, such as basements, remote areas, or signal dead zones. Since the receiving terminal does not respond to any push notifications during its offline period, the server cannot confirm which messages have been received. Therefore, after the receiving terminal reconnects, it needs to determine the range of undelivered messages using the confirmed maximum server sequence number and resend them. Assume the receiving companion terminal goes offline at minute 0, and the server receives a total of 5 undelivered voice messages during its offline period, corresponding to server sequence numbers 101 to 105. The server assigns a message identifier and server sequence number to each message according to the aforementioned message entry rules and writes it to the server message record, keeping the undelivered mark valid. During the terminal's offline period, the server maintains a message retransmission mechanism according to the MQTT protocol specification. For each message with QoS level 1, when retransmission is required, the server begins retransmission with an initial retransmission interval of 3 seconds. If no confirmation is received from the terminal, the retransmission interval is doubled after each retransmission, but the single retransmission interval does not exceed 6 seconds, and each message is retransmitted a maximum of 5 times. If the terminal still does not respond after all 5 retransmission attempts, the server persistently stores the message in an offline message queue. This queue is arranged in ascending order of server sequence number, with a maximum capacity of 200 messages. When the number of offline messages stored in the queue reaches 200, the server discards the oldest stored message in ascending order of server sequence number to free up queue space.

[0054] The receiving end accompanies the terminal for at least minute T, where T≥10, indicating that the terminal has been offline for at least 10 minutes, before reconnecting to the network. The terminal initiates a reconnection request according to a preset exponential backoff reconnection strategy: the first reconnection attempt is initiated immediately after network recovery; if the connection fails, it is retried after 2 seconds, 4 seconds, 8 seconds, 16 seconds, and 32 seconds, with the time interval between two consecutive reconnection attempts not exceeding 60 seconds; if 10 consecutive reconnection attempts fail, the terminal stops automatic reconnection and enters a manual reconnection waiting state, awaiting user intervention before reconnecting. After a successful reconnection, the terminal sends a reconnection request to the server, carrying the receiving end identifier and the maximum server sequence number confirmed by the receiving end. The maximum server sequence number is 100, meaning that the terminal confirmed that it had processed all messages with sequence number 100 and earlier before going offline.

[0055] After receiving the reconnection request, the server determines the scope of this resend to be server sequence numbers 101 to 105. The server reads the undeleted message records within this range. Since none of the five messages have been deleted, a resend frame is generated for each message according to the aforementioned resend frame generation rules. Each resend frame carries at least the message identifier, the receiver identifier, the server sequence number, and the voice content storage address. If the number of messages in the resend frame set exceeds 10, the server uses a sliding window protocol to send them in batches, with each batch having a window size of 10 messages. If the network signal quality is poor (signal strength below -80dBm or data transmission rate below 1Mbps), the server dynamically reduces the window size to 5 messages. If the network signal quality recovers well (signal strength above -60dBm and data transmission rate above 5Mbps), the server restores the window size to 10 messages. The server then arranges the resend frame set in ascending order of server sequence number and sends it to the receiving companion terminal.

[0056] After receiving the retransmitted frame set, the receiving terminal performs deduplication, sorting, and continuity checks according to the aforementioned sequence reconstruction rules. Assuming the retransmitted frame set completely contains the five messages corresponding to sequence numbers 101 to 105, and there are no deleted or skipped sequence numbers, the terminal adds all five messages to a new operable sequence version, increments the current operable sequence version number by one (the previous version number was 5, so the new version number is 6), and assigns operable sequence numbers 1 to 5 sequentially according to their order. The terminal submits the new operable sequence version record to the server for storage. After the server returns confirmation of version storage, the terminal sets this operable sequence version as the current operable sequence version and generates message reminders or message playback accordingly.

[0057] If the receiving terminal remains offline for longer than the preset session expiration time (default 1 day), the server will clear the terminal's offline message queue and session state after the session expires to release server storage resources. When the terminal reconnects, a new session needs to be established. The server will only resend messages that were not delivered after the session expired and whose message expiration time has not exceeded the default 7-day expiration time. Expired messages will not be resent. The server will inform the terminal of the discarded message identifier and its corresponding server sequence number in the resend response. If the number of unacknowledged messages accumulated during the offline period exceeds the offline message queue capacity limit of 200, the server will discard the messages exceeding the capacity limit in ascending order of server sequence number and inform the terminal of the discarded message records and their corresponding server sequence number ranges after reconnection.

[0058] For message records already marked as deleted within the scope of this resending, the server will not generate a resending frame for that message record. Instead, it will write the server sequence number of that message record into the deleted skip sequence number set. If the same voice message needs to be resent due to weak network, timeout, or duplicate requests, the server will use the original message identifier and the original server sequence number of that voice message, without regenerating the message identifier or the server sequence number.

[0059] The server sends the set of retransmitted frames and the set of deleted skipped sequence numbers to the receiving companion terminal. The set of retransmitted frames is arranged in ascending order according to the server's sequence number. If the retransmitted frames arrive out of order due to network transmission, the receiving companion terminal uses the server's sequence number carried in the retransmitted frames as the sorting basis, rather than the order of arrival of the protocol as the operational order.

[0060] After receiving the set of retransmitted frames and the set of deleted skipped sequence numbers, the receiving companion terminal first deduplicates messages based on their identifiers. If a message with the same identifier and server sequence number exists in the locally cached message records, the receiving companion terminal identifies the corresponding retransmitted frame as a duplicate and discards it. If the server sequence number corresponding to the same message identifier is inconsistent with the server sequence number in the locally cached message records, the receiving companion terminal does not use the retransmitted frame and outputs a sequence status inconsistency result to the server, requesting the server to retransmit the currently valid mapping relationship.

[0061] The receiving terminal sorts the deduplicated retransmission frames in ascending order of their server sequence numbers, and checks each frame sequentially starting from the next frame after the largest server sequence number confirmed by the receiving end. The check extends up to the largest server sequence number in both the retransmission frame set and the deleted skipped sequence number set. If both the retransmission frame set and the deleted skipped sequence number set are empty, the receiving terminal keeps the original largest server sequence number confirmed by the receiving end unchanged and outputs a result indicating no new messages.

[0062] When checking the server sequence number one by one, if a resend frame corresponding to the currently checked server sequence number exists, the receiving companion terminal writes the message corresponding to the resend frame into the local cache message record and adds the message to the new operable sequence version. If the currently checked server sequence number belongs to the deleted skipped sequence number set, the receiving companion terminal skips the server sequence number, does not generate a missing sequence number resend request, and treats the server sequence number as a confirmed processed sequence number. If the currently checked server sequence number does not exist in either the resend frame set or the deleted skipped sequence number set, the receiving companion terminal determines the server sequence number as the real missing sequence number, generates a missing sequence number resend request, and stops adding messages after the real missing sequence number to the current operable sequence version.

[0063] The receiving terminal updates the maximum confirmed server sequence number based on the continuous check results. If no truly missing sequence number exists, the maximum confirmed server sequence number is updated to the maximum server sequence number within the scope of this check. If a truly missing sequence number exists, the maximum confirmed server sequence number is updated to the maximum server sequence number that has been continuously confirmed and processed before the truly missing sequence number; the truly missing sequence number and subsequent server sequence numbers are not included in the scope of this confirmation.

[0064] The receiving terminal increments the current operable sequence version number by one to obtain a new operable sequence version number, and assigns an operable sequence number according to the order of the messages entering that version. Operable sequence numbers are numbered consecutively from the beginning, and are only assigned to messages in the current operable sequence version that have not been deleted and allow user action. Server sequence numbers already belonging to the deleted skip sequence number set do not occupy operable sequence numbers.

[0065] The receiving terminal submits the new operable sequence version record to the server for storage. The operable sequence version record includes at least the receiving terminal identifier, operable sequence version number, message identifier, server sequence number, and the mapping relationship between the operable sequence number.

[0066] After receiving the operable sequence version record, the server maintains a currently valid version number for each receiver identifier. When multiple receivers or multiple concurrent requests simultaneously submit operable sequence version records, the server sets the currently valid version through atomic comparison and swap. Specifically, the server stores the currently valid version number by receiver identifier, and at any given time, each receiver identifier has only one currently valid version. When saving a new version record, the server compares the submitted version number with the currently stored currently valid version number: if the submitted version number equals the currently valid version number plus one, the server updates the currently valid version number to the submitted version number through atomic comparison and swap operations and marks the new version as the currently valid version; if the submitted version number does not equal the currently valid version number plus one, the server rejects the submission and returns the currently valid version number, requiring the receiver to regenerate the operable sequence version.

[0067] After saving the operable sequence version record, the server returns a version save confirmation. Upon receiving the version save confirmation, the receiving terminal sets this operable sequence version as the current operable sequence version. The receiving terminal selects a voice message from the current operable sequence version for operation, and generates a presentation record when the voice prompt or message is played, such as... Figure 2 As shown, the receiving end generates a presentation record. If the receiving end companion terminal does not receive a version saving confirmation, the operable sequence version is in a pending synchronization state, and the receiving end companion terminal does not submit deletion, playback, or pause operation requests based on the operable sequence version in the pending synchronization state.

[0068] The receiving terminal generates a message reminder or plays a message based on the current operable sequence version. At any given time, the receiving terminal selects only one message from the current operable sequence version for voice reminder or playback. If the terminal speaker is already outputting a message's voice reminder or playback, the newly arrived retransmission frame can only enter the next sequence reconstruction, without changing the operable sequence version number, operable sequence number, or message identifier of the currently output message.

[0069] When the receiving companion terminal begins outputting a voice reminder or playing a message, it generates a presentation record identifier and records the message identifier, server sequence number, operable sequence version number, operable sequence number, presentation type, and voice output start time. Presentation types include message reminder and message playback. The voice output start time is recorded using the receiving companion terminal's local monotonic clock. When the voice reminder or playback ends, the receiving companion terminal records the voice output end time, forming a presentation record. The presentation record is used to subsequently bind the current message, this message, and other voice commands to the messages the user is actually hearing or is currently hearing. The receiving terminal associates and binds the voice message content with corresponding control and interactive voice commands, enabling synchronous triggering of corresponding terminal operations during message playback.

[0070] The receiving companion terminal collects the user's voice through a microphone and generates command events through a voice recognition unit. Each command event includes at least a command event identifier, command text, command start time, command end time, and recognition confidence level. The command start and end times are recorded using the same local monotonic clock as the presentation record. The command event identifier is generated by the receiving companion terminal for each voice command event and is used by the server to identify repeatedly submitted operation requests in weak network environments.

[0071] The receiving terminal first compares the recognition confidence score with a confidence threshold. The recognition confidence score is a quantitative evaluation of how well the speech recognition result matches the user's actual voice commands. The confidence threshold can be preset based on the speech recognition test results, device speaker volume, microphone sensitivity, and ambient noise level. Figure 5 As shown, the terminal collects and recognizes voice commands, which then undergo a confidence level assessment. If the voice recognition confidence level is insufficient, the command is not bound and no receipt is generated. If the recognition result is reliable, the target message is bound according to the rules. The current voice command is associated with the corresponding voice message, and the binding relationship, voice message, and command content are integrated to generate an operation request. Deletion operations are marked as pending confirmation. If the recognition confidence level is less than the confidence level threshold, the receiving terminal does not bind the message identifier and outputs an unbound command event. Unbound command events do not generate playback receipts, deletion receipts, or pause receipts.

[0072] If the recognition confidence level is not less than the confidence threshold, the receiving terminal continues to evaluate the instruction text. When the instruction text contains the nth instruction, the receiving terminal searches for a message with an operable sequence number equal to n in the current operable sequence version. If a corresponding message exists, the receiving terminal uses the message identifier of that message as the target message identifier and generates a binding result. The binding result includes at least the operation type, target message identifier, server sequence number, operable sequence version number, and operable sequence number. If there is no message with an operable sequence number equal to n in the current operable sequence version, the receiving terminal outputs an unbound instruction event.

[0073] When the instruction text contains specific phrases such as "current message," "past messages," "this message," "pause the current message," or "delete the current message," pointing to the currently displayed object, the receiving terminal searches for the most recent display record. The receiving terminal searches for display records within a preset backtracking time window. This preset backtracking time window is used as the time base to limit the time range for searching display records backwards. The receiving terminal determines whether a display record meets two conditions: first, the output duration between the start time of the voice output of the display record and the start time of the instruction is not less than the perceptible duration; second, the start time of the instruction relative to the end time of the voice output of the display record does not exceed the binding window duration. If the start time of the instruction is earlier than the end time of the voice output, the time interval in the second condition is treated as zero. The perceptible duration represents the minimum output duration required for the user to perceive the message, and the binding window duration represents the maximum time that voice instructions such as the current message are allowed to be bound to the display record after it ends.

[0074] If only one presentation record meets the above two conditions, the receiving companion terminal uses the message identifier in that presentation record as the target message identifier and writes the operable sequence version number and operable sequence number from that presentation record into the binding result. If zero or more presentation records meet the above two conditions, the receiving companion terminal outputs an unbound command event. Through this process, the current message is not bound to the most recently arrived message at the communication layer, but rather to a message that the user has actually heard or is currently hearing.

[0075] When the instruction text only contains the message to be played and does not include a sequence number or current pointer, the receiving companion terminal selects the message with the smallest operable sequence number that has not yet been played as the target message from the currently operable sequence version. If there are no messages that have not yet been played, the receiving companion terminal outputs a result indicating that there are no messages to play and does not generate a playback operation request. If there are messages that have not yet been played, the receiving companion terminal uses the message identifier of that message as the target message identifier and generates a binding result for the playback type.

[0076] like Figure 2The receiving terminal generates an operation request based on the binding result and sends it to the server for validity verification. If the binding result is an unbound command event, the receiving terminal does not generate an operation request. If the binding result contains a target message identifier and the operation type is not deletion, the receiving terminal generates an operation request. This operation request needs to carry the receiving terminal identifier, operation type, target message identifier, server sequence number, operable sequence version number, operable sequence number, command event identifier, and presentation record identifier. Operation types include play, pause, and other operations that do not change the message deletion status.

[0077] For playback operations, if the local voice content is cached, the receiving companion terminal directly uses the local voice content for playback. If the local voice content is not cached but a voice content storage address exists in the locally cached message record, the receiving companion terminal only accesses the voice content storage address if the message is neither marked as deleted nor marked as pending confirmation of deletion. If the voice content storage address is inaccessible, the receiving companion terminal outputs a result indicating that playback is temporarily unavailable and does not generate a playback receipt. If the message has been marked as deleted or pending confirmation of deletion, the receiving companion terminal prohibits playback of the message and outputs a result indicating that the message cannot be operated on.

[0078] If the binding result contains a target message identifier and the operation type is deletion, the receiving companion terminal first reads the number of locally pending deletion markers. Local pending deletion markers indicate the message status where the receiving companion terminal has submitted a deletion request to the server but has not yet received acceptance from the server. The maximum number of pending deletion markers is the maximum number of locally pending deletion markers that the receiving companion terminal is allowed to retain simultaneously; its value is an integer not less than one and not exceeding the number of voice messages that the receiving terminal can store locally.

[0079] When the number of locally pending deletion markers is less than the maximum number of pending deletions, the receiving companion terminal generates a deletion operation request. The deletion operation request carries at least the receiver identifier, operation type, target message identifier, server sequence number, operable sequence version number, operable sequence number, instruction event identifier, and presentation record identifier. The receiving companion terminal simultaneously marks the target message as pending deletion, but does not physically delete the message's audio content locally until the server returns the verification result. In the pending deletion state, the message will no longer be selected as a new message notification target, nor will a new deletion operation request be generated. If the server subsequently rejects the deletion operation request, the receiving companion terminal removes the locally pending deletion marker for that message.

[0080] When the number of local pending deletion markers is greater than or equal to the maximum number of pending deletions, the receiving companion terminal does not generate a deletion operation request, does not delete local voice content, and outputs a deletion postponement result. The deletion postponement result is used to indicate that there are still deletion operations that have not been confirmed by the server. The receiving companion terminal can re-accept deletion voice commands after any pending deletion marker is cleared.

[0081] After receiving an operation request, the server first checks whether the same operation request has already been processed based on the instruction event identifier. If the server has already processed the same instruction event identifier and the target message identifier, server sequence number, operable sequence version number, operable sequence number, and operation type of the operation request are all consistent with the historical processing record, the server returns the original processing result. If the server has already processed the same instruction event identifier but any of the above fields in the current operation request are inconsistent with the historical processing record, the server does not change the message status and returns an operation verification rejection result.

[0082] If the server has not processed the instruction event identifier, it reads the message record stored on the server based on the receiver identifier and target message identifier in the operation request, and compares whether the server sequence number in the operation request matches the server sequence number in the message record. The server also reads the receiver's operable sequence version record and compares whether the operable sequence version number and operable sequence number in the operation request can map to the same target message identifier. If the target message record already has a deleted mark, the server treats it as a mismatch.

[0083] The server accepts the operation request when the target message identifier, server sequence number, operable sequence version number, and operable sequence number are all consistent, and the target message record does not have a deleted mark. If the operation type is play, the server writes a play mark to the corresponding message record. If the operation type is delete, the server writes a delete mark to the corresponding message record and retains the server sequence number of the message. If the operation type is pause, the server writes the pause position or pause mark to the corresponding message record. The server associates and saves the processing result with the instruction event identifier so that subsequent repeated operation requests can return the same result.

[0084] If any validation field is inconsistent, the server will not change the message status and will return an operation validation rejection result, which will also carry the currently valid mapping relationship of the receiving end. The currently valid mapping relationship includes at least the correspondence between the currently valid operable sequence version number, message identifier, server sequence number, and operable sequence number. The receiving end companion terminal reconstructs the local operable sequence version based on the currently valid mapping relationship, and subsequent voice commands will only apply to the reconstructed operable sequence version.

[0085] In this invention, the process of binding voice commands to message instances is completed by the receiving terminal. Through mechanisms such as confidence threshold judgment, record filtering, perceptible duration, and binding window duration, it ensures that the voice command is bound as accurately as possible to the message corresponding to the user's actual intent. The server-side consistency check, based on this binding result, performs a data-level logical consistency verification on the server sequence number, operable sequence version number, and operable sequence number in the operation request. That is, it verifies whether these three independent parameters can be mapped to the same target message identifier, preventing erroneous receipt submissions due to incorrect local terminal state.

[0086] The semantic correctness of user intent is ensured by the speech recognition and command binding processes. Server-side consistency verification avoids resolving this issue. These two technologies belong to different levels and together form a complete closed loop from voice command to operation receipt. This invention, by setting corresponding verification mechanisms at different stages, ensures both the accuracy of command binding and the legitimacy of operation requests, avoiding the system complexity and uncertainty brought about by introducing semantic understanding logic into the data verification layer.

[0087] like Figure 2 As shown, after the server completes the verification, it sends the verification result to the receiving end, which adjusts the terminal sequence according to the verification. The receiving end accompanies the terminal after receiving the operation verification result returned by the server and adjusts its local state. If the server returns "accepted," the receiving end accompanies the terminal and updates the local message status according to the target message identifier. For deletion operations, the receiving end accompanies the terminal deletes the local voice content or hides the message, clears the message's local pending deletion mark, and removes the message from the local pending deletion count. The receiving end accompanies the terminal then regenerates the next operable sequence version based on the remaining undeleted messages and submits the next operable sequence version record to the server for storage.

[0088] For playback, the receiving terminal marks the message as played, but does not change the message identifier and server sequence number of that message, nor does it change the message identifier and server sequence number of other messages. For pause, the receiving terminal saves the pause position or pause mark according to the server's accepted result. The pause position is used to resume playback of the target message from the corresponding position later.

[0089] If the server returns a rejection, the receiving terminal removes the local pending deletion mark for the corresponding message, so that the message is no longer counted in the local pending deletion mark count. The receiving terminal reconstructs the operable sequence version according to the currently valid mapping relationship returned by the server, and sets the reconstructed operable sequence version as the current operable sequence version. After reconstruction, the operable sequence number in the original operable sequence version will no longer be used as the binding basis for subsequent voice commands.

[0090] In one specific example, the receiving end has confirmed that the maximum server sequence number is 100, and the current maximum server sequence number is 104. The range for this retransmission is 101 to 104. The server reads that the message records corresponding to server sequence numbers 101, 103, and 104 have not been deleted, while the message record corresponding to server sequence number 102 has been deleted. The server generates retransmission frames corresponding to server sequence numbers 101, 103, and 104, and adds server sequence number 102 to the deleted skipped sequence number set.

[0091] The receiving terminal starts checking from 101. If a resend frame corresponding to server sequence number 101 exists, the message is added to a new operable sequence version. If server sequence number 102 belongs to the set of deleted skipped sequence numbers, this server sequence number is skipped, and no resend request for the missing sequence number is generated. If resend frames corresponding to server sequence numbers 103 and 104 both exist, they are added to new operable sequence versions respectively. The receiving terminal sets the operable sequence version number to the previous version number plus one, and assigns operable sequence numbers 1, 2, and 3 to the messages corresponding to server sequence numbers 101, 103, and 104 respectively. Therefore, server sequence number 102 corresponding to a deleted message does not occupy an operable sequence number, nor does it block the messages corresponding to server sequence numbers 103 and 104 from entering the operable sequence version.

[0092] In another specific example, the receiving end has confirmed that the maximum server sequence number is 100. The set of resend frames returned by the server includes resend frames corresponding to server sequence numbers 101 and 104, and the set of deleted skipped sequence numbers includes server sequence number 102. When the receiving end's accompanying terminal checks for server sequence number 103, it finds that server sequence number 103 does not exist in either the resend frame set or the deleted skipped sequence number set. Therefore, it determines server sequence number 103 as the actual missing sequence number and generates a missing sequence number resend request. The message corresponding to server sequence number 104 will not be included in this operable sequence version. The receiving end has confirmed that the maximum server sequence number has been updated to 102, not 104.

[0093] In another specific example, the receiving companion terminal provides a voice prompt for the message corresponding to operational sequence number 2 in the current operational sequence version and generates a presentation record for that message. This presentation record includes the message identifier, server sequence number, operational sequence version number, operational sequence number 2, presentation type, and voice output start time. The user says "Delete current message" within one second after the voice prompt ends. If the output duration of the presentation record is not less than the perceptible duration, and the time between the command start time and the voice output end time is not greater than the binding window duration, then the receiving companion terminal uses the message identifier in the presentation record as the target message identifier, rather than using a newly received message or the most recently received message in the current communication layer as the target message.

[0094] In this embodiment, the confidence threshold, perceptible duration, binding window duration, and maximum number of deletions to be confirmed can all be preset at the factory when the receiving terminal is shipped, or can be issued by the server according to the device model. For example, the confidence threshold can be set to 0.70, the perceptible duration can be set to 0.8 seconds, the binding window duration can be set to 3 seconds, and the maximum number of deletions to be confirmed can be set to 3. The above values ​​are only one possible implementation; in actual use, they can be configured according to the speech recognition model, speaker playback volume, terminal local cache capacity, and network stability.

[0095] Example 2, building upon Example 1, further provides methods for handling various abnormal branches and boundary conditions that may occur during the main process execution. If the same server sequence number appears simultaneously in both the retransmission frame set and the deleted skipped sequence number set in the retransmission frames received by the receiving terminal, the receiving terminal will not add the message corresponding to that server sequence number to the current operable sequence version and will send a sequence status inconsistency result to the server. After receiving the sequence status inconsistency result, the server will reread the currently valid message records and deleted message records of the receiving terminal and regenerate the retransmission frame set and the deleted skipped sequence number set.

[0096] If the server sequence number carried in the retransmission frame received by the receiving terminal is not greater than the largest server sequence number confirmed by the receiving terminal, the receiving terminal identifies the retransmission frame as an old retransmission frame. If the message identifier and server sequence number of the old retransmission frame match the locally cached message record, the receiving terminal discards the old retransmission frame. If the message identifier or server sequence number of the old retransmission frame does not match the locally cached message record, the receiving terminal outputs a sequence status inconsistency result and requests the server to return the currently valid mapping relationship.

[0097] If the receiving terminal does not have any undeleted and operable messages in the current operable sequence version, it outputs a "No operable messages" result. In this case, the receiving terminal does not generate playback, deletion, or pause operation requests.

[0098] If the local display record is lost after the receiving terminal restarts, the receiving terminal will not bind the target message based on the current message, this message, pause, delete the current message, or other currently pointing expressions. In this case, the receiving terminal can continue to bind based on voice commands containing a clear operable sequence number, such as the nth command; if the voice command does not contain a clear operable sequence number, an unbound command event will be output.

[0099] If the server finds that the operable sequence version number is lower than the currently valid operable sequence version number stored on the server when verifying the operation request, the server classifies the operation request as an old version operation request. The server does not change the message status and returns the currently valid mapping relationship. If the operable sequence version number received by the server is higher than the currently valid operable sequence version number stored on the server, the server classifies the operation request as an abnormal version operation request. The server does not change the message status and requests the receiving end to assist the terminal in resubmitting the operable sequence version record or re-performing sequence reconstruction.

[0100] If duplicate operation requests, duplicate receipts, or out-of-order receipts occur between the server and the receiving terminal, the server will perform idempotent processing using the instruction event identifier and will use the consistency check result of the message identifier, server sequence number, operable sequence version number, and operable sequence number as the basis for whether to change the message status. Old operation requests must not overwrite already written deleted markers, played markers, pause markers, or currently valid mapping relationships.

[0101] If multiple connection sessions submit operation requests for the same receiver identifier, the server performs single-object serial processing using the receiver identifier and message identifier as objects, or uses any equivalent method among database transactions, object locks, and version number comparisons to ensure that the same message state is not overwritten by old requests. For the same message, the deleted mark is the final state. After a message record is marked as deleted, the server will no longer generate a resend frame for that message, will no longer accept new playback or pause operation requests for that message, and will write the message's server sequence number into the deleted skip sequence number set in subsequent resends.

[0102] If the voice content storage address is invalid, the voice content file is missing, or the terminal download fails, the receiving companion terminal will not mark the message as played, nor will it generate a playback receipt. The receiving companion terminal can output a message that playback is temporarily unavailable and request the server to resend a valid voice content storage address for the message during the next reconnection. If the server confirms that the message has been deleted, the server will not resend the voice content storage address, but will instead add the message's server sequence number to the deleted skipped sequence number set.

[0103] If the recognition confidence level is lower than the confidence threshold, the command text cannot be parsed, the operable sequence number does not exist, the presented record does not meet the perceptible duration condition, the presented record exceeds the binding window duration, or multiple presented records simultaneously meet the binding conditions, the receiving terminal will output an unbound command event. The unbound command event does not change the local message status, nor does it change the server-side message status.

[0104] If the number of pending deletion markers reaches the maximum, the receiving terminal will output a deletion postponement result and ensure that the local voice content of the message to be deleted is not physically deleted. If any subsequent pending deletion marker is cleared because the server has accepted or rejected it, the receiving terminal will recalculate the number of local pending deletion markers and resume processing of the deletion voice command.

[0105] Example 3, based on Example 1, provides a voice-message-based companion terminal message flow system. This system includes a sending companion terminal, a server, and a receiving companion terminal. The server includes a message entry module, a resend frame generation module, a version record storage module, and an operation verification module. The receiving companion terminal includes a sequence reconstruction module, a presentation record module, an instruction binding module, an operation request generation module, and a terminal sequence adjustment module.

[0106] The message entry module is used to receive the voice message content, sender identifier, and receiver identifier submitted by the sending terminal. It generates a message identifier for the voice message, generates a server sequence number based on the receiver identifier, and writes the message identifier, sender identifier, receiver identifier, server sequence number, voice content storage address, and undelivered flag into the server message record.

[0107] The retransmission frame generation module is used to determine the scope of this retransmission after the receiving companion terminal reconnects, based on the maximum server sequence number confirmed by the receiving end and the current maximum server sequence number of the server; generate retransmission frames for message records that have not been deleted within the scope of this retransmission; write the server sequence number of message records that have been deleted within the scope of this retransmission into the deleted skip sequence number set; and send the retransmission frame set and the deleted skip sequence number set to the receiving companion terminal.

[0108] The sequence reconstruction module receives the resend frame set and the deleted skip sequence number set, removes duplicates by message identifier, sorts them by server sequence number, and checks each message one by one starting from the next number after the largest server sequence number confirmed by the receiver. If a resend frame exists, the corresponding message is added to the new operable sequence version. If the server sequence number belongs to the deleted skip sequence number set, the server sequence number is skipped. If the server sequence number does not exist in either the resend frame set or the deleted skip sequence number set, a missing sequence number resend request is generated, and messages after the actual missing sequence number are prevented from entering the current operable sequence version.

[0109] The version record saving module is used to save the operational sequence version record submitted by the receiving companion terminal. The operational sequence version record includes at least the receiving terminal identifier, operational sequence version number, message identifier, server sequence number, and the mapping relationship between the operational sequence number and the operational sequence number. After successful saving, the version record saving module returns a version saving confirmation to the receiving companion terminal.

[0110] The server maintains a currently valid operable sequence version number for each receiver. This version number is the largest among all operable sequence version records saved by that receiver. Whenever the server successfully saves a new operable sequence version record, it compares the new version number with the currently stored valid version number: if the new version number is greater than the currently valid version number, the server updates the currently valid version number to the new version number; if the new version number is not greater than the currently valid version number, the server keeps the currently valid version number unchanged and marks the new version record as an expired version.

[0111] The presentation recording module records the message identifier, server sequence number, operable sequence version number, operable sequence number, presentation type, voice output start time, and presentation record identifier when the receiving terminal begins outputting a voice reminder or playing a voice message. It also records the voice output end time when the voice reminder or playback ends, thus forming a presentation record. Before a presentation record has ended, the presentation recording module does not allow newly arriving retransmission frames to modify the message identifier, operable sequence version number, or operable sequence number in that presentation record.

[0112] The instruction binding module receives instruction events obtained from speech recognition, compares the recognition confidence level with a confidence threshold, and binds the voice instruction to the target message based on the instruction text when the recognition confidence level is not less than the confidence threshold. For instruction text containing the nth instruction, the instruction binding module searches for the target message in the current operable sequence version by operable sequence number; for instruction text containing "current message," "this message," "pause," or "delete current message," the instruction binding module searches for the target message based on the presentation record, perceived duration, and binding window duration; for instruction text containing only "play message," the instruction binding module selects the message with the smallest operable sequence number in the current operable sequence version that has not yet finished playing as the target message.

[0113] The operation request generation module is used to generate playback, deletion, or pause operation requests based on the binding results. For deletion operations, the module first counts the number of locally pending deletion confirmation markers; when the number of locally pending deletion confirmation markers is less than the maximum number of pending deletion confirmation markers, a deletion operation request is generated and the corresponding message is marked as pending deletion confirmation; when the number of locally pending deletion confirmation markers is greater than or equal to the maximum number of pending deletion confirmation markers, no deletion operation request is generated, and a deletion postponement result is output.

[0114] The operation verification module receives operation requests, identifies duplicate requests based on the instruction event identifier, and performs consistency verification based on the message identifier, server sequence number, operable sequence version number, and operable sequence number. For example... Figure 5As shown, when the consistency check passes and the message does not have a deleted mark, the operation verification module executes the corresponding operation and returns an accepted result. When the consistency check fails or the message already has a deleted mark, the operation verification module does not change the message status and returns a rejected result and the current valid mapping relationship. If it is a duplicate request, the original result is returned, and finally the receiving end updates its local status.

[0115] The terminal sequence adjustment module adjusts the local operable sequence version and local message status based on the operation verification result returned by the server. When the server returns an accepted result, the terminal sequence adjustment module updates the local message status according to the target message identifier; for deletion operations, it deletes or hides the local voice content, clears the local pending deletion mark, and regenerates the next operable sequence version based on the remaining undeleted messages. When the server returns a rejected result, the terminal sequence adjustment module removes the local pending deletion mark of the corresponding message and reconstructs the operable sequence version according to the current valid mapping relationship returned by the server.

[0116] In this system, the message entry module, resend frame generation module, version record storage module, and operation verification module can be deployed on the same server or on a server cluster consisting of multiple servers. The sequence reconstruction module, presentation record module, instruction binding module, operation request generation module, and terminal sequence adjustment module can be deployed in the processor of the receiving companion terminal, or they can be implemented collaboratively by the receiving companion terminal and the local voice processing chip, communication module, and storage module.

[0117] This invention maintains the server-generated order through server-side sequence numbers, distinguishes between legitimate skipped numbers caused by deletion and genuine missing numbers caused by weak networks through a set of deleted skipped sequence numbers, forms a user-oriented operable sequence through operable sequence version numbers and operable sequence numbers, binds the displayed messages to the messages the user actually hears or is currently hearing, avoids duplicate receipts and old version receipts changing the message status through command event identifiers and server consistency checks, and ensures that the local operable sequence version is consistent with the server's valid state through terminal sequence adjustment. Therefore, the entire process of voice messaging—from sending, resending, reminding, playing, deleting, pausing, receiving receipts, to local adjustment—revolves around a closed loop based on the same message identifier.

[0118] It should be noted that, in this document, the terms "comprising," "including," and any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Specific embodiments have been used in this document to illustrate the principles and implementation methods of the technical solutions of the present invention. The above examples are merely to help understand the method and core ideas of the present invention. The above are only preferred embodiments of the present invention. It should be pointed out that, due to the limitations of textual expression, and the objective existence of infinite specific structures, those skilled in the art can make several improvements, modifications, or changes without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes, or combinations, or the direct application of the concept and technical solutions of the present invention to other situations without modification, should all be considered within the scope of protection of the present invention.

Claims

1. A message flow method for a companion terminal based on voice messaging, executed by a server, characterized in that, include: The system receives and stores the voice messages submitted by the sender, generates a unique message identifier for each voice message, and assigns a server sequence number based on the receiver identifier. The server sequence number remains unchanged throughout the message's lifecycle. When the receiving end reconnects from an offline state, the server responds to the receiving end's reconnection request by reading the maximum confirmed server sequence number corresponding to the receiving end using the receiving end identifier, determining the resend range, reading message records whose server sequence number is greater than the maximum confirmed server sequence number of the receiving end and have not been deleted, generating a resend frame, the resend frame carrying the message identifier and server sequence number, and sending the resend frame to the receiving end. The receiver receives the operable sequence version record submitted by the receiving end based on the resent frame, deduplicated by message identifier and sorted by server sequence number. The operable sequence version record includes the mapping relationship between receiver identifier, operable sequence version number, message identifier, server sequence number and operable sequence number. After saving the operable sequence version record, the receiver returns a version saving confirmation to the receiving end. When the receiving end receives the confirmation, it sets the operable sequence version to the current operable sequence version, and performs voice prompts or playback, generates presentation records, and binds voice commands to the target message identifier based on the current operable sequence version. After generating an operation request, it receives the operation request submitted by the receiving end. The operation request carries the operation type, target message identifier, server sequence number, operable sequence version number, instruction event identifier, and operable sequence number. The operation request is then checked for consistency. The verification result is sent to the receiving end, which updates the local message status based on the verification result. If the verification result is "accepted", an operable sequence version is regenerated. If the verification result is "rejected", an operable sequence version is reconstructed according to the mapping relationship.

2. The method for message flow in a companion terminal based on voice messaging according to claim 1, characterized in that, The steps of deduplicating messages by identifier and sorting them by server sequence number include: The receiver receives the operable sequence version record submitted by the receiving end. The operable sequence version is formed by the receiving end by deduplicating the message identifier, deleting duplicate resend frames that already exist locally and have the same server sequence number, arranging the remaining resend frames in ascending order of server sequence number, and checking the continuity starting from the next number after the confirmed largest server sequence number. If the resend frame corresponding to the currently checked server sequence number exists, the corresponding message is added to the new operable sequence version and an operable sequence number is assigned according to the arrangement position. If the currently checked server sequence number belongs to the set of deleted skipped sequence numbers, then skip the server sequence number and do not generate a request to resend the missing sequence number; If the currently checked server sequence number does not exist in either the resend frame set or the deleted skipped sequence number set, the receiving end determines the server sequence number as the real missing sequence number, generates a missing sequence number resend request, and messages after the real missing sequence number will not be included in the current operable sequence version for the time being. Receive and save the operable sequence version record and the corresponding missing sequence number resending request.

3. The method for message flow in a companion terminal based on voice messaging according to claim 1, characterized in that, The generated presentation record includes: The receiving end selects a message from the currently operable sequence version to provide a voice reminder or play the message, and records the message identifier, operable sequence version number, operable sequence number, presentation type, voice output start time and voice output end time to form a complete presentation record; Before the presentation record ends, newly arriving retransmission frames do not change the operable sequence number in the current presentation record, but only enter the next sequence reconstruction.

4. The method for message flow in a companion terminal based on voice messaging according to claim 1, characterized in that, The step of binding the voice command to the target message identifier includes: The receiving end first compares the recognition confidence level with the confidence level threshold. If the recognition confidence level is lower than the confidence level threshold, the message identifier is not bound and an unbound command event is output. If the recognition confidence level is not lower than the confidence threshold, then the binding is performed according to the instruction text; If there is only one display record that meets the conditions, the message identifier in that display record will be used as the target message identifier. If the instruction text contains sequence number information, then search for the message with the matching operable sequence number in the current operable sequence version as the target message; If the instruction text contains an expression pointing to the currently rendered object, then search for a rendering record in the most recent rendering record that meets the perceptible duration condition and the bound window duration condition, and use the message identifier recorded in that record as the target message identifier.

5. A message flow method for a companion terminal based on voice messaging according to claim 1, characterized in that, The consistency check of the operation request includes: The server checks whether the same operation request has been processed before based on the instruction event identifier in the operation request. If it has been processed, the original processing result is returned. If not processed, the message record is read according to the target message identifier, and the server sequence number is compared to see if they are consistent. Then, the operable sequence version number and operable sequence number in the operation request are compared to see if they can be mapped to the same target message identifier. If the comparisons are consistent, the server performs the corresponding operation and returns the accepted result. If any comparison is inconsistent, the message status is not changed, and the server returns the mapping relationship between the currently valid message identifier, the server sequence number, and the operable sequence number.

6. The method for message flow in a companion terminal based on voice messaging according to claim 1, characterized in that, The operation request includes a deletion operation, as detailed below: A pending confirmation deletion mechanism is adopted. The receiving end does not delete the local voice content before the server returns the verification result. Instead, it marks the message as pending confirmation deletion. The pending confirmation deletion mark is used to cancel the deletion operation when the server rejects it, and to perform the actual deletion when the server accepts it.

7. A message flow method for a companion terminal based on voice messaging according to claim 6, characterized in that, The specific steps for the receiving end to update the local message status based on the verification result include: If the verification result is accepted, update the local message status according to the target message identifier. For deletion operations, delete the local audio content or hide the message, and regenerate the next operable sequence version based on the remaining undeleted messages. For playback operations, mark the message as played. If the verification result is rejected, the local pending deletion mark is removed, and the operable sequence version is reconstructed according to the current valid mapping relationship returned by the server. After reconstruction, voice commands only apply to the new operable sequence version.

8. A message flow method for a companion terminal based on voice messaging according to claim 1, characterized in that, The operable sequence version number and the operable sequence number also include: The operable sequence version number and the operable sequence number are independent of each other, and together they form the basis for the mapping of the voice command to the message according to the sequence number. The operable sequence version number is incremented each time an operable sequence version is generated. When the receiving end reconstructs the operable sequence version according to the current valid mapping relationship returned by the server, the operable sequence version number adopts the version number in the current valid mapping relationship to identify that the operable sequence number of the same message is different in different versions. The operable sequence number of the old version does not have the mapping effect in the new version. The operable sequence number is the sequential number arranged in ascending order of the server sequence number in the current operable sequence version, and is used to directly correspond to the sequential expression of the message in the voice command; The combination of the operable sequence version number and the operable sequence number uniquely identifies a message in the current operable sequence version. The same message identifier has different operable sequence numbers in different operable sequence versions, and the same operable sequence number can correspond to different message identifiers in different operable sequence versions. The server sequence number remains unchanged throughout the message's lifecycle and is independent of the operable sequence version number and the operable sequence number. After the receiving end finds the corresponding message identifier based on the operable sequence version number and the operable sequence number, it obtains the corresponding server sequence number through the message identifier for submitting the operation request.

9. A companion terminal message flow system based on voice messaging, characterized in that, include: The message entry module is used to receive the voice message content, sender identifier, and receiver identifier submitted by the sending terminal, generate a message identifier for the voice message, generate a server sequence number based on the receiver identifier, and write the message identifier, sender identifier, receiver identifier, server sequence number, voice content storage address, and undelivered mark into the server message record. The resend frame generation module is used to determine the scope of this resend after the receiving terminal reconnects, based on the maximum server sequence number confirmed by the receiving end and the current maximum server sequence number of the server; and to generate resend frames for message records that have not been deleted within the scope of this resend. For message records that have been deleted within the scope of this resend, their server sequence numbers are written into the deleted skip sequence number set; and the resend frame set and the deleted skip sequence number set are sent to the receiving companion terminal. The version record saving module is used to save the operable sequence version record submitted by the receiving companion terminal. The operable sequence version record includes at least the mapping relationship between the receiving terminal identifier, operable sequence version number, message identifier, server sequence number and operable sequence number. After successful saving, the module returns a version saving confirmation to the receiving companion terminal. The operation verification module receives operation requests, identifies duplicate requests based on the instruction event identifier, and performs consistency verification based on the message identifier, server sequence number, operable sequence version number, and operable sequence number. When the consistency verification passes and the message does not have a deleted mark, the corresponding operation is executed and an accepted result is returned. When the consistency verification fails or the message already has a deleted mark, the message status is not changed, and a rejected result and the current valid mapping relationship are returned.

10. A message flow method for a companion terminal based on voice messaging, executed by the receiving end, characterized in that, include: After the receiving end receives the voice message from the server, each message carries a unique message identifier generated by the server, and a server sequence number is assigned based on the receiving end identifier. The server sequence number remains unchanged throughout the message's lifecycle. When the receiving end recovers from offline to online, it sends a reconnection request to the server and establishes a communication connection with the server. After the receiving end reconnects, it receives a resend frame from the server. The resend frame is generated by the server reading the message record after the confirmed maximum server sequence number that has not been deleted. The resend frame carries the message identifier and the server sequence number. After receiving the retransmitted frame, the receiving end first removes duplicates according to the message identifier, sorts the server sequence number and checks the continuity to form an operable sequence version. Each message in the operable sequence version has a message identifier, a server sequence number and an operable sequence number. The receiving end selects a voice message from the currently operable sequence version for operation, and generates a presentation record when the voice prompt or the message is played. The presentation record records the message identifier, operable sequence version number and voice output time of the message. The receiving end, based on the voice command and the presentation record, binds the voice command to the target message identifier, generating a message including... Operation request including operation type, target message identifier, server sequence number, operable sequence version number, instruction event identifier, and operable sequence number; The operation request is submitted to the server, and the verification result returned by the server is received. The verification result is generated by the server after performing a consistency check based on the server sequence number, operable sequence version number and operable sequence number in the operation request. The receiving end updates the local message status based on the verification result, and regenerates an operable sequence version after the deletion operation is successful.

Citation Information

Patent Citations

  • Message notification methods, message sending methods, and related devices and equipment

    CN110896376B

  • Internet of Things control system and method, electronic device, storage medium and program product

    CN121771251A