Can this closed form for $\sum_{n=1}^\infty \arctan \frac{a^2}{n^2}$ be proved directly by contour integration?

The general closed form for $$\sum_{n=1}^\infty \arctan \frac{a^2}{n^2}= \arctan \left( \frac{\tan \frac{\pi a}{\sqrt{2}}-\tanh \frac{\pi a}{\sqrt{2}}}{\tan \frac{\pi a}{\sqrt{2}}+\tanh \frac{\pi a}{\sqrt{2}}} \right)$$ is shown here and here by referring to the infinite product for the sine.

However, by using the series for the arctangent and the integral form of the zeta function, we can write the integral form for the series:

$$\sum_{n=1}^\infty \arctan \frac{a^2}{n^2}=2 \int_0^\infty \sin \frac{a x}{\sqrt{2}} ~\sinh \frac{a x}{\sqrt{2}} ~\frac{dx}{x(e^x-1)}$$

This integral is quite complicated, but I believe contour integration can be used to evaluate it directly, without getting back to the series.

Can the closed form for the integral be proved with the use of contour integration (or some other integration methods, without using the series and the sine product)?

I am still bad with contour integration, so this problem is beyond my level. I would be grateful for an outline of the solution.