Is it possible to integrate $\int \frac{\mathrm{d}x}{\sin^2 x+\sin x+1}$ without involving complex numbers? The integral is $$\int \frac{\mathrm{d}x}{\sin^2 x+\sin x+1}$$

Consider
$$\int \frac{\mathrm{d}x}{ax^2+bx+c}$$
There are a total of three cases, depending on the discriminant of $ax^2+bx+c$. Two of which are shown here (#1).
The third one, i.e. when $\Delta=0$, simply means evaluating $$\frac{1}{a}\int \frac{\mathrm{d}x}{\big(x+\frac{b}{2a}\big)^2} $$
For the first two cases, you can see different substitutions are used so as to prevent $i$ from appearing in the answer, hence resulting in an $\arctan$ function and a $\ln$ function respectively. The discrepancy arises when we change $+(4ac-b^2)$ to $-(b^2-4ac)$.

In general, is it possible to evaluate
$$\int \frac{\mathrm{d}x}{a\sin^2 x+b\sin x+c}$$ such that the result does not contain complex numbers when $\Delta_{\sin x}<0$?
The only approach I can think of when $\Delta_{\sin x}>0$ is by partial fraction decomposition, which differs from the method of substitution used above.
 A: Let  $\displaystyle I = \int \frac {1}{\sin ^2x + \sin x + 1}dx$
Let $$\sin x = -\frac {(2-\sqrt {3})t + (2 +\sqrt {3})}{t + 1}\implies \cos x\ dx = \frac {2\sqrt {3}}{(t + 1)^2}dt$$
Then $$I = 2\sqrt 3 \int \frac {t + 1}{\left((6 - 3\sqrt 3)t^2 + (6 + 3\sqrt 3)\right)\sqrt {(4\sqrt {3} - 6)t^2 - (4\sqrt {3} + 6)}}\ dx$$
Now consider $$I_1 = \int \frac {t}{\left((6 - 3\sqrt 3)t^2 + (6 + 3\sqrt 3)\right)\sqrt {(4\sqrt {3} - 6)t^2 - (4\sqrt {3} + 6)}}\ dx$$
and substitute $ \ (4\sqrt {3} - 6)t^2 - (4\sqrt {3} + 6) = z^2$ Reduce into well known equation.
and Consider $$ \ I_2 = \int \frac {1}{\left((6 - 3\sqrt 3)t^2 + (6 + 3\sqrt 3)\right)\sqrt {(4\sqrt {3} - 6)t^2 - (4\sqrt {3} + 6)}}\ dx$$
and first put $\displaystyle \ t = \frac 1p$ after this substitution put $ \ (4\sqrt {3} - 6) - (4\sqrt {3} + 6)p^2 = u^2$ 
and we are done without using Complex number...
A: The answer is yes.
Simply divide throughout by either $\sin^2{x}$ or $\cos^2{x}$
and respectively substitute $c = \cot{x}$ or $t = \tan{x}$
A: Let $\sin x =\frac{1-t^2}{1+t^2}$, or $t= \tan(\frac\pi4-\frac x2)$
\begin{align}
&\int \frac{1}{\sin^2 x+\sin x+1}\ dx
=\int\frac{2+2{t^2}}{3+t^4} \ dt\\
=&\ (1+\frac1{\sqrt3}) \int \frac{1+\frac{\sqrt3}{t^2}}{t^2+\frac3{t^2}}dt +(1-\frac1{\sqrt3}) \int \frac{1-\frac{\sqrt3}{t^2}}{t^2+\frac3{t^2}}dt\\
=&\  \frac{\sqrt3+1}{\sqrt{6\sqrt3}}\tan^{-1}\frac{t-\frac{\sqrt3}t}{\sqrt{2\sqrt3}}
-\frac{\sqrt3-1}{\sqrt{6\sqrt3}}\coth^{-1}\frac{t+\frac{\sqrt3}t}{\sqrt{2\sqrt3}}+C
\end{align}
