SIR epidemics with stochastic infectious periods