rewrite the cosine in terms of exponenials, and add a tiny real part to the exponents.
In more detail, rewrite the integral as twice the integral from 0 to ∞, abbreviate τi−τj by t, differentiate with respect to t to get rid of the denominator, use cosx=(eix+e−ix)/2, and change eiz to eiz−ϵω to be able to perform the integration. Then set ϵ=0 and integrate the result from t=τc≈0 to t=τi-τj.