Phrases involving verb-ばいい occur frequently and yet I can't find it mentioned in any of my grammar resources. I understand that literally it means "if I do verb, it is good" but that rarely works as a sensible translation. The sentence that caused my question is
なんと呼びかければいいのかと質問してみたのであるが、...
Which I'm translating as
I tried inquiring as to how I should address him but, ...
It confused me because, whilst it isn't a wild step to go from ' if you do x it will be good' to 'you should do x', putting the question word なんと at the front makes that simple logic fail.
So my question is what is the general grammar for verb-ばいい (with and without question words)? What range of meanings can this phrase have? Also, can I replace いい with よくない to invert the meanings? Thanks.