Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, in the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "e.g.," an embodiment of the present invention is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
It should be noted that, in the embodiments of the present invention, "of", "corresponding" and "corresponding" may be sometimes used in combination, and it should be noted that, when the difference is not emphasized, the intended meaning is consistent.
For the convenience of clearly describing the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, the words "first", "second", and the like are used for distinguishing the same items or similar items with basically the same functions and actions, and those skilled in the art can understand that the words "first", "second", and the like are not limited in number or execution order.
When the existing household camera is in communication with a mobile phone, if the network environment is poor, the communication signal strength can be affected, so that the communication quality between the furniture camera and the mobile phone is poor, and the user experience is very poor.
In order to solve the above problem, embodiments of the present invention provide a call switching method and a server.
As shown in fig. 1, a system architecture used in the technical solution provided by the embodiment of the present invention includes: camera 01, server 02, first handset 03 and second handset 04.
The camera 01 has a pickup function and a video acquisition function, and can transmit acquired data to the server 02. The camera 01 realizes a call with the first mobile phone 03 through the server 02.
And the server 02 is used for connecting the camera 01 and the first mobile phone 03.
The first mobile phone 03 and the second mobile phone 04 can be bound with the camera 01 by scanning the two-dimensional code on the camera 01. Meanwhile, the first mobile phone 03 and the second mobile phone 04 can be connected with the server 02 based on the client APP in the mobile phone.
In the embodiment of the application, the first mobile phone 03 and the second mobile phone 04 are both bound to the camera 01, and the camera 01 communicates with the first mobile phone 03 through the server 02, where the communication may be a voice communication or a video communication.
Based on the system architecture, the embodiment of the invention is applied to a scene that the camera establishes communication with the first mobile phone based on the server, the first user uses the camera, and the second user uses the first mobile phone, so that the first user and the second user can communicate.
Referring to fig. 2, an embodiment of the present invention provides a communication handover method, including the following steps:
s101, the server acquires the first signal intensity and the second signal intensity.
The first signal intensity is the signal intensity of the call between the camera and the first mobile phone in the current period; the second signal strength is the signal strength of the communication between the camera and the first mobile phone in the previous period.
The signal intensity may be an average value of signal intensities in a cycle or a signal intensity at a certain time in a cycle.
S102, the server judges whether the first signal intensity is smaller than the second signal intensity.
In a possible situation, if the server determines that the first signal strength is greater than or equal to the second signal strength, it indicates that the call quality of the call between the first user using the camera and the second user using the first mobile phone is improved. Thus, the server maintains a call between the camera and the first handset.
In another possible situation, if the server determines that the first signal strength is smaller than the second signal strength, it indicates that the call quality of the call between the first user using the camera and the second user using the first mobile phone is degraded, but the server does not determine whether the call between the first user using the camera and the second user using the first mobile phone is not normal. Therefore, the server needs to further determine the call between the first user and the second user, i.e., the server performs step S103.
S103, the server detects whether the server and the first mobile phone keep heartbeat connection or not.
Optionally, the client APP on the first mobile phone establishes a call with the server through a long connection of a Transmission Control Protocol (TCP).
Optionally, the heartbeat connection may be that the client APP periodically sends a piece of heartbeat information to the server through the first mobile phone, so as to ensure a corresponding connection between the client APP on the first mobile phone and the server. For example, the first mobile phone sends a data packet to the server every 30 seconds, and the data packet is used for instructing the server to determine that the client APP on the first mobile phone keeps connected with the server.
As a possible implementation manner, if the server periodically receives the heartbeat information sent by the first mobile phone, it indicates that the server and the first mobile phone maintain the heartbeat connection. If the server fails to periodically receive the heartbeat information sent by the first mobile phone, the server indicates that the heartbeat connection between the server and the first mobile phone is not kept.
It should be noted that, under the condition that the first signal strength is smaller than the second signal strength, when the server determines that the server and the first mobile phone do not maintain the heartbeat connection, the server determines that the call quality represented by the first signal strength is very poor, and the first user and the second user cannot normally call; when the server determines that the server and the first mobile phone keep heartbeat connection, the server determines that the call quality represented by the first signal strength is poor, and the first user and the second user can also carry out normal call.
If the server and the first mobile phone keep heartbeat connection, the server keeps the conversation between the camera and the first mobile phone; if the server and the first mobile phone do not maintain the heartbeat connection, the server executes step S104.
S104, the server sends a switching request message to the first mobile phone.
The switching request message is used for indicating the first mobile phone to initiate a call to the second mobile phone. The handover request information includes at least: a Subscriber Identity Module (SIM) card number of the second handset.
As a possible implementation manner, the server sends a switching request message to the client APP on the first mobile phone, so that after receiving the switching request message, the client APP starts a dialing function of the first mobile phone to initiate a call to the second mobile phone.
Optionally, after the first mobile phone establishes a call connection with the second mobile phone, the first mobile phone may send a handover completion message to the server. The switching completion message is used for indicating that the conversation between the first mobile phone and the second mobile phone is established. Therefore, after the server receives the switching completion message sent by the first mobile phone, the server really establishes a call between the first mobile phone and the second mobile phone, and the server indicates the camera to enter a standby state so as to reduce the power consumption of the camera.
Based on the technical scheme, if the first signal strength is smaller than the second signal strength and the server is not in heartbeat connection with the first mobile phone, the conversation quality represented by the first signal strength is very poor, the first user using the camera and the second user using the first mobile phone can not normally converse, and at the moment, the server sends the switching message to the first mobile phone. Therefore, the conversation between the first user using the camera and the second user using the first mobile phone is switched, the first user uses the second mobile phone to realize the conversation with the second user, the problem of poor conversation quality of the conversation between the camera and the first mobile phone caused by poor current network environment can be solved, and user experience is improved.
As a possible implementation manner, referring to fig. 3, the call handover method provided in the embodiment of the present invention further includes, before step S104, S201 to S203.
S201, the server acquires the position information of the second mobile phone.
The position information may be latitude and longitude coordinates, or may be position coordinates in a coordinate system established by the position of the server.
In one possible implementation manner, the server sends the location request information to the second mobile phone, and the second mobile phone sends the location information of the second mobile phone to the server.
According to a possible implementation mode, the client APP on the second mobile phone sends the periodically read position information of the second mobile phone to the server. For example: and the client APP on the second mobile phone reads the position information of the second mobile phone every 1 hour and sends the position information of the second mobile phone to the server.
S202, the server determines the distance between the second mobile phone and the camera according to the position information of the second mobile phone and the position information of the camera stored in advance.
And the distance between the second mobile phone and the camera is a straight-line distance.
As a possible implementation manner, the server determines the distance between the second mobile phone and the camera according to the longitude and latitude coordinates of the second mobile phone and the longitude and latitude coordinates of the camera.
As another possible implementation manner, the server determines the distance between the second mobile phone and the camera according to the position coordinates of the second mobile phone and the position coordinates of the camera.
S203, the server judges whether the distance between the second mobile phone and the camera is smaller than a preset threshold value.
The preset threshold value can be set according to actual conditions. For example: when the camera is located in the user's home, the preset threshold may be set to the length of the user's home.
It should be noted that the server determines that the distance between the second mobile phone and the camera is to determine whether the first user at the camera position can hear the second mobile phone when the second user initiates a call with the second mobile phone through the first mobile phone. In a possible situation, if the server determines that the distance between the second mobile phone and the camera is greater than or equal to the preset threshold, it indicates that the distance between the second mobile phone and the camera is very long, that is, the second mobile phone is very far away from the first user. If the server executes step S104, the first mobile phone initiates a call to the second mobile phone, but the first user is not near the second mobile phone and cannot answer the second mobile phone, so the server maintains the call between the camera and the first mobile phone.
In another possible situation, if the server determines that the distance between the second mobile phone and the camera is smaller than the preset threshold, it indicates that the second mobile phone is closer to the camera, that is, the second mobile phone is closer to the first user, the server executes step S104, that is, the first mobile phone initiates a call to the second mobile phone, and the first user is near the second mobile phone, and the first user can answer the second mobile phone in time to realize a call with the second user.
Therefore, when the server determines that the distance between the second mobile phone and the camera is greater than or equal to the preset threshold value, the server keeps the conversation between the camera and the first mobile phone; and when the server determines that the distance between the second mobile phone and the camera is smaller than the preset threshold, executing the step S104.
In the embodiment of the present invention, the network device may be divided into functional modules or functional units according to the above method examples, for example, each functional module or functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module may be implemented in a form of hardware, or may be implemented in a form of a software functional module or a functional unit. The division of the modules or units in the embodiments of the present invention is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
As shown in fig. 4, an embodiment of the present invention provides a server 10, where the server 10 includes: a communication module 11 and a processing module 12. The communication module 11 is configured to obtain a first signal strength and a second signal strength, where the first signal strength is a signal strength of a call between the camera and the first mobile phone in a current period; the second signal intensity is the signal intensity of the communication between the camera and the first mobile phone in the previous period; the processing module 12 is configured to, if the first signal strength acquired by the communication module 11 is smaller than the second signal strength acquired by the communication module 11, detect whether the server 10 and the first mobile phone maintain heartbeat connection by the processing module 12; the communication module 11 is further configured to, if the server 10 does not maintain heartbeat connection with the first mobile phone, send a handover request message to the first mobile phone by the communication module 11, where the handover request message is used to instruct the first mobile phone to initiate a call to a second mobile phone, and the second mobile phone is a mobile phone with a camera bound.
Optionally, the communication module 11 is further configured to, if the server 10 keeps a heartbeat connection with the first mobile phone, the server 10 keeps a call between the camera and the first mobile phone.
Optionally, the communication module 11 is further configured to obtain location information of the second mobile phone; the processing module 12 is further configured to determine a distance between the second mobile phone and the camera according to the position information of the second mobile phone and the position information of the camera, which are acquired by the communication module 11 and stored in advance; the processing module 12 is further configured to determine whether a distance between the second mobile phone and the camera is smaller than a preset threshold; the communication module 11 sends a handover request message to the first mobile phone, including: if the distance between the second mobile phone and the camera determined by the processing module 12 is smaller than the preset threshold, the communication module 11 sends a switching request message to the first mobile phone.
Optionally, the communication module 11 is further configured to receive a handover completion message sent by the first mobile phone, where the handover completion message is used to indicate that a call has been established between the first mobile phone and the second mobile phone.
Referring to fig. 5, an embodiment of the present invention further provides a server, including a memory 41, a processor 42, a bus 43, and a communication interface 44; the memory 41 is used for storing computer execution instructions, and the processor 42 is connected with the memory 41 through a bus 43; when the server is running, the processor 42 executes the computer-executable instructions stored in the memory 41 to cause the server to perform the call switching method provided in the above-described embodiment.
In particular implementations, processor 42(42-1 and 42-2) may include one or more CPUs, such as CPU0 and CPU1 shown in FIG. 5, for example, as one embodiment. And as an example, the server may include a plurality of processors 42, such as processor 42-1 and processor 42-2 shown in fig. 5. Each of the processors 42 may be a single-Core Processor (CPU) or a multi-Core Processor (CPU). Processor 42 may refer herein to one or more devices, circuits, and/or processing cores that process data (e.g., computer program instructions).
The memory 41 may be, but is not limited to, a read-only memory 41 (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 41 may be self-contained and coupled to the processor 42 via a bus 43. The memory 41 may also be integrated with the processor 42.
In a specific implementation, the memory 41 is used for storing data in the present application and computer-executable instructions corresponding to software programs for executing the present application. The processor 42 may perform various functions of the server by running or executing software programs stored in the memory 41, and by calling data stored in the memory 41.
The communication interface 44 is any device, such as a transceiver, for communicating with other devices or communication networks, such as a control system, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), and the like. The communication interface 44 may include a receiving unit implementing a receiving function and a transmitting unit implementing a transmitting function.
The bus 43 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an extended ISA (enhanced industry standard architecture) bus, or the like. The bus 43 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a computer execution instruction, and when the computer execution instruction runs on a computer, the computer is enabled to execute the call handover method provided in the foregoing embodiment.
The embodiment of the present invention further provides a computer program product containing instructions, which, when the computer program product runs on a computer, causes the computer to execute the call switching method provided by the foregoing embodiment.
The embodiment of the present invention further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a computer program or an instruction, so as to implement the call switching method provided in the foregoing embodiment.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in this invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical function division, and there may be other division ways in actual implementation. For example, various elements or components may be combined or may be integrated into another device, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form. Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.