Student or Learner
By the time we hung up/were hanging up, grandma was full of life.
Are both tenses all right for the time clause?
"Hung up" is the expected answer, since it's a momentary action to disconnect the call.
However, since many of my calls seem to take a long time to get from "Okay, well I've got to get going" to the actually "Bye!" the process of "hanging up" can be more than an instant. Yes, the actual act of disconnecting the call is momentary, but the process of actually getting the other person to stop talking (and for you to stop talking too) can be anything but momentary. If you think of that whole time as the "hanging up" then the "were hanging up" would be okay too.
Regardless of the above paragraph, use "hung up" on a test.
I'm not a teacher, but I write for a living. Please don't ask me about 2nd conditionals, but I'm a safe bet for what reads well in (American) English.