When I imagine myself in any sort of situation, my thought is to keep a safe enough distance that they can't grab for my gun and hold it ready to shoot while calling for help.
That may mean not having a gun trained on an individual but between 2, and ready to aim and shoot. Only if you see one is holding a gun do you aim at that one and shout DROP IT OR I'LL SHOOT.
Otherwise, shout "STOP OR I'LL SHOOT" and everybody is likely to turn to see where/who it came from. In that moment, you've broken the concentration of the aggressor.
You don't *have* to figure out who is the aggressor, who is calling for help. You just need to freeze the action in place, persuade *both* of them to LIE FACE DOWN ARMS STRETCHED OVER YOUR HEADS NOW!!! and DO NOT MOVE OR I WILL SHOOT. And then keep them in that position, unable to reach for any weapons, until the police arrive.
(the reason I go around imagining myself in such a situation is I'm a single woman living alone in a rural area where it could take the police quite a few minutes to arrive. and in the past on various occasions I have been followed by someone in a van, office-stalked, and harassed by a registered sex offender and his gang. plus last year a neighbor held a would-be burglar who entered through a window at gunpoint until the police arrived. plus we had a pair of thieves move into the shack up the road. so getting a gun with training and possibly even license to carry concealed is *very* high on my priority list these days.)