A US comedian posing as a senator claims he talked on the phone to Donald Trump while the US president was onboard Air Force One, discussing various policy issues including migration and the Supreme Court.

John Melendez posted audio of the purported phone call on his "Stuttering John" podcast, in which he rings the White House and pretends to be Senator Robert Menendez.

After much back and forth with what sound like aides, he eventually gets a call back from someone who sounds like Mr Trump, who says he is travelling back from a rally in North Dakota. The rally took place on Wednesday.

The White House would not comment on Friday on whether the recording was real but US media reported that staff were scrambling to figure out how the call was allowed.

The phone call lasts several minutes and begins with the person who sounds like Mr Trump apparently congratulating the man he believes to be Senator Menendez, who recently had corruption charges against him dropped.

"You went through a tough, tough situation, and I don't think a very fair situation. But congratulations," the voice said.

The pair then discuss immigration and a replacement for Supreme Court Justice Anthony Kennedy, who announced his retirement this week.

The voice that sounds like Mr Trump reveals very little but says a choice will be made in the next 12 to 14 days. "We have some great choices," he said.