Security procedures are being reviewed at Downing Street after a hoax caller pretending to be the head of GCHQ managed to get through to David Cameron on Sunday.

Cameron spoke to the imposter, who was claiming to be the GCHQ director, Robert Hannigan, but ended the call when he realised he was being tricked.

According to No 10, no sensitive information was disclosed during the conversation between the men, which was described as “quite brief”.

In a separate incident, a caller rang GCHQ and managed to obtain Hannigan’s mobile phone number.

A government spokeswoman said: “Following two hoax calls to government departments today, a notice has gone out to all departments to be on the alert for such calls.

“In the first instance, a call was made to GCHQ which resulted in the disclosure of a mobile phone number for the director. The mobile number provided is never used for calls involving classified information. In the second instance, a hoax caller claiming to be the GCHQ director was connected to the prime minister.”

The spokeswoman said that incidents of this kind were taken seriously and procedures were being reviewed to see whether any lessons needed to be learned.

It is understood that the number given out by GCHQ for Hannigan related to a normal phone that he uses, not a secure line used for sensitive communications.

A spokesman for the prime minister refused to comment when asked if the identity of the hoaxer was known and if action was to be taken against them.

It is not the first time Cameron has been taken in by a hoaxer. In 2013, the prime minister wrote a tweet to an account in the name of the work and pensions minister Iain Duncan Smith. The account, however, was a spoof – about which Cameron appeared ignorant.

Cameron is not the first prime minister to find the No 10 switchboard putting a call through to him from someone claiming a false identity.

Tony Blair once received a call from a man speaking with a Yorkshire accent claiming to be William Hague. Blair quickly rumbled it was a joke because the caller, a radio DJ, called him “Tony”, unlike the then leader of the opposition, a stickler for formality who always called him “prime minister”. Blair played along with it for a bit and then joked about the exchange later at PMQs.

In 2007, Rory Bremner fooled the then environment secretary, Margaret Beckett, into thinking he was Gordon Brown, who was the prime minister at the time. The pair spent around 10 minutes discussing reshuffle options and Beckett attacked colleagues, including Alan Milburn and Patricia Hewitt. The former, she was quoted as saying, had not “really hacked it as chairman”. Beckett said at the time that she had no recollection of the conversation, but said if it had happened, it was “both an unprincipled and unpleasant breach of privacy”.

Bremner was attacked by Beckett’s government colleague Peter Hain, who was then the Northern Ireland secretary. Hain told him: “You do a great job in just knocking down everybody, breeding cynicism.”