I am 20 weeks pregnant and I think I have a severe kidney infection?

I am 20 weeks pregnant and I think I have a severe kidney infection.
I have severe pains at the bottom of my belly on the right hand side and also at the bottom of my back on the right hand side. My urine smells quite foul and I have discharge. My midwife said if the pains don’t go then she recommends I go to the hospital and the pains are still there.