The solution of the Riemann problem in rectangular channels with constrictions and obstructions