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 $\infty$, abbreviate $\tau_i-\tau_j$ by $t$, differentiate with respect to $t$ to get rid of the denominator, use $cos x = (e^{ix}+e^{-ix})/2$, and change $e^{iz}$ to $e^{iz-\epsilon\omega}$ to be able to perform the integration. Then set $\epsilon=0$ and integrate the result from $t=\tau_c \approx 0$ to $t=\tau_i$-$\tau_j$.