Either use a specially formulated rug deodorizer from your local pet store, or spray the carpet with a light misting of vinegar and water, then let dry.
There are enzyme cleaners which remove the smell from carpets. Shampooing carpets tends to actually cause the enzymes in pet waste to react and sometimes makes this worse.