You can consider $f(z)=\displaystyle\frac{e^{3zi}}{(z+2i)(z-2i)}$. For $R>0$, consider the counter $\gamma=\gamma_1+\gamma_2$ where $\gamma_1(t)=t$ where $-R\leq t\leq R$, and $\gamma_2(t)=Re^{it}$ where $0\leq t\leq \pi$. Then
$$\int_{\gamma_1}f(z)dz=\int_{-R}^R\frac{e^{i3t}}{t^2+4}dt=\int_{-R}^R\frac{\cos(3t)}{t^2+4}dt+i\int_{-R}^R\frac{\sin(3t)}{t^2+4}dt$$
$$\rightarrow\int_{-\infty}^\infty\frac{\cos(3t)}{t^2+4}dt+i\int_{-\infty}^\infty\frac{\sin(3t)}{t^2+4}dt\mbox{ as }R\rightarrow\infty,$$
and
$$\left|\int_{\gamma_2}f(z)dz\right|=\left|\int_{0}^{\pi}\frac{e^{i3Re^{it}}}{R^2e^{2it}+4}Rie^{it}dt\right|$$
$$\leq\int_{0}^{\pi}\frac{R|e^{i3Re^{it}}|}{R^2-4}dt=
\int_{0}^{\pi}\frac{Re^{-3R\sin t}}{R^2-4}dt\leq\int_{0}^{\pi}\frac{R}{R^2-4}dt\rightarrow 0\mbox{ as }R\rightarrow\infty.$$

On the other hand, by Residue Therorem, we have
$$\int_{\gamma} f(z)dx=2\pi iRes(f(z),2i)$$
since $2i$ is in the interior of $\gamma$ and $-2i$ is not. Note that
$$Res(f(z),2i)=Res(\frac{e^{3zi}}{(z+2i)(z-2i)},2i)=\frac{e^{3zi}}{(z+2i)}\Big|_{z=2i}=\frac{e^{-6}}{4i}.$$
Combining all these, we get
$$\int_{-\infty}^\infty\frac{\cos(3t)}{t^2+4}dt+i\int_{-\infty}^\infty\frac{\sin(3t)}{t^2+4}dt=2\pi i\cdot\frac{e^{-6}}{4i}=\frac{\pi}{2e^6}.$$
Equating real and imaginary parts, we get
$$\int_{-\infty}^\infty\frac{\cos(3t)}{t^2+4}dt=\frac{\pi}{2e^6}\mbox{ and } \int_{-\infty}^\infty\frac{\sin(3t)}{t^2+4}dt=0.$$

Now note that $\frac{\cos(3t)}{t^2+4}$ is an even function, i.e. it is symmetric about the $y$-axis: $\frac{\cos(-3t)}{(-t)^2+4}=\frac{\cos(3t)}{t^2+4}$. We have $\int_{-\infty}^\infty\frac{\cos(3t)}{t^2+4}dt=2\int_{0}^\infty\frac{\cos(3t)}{t^2+4}dt$, which implies that
$$\int_{0}^\infty\frac{\cos(3t)}{t^2+4}dt=\frac{1}{2}\int_{-\infty}^\infty\frac{\cos(3t)}{t^2+4}dt=\frac{\pi}{4e^6},$$
as required.