Compute the integral $\int_{-\infty}^\infty \frac{\sin(x) (1+\cos(x))}{x(2+\cos(x))} dx$ Background
I recently found out about Lobachevsky's integral formula, so I tried to create a problem on my own for which I'd be able to apply this formula. The problem is presented below.
Problem

Compute the integral $\int_{-\infty}^\infty \frac{\sin(x) (1+\cos(x))}{x(2+\cos(x))} dx$

Attempt
If we define $f(x) := \frac{1+\cos(x)}{2+\cos(x)}$, which most definitely is $\pi$ - periodic.
The integral is, using our notation above, on the form
$$I = \int_{-\infty}^\infty \frac{\sin(x)}{x}f(x) dx.$$
The integrand is even, so we might as well compute
$$ I = 2 \int_{0}^\infty \frac{\sin(x)}{x}f(x) dx.$$
We will now have to make use of a theorem.

Lobachevsky's integral formula states that if $f(x)$ is a continous $\pi$ - periodic function then we have that $$ \int_0^\infty \frac{\sin(x)}{x}f(x) dx= \int_0^{\pi/2} f(x) dx.$$

Substituing our $f(x)$ yields us
$$ \int_0^{\pi/2} \frac{1+\cos(x)}{2+\cos(x)} dx = \pi/2 - \int_0^{\pi/2}\frac{1}{2+\cos(x)}dx $$
where
$$I_2 = \int_0^{\pi/2}\frac{1}{2+\cos(x)}dx = \int_0^{\pi/2}\frac{\sec^2(x/2)}{3+\tan^2(x/2)}dx.$$
Letting $ u = \tan(x/2)/\sqrt{3}$, for which $du = \sec^2(x/2)/(2\sqrt{3})dx$, therefore gives us:
$$ I_2 = \int_0^{1/\sqrt{3}}\frac{2\sqrt{3}}{3u^2+3} = \frac{\pi}{3\sqrt{3}}.$$
Finally we can compute $I$ to
$$I = 2\left(\frac{\pi}{2} - \frac{\pi}{3\sqrt{3}}\right) = \frac{\pi(3\sqrt{3}-2)}{3\sqrt{3}}.$$
I've tried calculating this integral in Desmos where it gives me $0$ when I calculate the integrand on the interval $(-\infty, \infty)$, and something negative for $(0,\infty)$. This contradicts my answer.
I also tried typing it into Wolfram, without success. Can anyone confirm the validity of my result?

There is a generalization of Lobachevsky's integral formula that is applicable.
The formula states that if $f(x)$ is an odd periodic function of period $a$, then $$\int_{0}^{\infty} \frac{f(x)}{x} \, \mathrm dx = \frac{\pi}{a} \int_{0}^{a/2} f(x) \cot \left(\frac{\pi x}{a} \right) \, \mathrm dx \tag{1}$$ if the integral on the left converges.
A proof can be found in the paper The integrals in Gradshteyn and Ryzhik.
Part 16: Complete elliptic integrals by Boettner and Moll.  It's Lemma 3.1.
The proof says to use the partial fraction expansion of $\tan (z)$.  That's clearly a typo.  It should be the partial fraction expansion of $\cot (z)$ since $$\sum_{k=0}^{\infty} \left( \frac{1}{x+ka}- \frac{1}{(k+1)a-x} \right) = \frac{1}{x} + \sum_{k=1}^{\infty} \frac{2x}{x^{2}-k^{2}a^{2}} = \frac{\pi}{a} \cot \left(\frac{\pi x}{a} \right).$$
Using $(1)$ and the tangent half-angle substitution, we get $$\begin{align} \int_{-\infty}^{\infty} \frac{\sin(x)}{x} \frac{1+ \cos x}{2+ \cos x} \, \mathrm dx &= 2 \int_{0}^{\infty} \frac{\sin(x)}{x} \frac{1+ \cos x}{2+ \cos x} \, \mathrm dx  \\ &= \int_{0}^{\pi} \sin(x) \, \frac{1+ \cos x}{2+ \cos x} \, \cot\left(\frac{x}{2} \right) \, \mathrm dx \\ &= 8 \int_{0}^{\infty} \frac{\mathrm dt}{(t^{2}+1)^{2}(t^{2}+3)} \\&= 4 \int_{0}^{\infty} \frac{\mathrm dt}{(t^{2}+1)^{2}} -2 \int_{0}^{\infty} \frac{\mathrm dt}{t^{2}+1} + 2 \int_{0}^{\infty}\frac{\mathrm dt}{t^{2}+3} \\ &= 4 \left(\frac{\pi}{4} \right) - 2 \left( \frac{\pi}{2} \right) + 2 \left( \frac{\pi}{2\sqrt{3}} \right) \\ &= \frac{\pi}{\sqrt{3}}. \end{align}  $$

To emphasize what is stated in the paper, if $g(x)$ is an even $\pi$-periodic function, then $g(x) \sin(x)$ is an odd $2 \pi$-periodic function, and  $$ \begin{align} \int_{0}^{\infty} \frac{g(x) \sin (x)}{x} \, \mathrm dx &= \frac{1}{2} \int_{0}^{\pi} g(x) \sin(x) \cot \left(\frac{x}{2} \right) \, \mathrm dx \\ &= \frac{1}{2} \int_{0}^{\pi} g(x) \sin(x) \, \frac{1+ \cos(x)}{\sin(x)} \, \mathrm dx \\ &= \frac{1}{2} \int_{0}^{\pi} g(x) \, \mathrm dx + \frac{1}{2} \int_{0}^{\pi} g(x) \cos (x) \, \mathrm dx \\ &= \int_{0}^{\pi/2} g(x) \, \mathrm dx + \frac{1}{2} (0) \\ &=  \int_{0}^{\pi/2} g(x) \, \mathrm dx \end{align}$$ which is Lobachevsky's integral formula.
It wasn't immediately clear to me why $$\int_{0}^{\pi} g(x) \cos(x) \, \mathrm dx =0. $$
But since $g(x) \cos(x)$ is an even function, we have $$\int_{0}^{\pi} g(x) \cos(x) \, \mathrm dx = \int_{-\pi}^{0} g(x) \cos (x) \, \mathrm dx. $$
And making the substitution $u = x- \pi$, we have $$\int_{0}^{\pi} g(x) \cos(x) \, \mathrm dx = -\int_{-\pi}^{0} g(u) \cos (u) \, \mathrm du. $$
The only way both equations can be simultaneoulsy true is if $$\int_{0}^{\pi} g(x) \cos(x) \, \mathrm dx=0. $$
