I too had a difficult time during my second trimester....I even had to go to the ER because it caused me lots of bleeding from the bum and scared me....I was told 4-6 oz of 100% white grape juice and raisin bran daily and I should be back to normal in no time. It took two days and have been GREAT since! Regular BM daily.
If that don't work ask your doctor about Miralax. I have to take it. I know its safe to take while pregnant.
Im mot aure if there is anything you can take for the pain, but as far as the constipated issues, eat more green leafy veges. For a more quick release take a little prune juice. That did the trick for me. Walking also helps. Best of wishes, hope you feel better.