Find $\int_0^{\infty} \phi(t) \sin(\omega t)dt=g(\omega)=\frac {1}{\omega^2+2},\omega>0, 0$ otherwise. Find $\phi(t)$.
Here is what I tried but I came to a strange result and don't know if it's correct.
I prolonged the $\phi(t)$ function to make it odd so I could prolong the integral over the all real axis and we have:
$$\int_{-\infty}^{\infty}\phi(t)\sin(\omega t)dt = 2g(w)$$
We multiply by $-i$ on both sides and we get: $$-i\int_{-\infty}^{\infty}\phi(t)\sin(\omega t)dt = -2ig(w)$$
Since $\phi(t)$ is odd we have:
$$\int_{-\infty}^{\infty}\phi(t)\cos(\omega t)dt = 0$$
If we add them togheter we get:
$$\int_{-\infty}^{\infty}\phi(t)e^{-i\omega t}dt = -2ig(w)$$
We use the inversion formulae now:
$$f(\omega)=\frac 1{2\pi}\int_{\mathbb{R}}F(t)e^{i\omega t}dt$$
Where $F(t)$ would be the fourier transform of $f$.
Thus, we get:
$$\phi(t)=\int_{-\infty}^{\infty}\frac {-2i}{\omega^2+2}e^{-i\omega t}d\omega$$
Using residuum theorem we only have to evaluate the functions residues in $i\sqrt{2}$.
And we get:
$$\phi(t) = -\frac{e^{-\sqrt{2}t}}{\sqrt{2}}$$
And I feel like it's not completely correct.
Here is a completely dumb answer that solves your question. As the comments noted, there appeared to be an odd mismatch between the equation and the placement of $\omega$, namely odd/even-ness. Put another way,
$$\lim_{\omega\to 0^+} \frac{1}{\omega^2+2} = \frac{1}{2}$$
but the integral seems to vanish there. The way I found to fix it was to suggest that perhaps $\phi$ has a pole of order $1$ at $\omega = 0$
$$\int_0^\infty \phi(t) \sin(\omega t)dt = \int_0^\infty \frac{f(t)}{ \omega } \sin(\omega t) dt$$
Next, I recognized that form of $g(\omega)$ from the result of integration by parts of trig functions times exponentials, namely
$$\int_0^\infty e^{-at}\sin(\omega t) dt = \frac{\omega}{\omega^2+a^2}$$
Picking $a=\sqrt{2}$ leads us to our final answer:
$$\phi(t) = e^{-\sqrt{2}t}\frac{H(\omega)}{\omega} \implies \int_0^\infty \phi(t) \sin(t) dt = g(\omega)$$
where the factor of $H(\omega)$, the Heaviside step function, ensures that the integral vanishes for $\omega < 0$. It seems you almost had it, but made the assumption that $\phi(t)$ must be independent of $\omega$. Unfortunately, that assumption would lead you to the contradiction above.
There is no unique answer, either, as
$$\phi(t) = \frac{2}{\pi t}\frac{H(\omega)}{\omega^2+2}$$
would have also worked and was the first answer I arrived at.