Smooth and discontinuous junctions in the p-system