Buyout firm Clayton, Dubilier & Rice is having trouble closing a multibillion-dollar acquisition of Avaya, a struggling firm that installs and manages corporate phone systems, sources told The Post.

Private equity pioneer CD&R has been entangled in a web of negotiations to buy an Avaya division. The deal could save the phone installer from a forced bankruptcy, insiders said.

Specifically, the deal calls for CD&R to buy the call-center software business, with the proceeds going to Avaya, which would then restructure the remaining business in a prepackaged bankruptcy, sources said.

“The situation is very, very fluid — this is one of the most complicated deals I have ever seen,” a source close to the talks told The Post. “CD&R has never done a restructuring or a tech deal. They are outside of their comfort zone.”

For one thing, CD&R is trying to buy the company’s call-center software business without assuming pension liabilities for any of Avaya’s 15,000 employees.

Many of Avaya’s workers are in its Morristown, NJ, location. Until last year, they had been in Basking Ridge, NJ, where Avaya’s former parent, the AT&T spinoff Lucent Technologies, had been based.

“We remain in ongoing, constructive discussions with creditors to address and improve the company’s capital structure,” an Avaya spokesman said. “We expect further developments later this month. Meanwhile, we remain fully focused on our [300,000] customers and anticipate no disruptions to our ongoing operations.”

In 2007, private equity firms TPG Capital and Silver Lake Partners bought Avaya in an $8.2 billion leveraged buyout.

They invested about $2 billion of equity and have received $600 million in proceeds. The rest of their investment will likely be wiped out, sources said.

Private equity firm Veritas Capital is still interested in buying Avaya’s call-center software business for about $4 billion and is hanging around believing CD&R’s deal may fall apart, a source said.

CD&R and Veritas did not return calls seeking comment.

Avaya was required to announce its financial results by the end of 2016 and has not. Now it has a 30-day grace period to report results.

If it does not report by February or does not receive a going-concern statement saying it is solvent, the company may then be in default on its $6 billion in loans.