A semianalytical solution for the Boussinesq equation with nonhomogeneous constant boundary conditions