Donald Trump appears to have returned a prank phone call from a comedian pretending to be the senator Robert Menendez on Wednesday as he was returning to Washington DC from a rally in North Dakota aboard Air Force One.

John Melendez, a veteran performer on Howard Stern and Jay Leno’s shows, published a podcast episode Thursday that includes a recording of a three minute conversation between himself and what sounds to be the president.

“Hi, Bob. How are you? Congratulations on everything, we’re proud of you,” the voice presumed to be the president says, apparently referencing the resolution of a five-year corruption investigation into the New Jersey Democrat. “You went through a tough, tough situation, and I don’t think a very fair situation, but congratulations.”

The pair briefly discussed immigration, with Trump stating, “I want to be able to take care of the situation every bit as much as anybody else at the top level. I’d rather do the larger solution rather than the smaller solution.”

Colbert on Trump-Putin summit: 'It's time for his annual employee review' Read more

The comedian also urged the president to choose a supreme court nominee who is not overly conservative, with Trump responding that he had “a big list of people” and that he would announce a nominee in 12 to 14 days.

Melendez, who performs as Stuttering John, told CNN that he was “shocked” to receive a call back after a series of long-shot prank calls to the White House switchboard. “I just could not believe that it took us an hour and a half to get Jared Kushner and Donald Trump on the phone from Air Force One,” he said.

The prank began when Melendez and his producer called the White House and asked to speak to the president. After being rebuffed under his own name, Melendez tried again, this time using a fake British accent and claiming to be an assistant to Senator Menendez.

The operator took a message for the pseudo-senator, despite the fact that Melendez and his producer could be heard giggling and joking about hemorrhoids on the line.

Later in the podcast, the comedian received a call from the switchboard asking for confirmation of the senator’s phone number. Despite noting that the comedian’s phone number was not in their records for Menendez, the operator accepted Melendez’s explanation that he was on vacation.

Melendez subsequently described receiving a call from Trump’s son-in-law, Jared Kushner, before playing the audio of the apparent call from Trump.

The White House did not immediately respond to a request for comment from the Guardian, but a White House official gave a statement to CNN that does not dispute the authenticity of the recording: “The President wants to be accessible to members and likes engaging them and wants them to have the opportunity to connect. The downside of that is sometimes the channels are open too widely and mistakes like this happen.”

Play Video 1:38 'Fragile, like the president's ego': Trump Baby blimp prepares for takeoff

Politico reported that the White House was “scrambling” Thursday to figure out how the prankster had been able to gain access to the president so easily, while Axios described White House staffers as “freaking out” over the breach.

Trump is by no means the only world leader to be duped into a phone call.

In May, the British foreign secretary, Boris Johnson, held an 18-minute phone conversation with a Russian prankster pretending to be the Armenian prime minister. In 1995, Queen Elizabeth II spoke for 17 minutes with a Canadian radio host pretending to be the prime minister.

The real Menendez released a statement criticizing the White House’s policy of separating migrant children from their parents at the border, and said he would “welcome any opportunity to have a real conversation with the president on how to uphold the American values that have guided our family-based immigration policy for the past century”.

Diamond and Silk, two pro-Trump YouTube stars who recently testified to the the US House of Representatives about Facebook’s alleged censorship of conservatives, responded to the contretemps on Twitter, writing: “It should be against the law for a comedian to impersonate a government official.”