an enzyme cleaner(medical or janitorial) which can sometimes be bought from the vet/pet centre.
we bought one years ago from tesco, of all places, after a recommendation about its performance, which was for blood,etc, and it worked a treat,removing the smell from a deep pile carpet.
we also got the cat castrated too, its spray is mostly urine,and that can stink the house out also(my wife's coat on the kitchen chairs was a target once, and after the cat sprayed it it stank to high heaven), and the dry cleaners told us about the enzyme cleaners.
Our cat has just had flutd ,and started peeing every where ,we just used water with dissolved washing powder tablets ,peel the carpet back ,did the floorboards threw the underlay away ,layed a new piece of underlay and then cleaned the carpet with the water, no more smell .
biological washing powder, we tried everything under the sun to get rid of the smell of dog pee on our hall carpet, as a last resort we mixed up biological persil with hot water and added it to the vax, gave it a good going over to make sure it reached all the way through the carpet to the underlay, 2 months later and the smell is still gone.