You can use the fact that for real positive p:
The integral is an analytical function of the parameter p for Re(p)>0. The integral also converges on the imaginary axis. It then follows by the principle of analytical continuation that the function
also gives the integral for imaginary p. You do have to choose the correct branch cut for the square root. Since the formula has to agree with the integral for real positive p and we are considering the analytical continuation to the upper half complex plane, we can choose the brach cut on the negative real axis. We then get:
for real positive p. Taking the real part of both sides gives: