missing

Missing one's wife while out in jamaat

Q: I'm far away from my wife and can not manage to go see her as I am in jamaat, looked at her photo in phone while in toilet, and suddenly I could not control myself, the semen came out, I don't know what are the steps forward. As I know it's a sin but I was very desperately in need. And I'm in a 3 chilla, and it's getting quite difficult for me, as it's only my first chilla.