A method for eliminating an echo, comprising: obtaining a mixed signal of a mixture of a user's voice given out from the user and the echo given out from a loudspeaker, and obtaining a sound signal given out from the loudspeaker based on the volume of the sound given out from the loudspeaker, the sound signal being used as a reference signal, wherein the sound signal given out from the loudspeaker is simulated according to a preset rule, and the preset rule refers to the reference signal obtained according to the volume in an environment without reflection or diffraction; comparing the mixed signal with the reference signal to obtain a gain coefficient of the reference signal, and obtaining a gain signal of the reference signal through the gain coefficient; obtaining a compensation signal of the reference signal based on the gain signal and a corresponding preset compensation coefficient; inverting the compensation signal; and combining the inverted compensation signal with the mixed signal, so as to eliminate the echo given out from the loudspeaker; wherein the gain signal of the reference signal is obtained by: calculating the amplitudes of the mixed signal and the reference signal; obtaining the gain coefficient of the reference signal based on the amplitudes of the mixed signal and the reference signal; and obtaining the gain signal of the reference signal through multiplying the amplitude of the reference signal by the gain coefficient; and the preset compensation coefficient is obtained by: selecting a preset number of frequencies in preset frequencies to make sounds through the loudspeaker at a preset amplitude; receiving the echo signals corresponding to the sounds; obtaining the amplitudes of the echo signals; and calculating to obtain the preset compensation coefficients based on the amplitudes of the echo signals and the preset amplitude. obtaining a mixed signal of a mixture of a user's voice given out from the user and the echo given out from a loudspeaker, and obtaining a sound signal given out from the loudspeaker based on the volume of the sound given out from the loudspeaker, the sound signal being used as a reference signal, wherein the sound signal given out from the loudspeaker is simulated according to a preset rule, and the preset rule refers to the reference signal obtained according to the volume in an environment without reflection or diffraction; comparing the mixed signal with the reference signal to obtain a gain coefficient of the reference signal, and obtaining a gain signal of the reference signal through the gain coefficient; obtaining a compensation signal of the reference signal based on the gain signal and a corresponding preset compensation coefficient; inverting the compensation signal; and combining the inverted compensation signal with the mixed signal, so as to eliminate the echo given out from the loudspeaker; wherein the gain signal of the reference signal is obtained by: calculating the amplitudes of the mixed signal and the reference signal; obtaining the gain coefficient of the reference signal based on the amplitudes of the mixed signal and the reference signal; and obtaining the gain signal of the reference signal through multiplying the amplitude of the reference signal by the gain coefficient; and calculating the amplitudes of the mixed signal and the reference signal; obtaining the gain coefficient of the reference signal based on the amplitudes of the mixed signal and the reference signal; and obtaining the gain signal of the reference signal through multiplying the amplitude of the reference signal by the gain coefficient; and the preset compensation coefficient is obtained by: selecting a preset number of frequencies in preset frequencies to make sounds through the loudspeaker at a preset amplitude; receiving the echo signals corresponding to the sounds; obtaining the amplitudes of the echo signals; and calculating to obtain the preset compensation coefficients based on the amplitudes of the echo signals and the preset amplitude. selecting a preset number of frequencies in preset frequencies to make sounds through the loudspeaker at a preset amplitude; receiving the echo signals corresponding to the sounds; obtaining the amplitudes of the echo signals; and calculating to obtain the preset compensation coefficients based on the amplitudes of the echo signals and the preset amplitude.