I'm studying for an exam and I'm completely lost for one particular problem. We are asked to solve by the method of characteristics \begin{align*} u_{tt}-4u_{xx}& = 0 \qquad x>0,\, t>0\\ u(x,0)& = f(x)\\ u_t(x,0) &= g(x)\\ u_x(0,t) & = h(t) \end{align*} where $f(x)=0,$ $g(x)=\begin{cases}1 & 0<x<1 \\ 0 &0<x<\infty\end{cases}$, and $h(t)=\begin{cases}1 & 0<t<1 \\ 0 & 1 < t < \infty\end{cases}$.
So far what I have done is found that from the general solution $$u(x,t) = \phi(x+2t)+\psi(x-2t)$$ we have, $$ \phi(x)+\psi(x) = 0, \qquad 2\phi'(x) - 2\psi'(x)=\begin{cases}1 & 0<x<1 \\ 0 &1<x<\infty\end{cases}. $$ which gives me (setting $\phi(0)=0$), \begin{align}\phi(x) &= \begin{cases} \frac{1}{4}x & 0<x<1\\ \frac{1}{4} & 1<x<\infty\end{cases} \\ \psi(x) & = -\phi(x).\end{align}
It's at this point that I'm lost. The solution has as the next step that $$u(x,t)=\begin{cases}0 & x>2t+1 \\ \frac{1}{4}(1+2t-x)&2t<x<2t+1.\end{cases}$$
I understand that $\phi(x+2t)$ is defined for $x+2t>0$ and that $\psi(x-2t)$ is defined for $x-2t<0$ when $x>2t$, but I'm not seeing how to get from this to the $u(x,t)$ above. I'm assuming once I get over this conceptual hurdle considerations for $h(t)$ will be similar.