What to do if you experience painful cramps?

Hi!

I was doing this exercise last night and oh boy! My left calf muscle hurt like hell. I was trying to push myself to lift my leg higher but I suddenly felt painful cramp on my left calf. It hurts so much I cried while holding my leg cause I don't know what to do about it. I was alone in my apartment so imagine that while I was screaming in pain. :( I even considered calling an ambulance cause the pain was unbearable.

The pain gradually decreased but when I tried to straighten my leg, I felt the pain again and the muscle was so stiff.

Until now the muscle pain is still there especially when I do calf stretch, a little pain when I'm walking but I think I can do upper body workout later.

Can anyone give me tips on what to do to stop the cramp? And also ways to prevent it in the future..

Thank you!