The question, "How long had John been talking to his girlfriend on the phone?" is in the past. It can be assumed that he is no longer talking. If the original sentence had read, "How long has John been talking...?" it would be in the present. From which it would be assumed that he is still talking. Thus, it would not be necessary to ask. "Had" means a No. "Has" means a