As has been observed during the Covid-$19$ pandemic epidemic, when an individual recovers from a coronavirus infection, the immunity of this individual persists for some time, after which his/her immunity decays progressively. Usually scientists use the SIRS compartmental model to describe this process. This model assumes that once an individual has recovered, his/her immunity persists for some time, after which the individual immediately becomes fully susceptible. Moreover, this model does not take into account the randomness of the decays of immunity after each infection and the variations between individuals. Thus the goal of this presentation is to define a stochastic epidemic model with varying infectivity and with waning immunity, and to study its properties. More precisely, we present a functional law of large numbers when the size of the population tend to infinity. We also present results on the behaviour of the epidemic, more precisely the threshold for the existence of an endemic equilibrium, the stability of disease-free steady state and partial answers for the stability of the endemic equilibrium.