Media giant Viacom and satellite provider Dish Network reached a carriage agreement April 21, 2016, after months of negotiations. Pictured: The Dish logo is seen on a hard hat in Paramount, California, Nov. 3, 2015. Patrick T. Fallon/Bloomberg via Getty Images

The monthslong question over whether Dish Network customers would get to keep watching “Dora the Explorer” and “The Daily Show With Trevor Noah” has finally ended. The Englewood, Colorado, satellite company has reached a multiyear carriage agreement with Viacom Inc. that will keep 18 Viacom networks — including Comedy Central, MTV and Nickelodeon — on Dish for the foreseeable future.

Details about the carriage fees Dish will pay, or how many years, exactly, this deal is for, weren't disclosed. However, the new deal will put Viacom's networks on Dish's Sling TV service, which gives users the ability to stream live TV over the internet. A caveat: It's possible Comedy Central and other Viacom networks would be treated as add-ons for Sling, rather than being included in the basic $20-a-month package.

"Today's agreement ensures Viacom's number one family of networks will continue to be available to our millions of fans on DISH and underscores the value of our programming across platforms," Philippe Dauman, Viacom's CEO and executive chairman, said in a statement.

Dish reported quarterly earnings on Wednesday, revealing a loss of 23,000 TV subscribers from January through March 2016. Yet that still leaves Dish with 13.87 million TV customers; losing all those homes could have been catastrophic for Viacom, which is beginning to see the abatement of a two-year ratings bloodbath at some of its networks.

The renewal comes at a fortuitous time for Viacom: Several of its networks, like BET and MTV, are this week giving their yearly "upfront" presentations to advertisers, attempting to get them to pledge massive amounts of money for spots in the upcoming year. Those advertisers might have blanched a little at the knowledge that their commercials were definitively not going to be seen in nearly 14 million homes.

Viacom will also be releasing its own first-quarter results on April 28. On Tuesday, as the deadline for the talks — and the risk of a blackout — loomed, Viacom stock plummeted nearly 10 percent.

In reaction to the good news on Thursday morning, shares of Viacom were up nearly 10 percent from the previous close.

Dish CEO Charlie Ergen, a veteran hand at poker, had made it clear on an investor call Wednesday that he was prepared to call Viacom's bluff: "We're prepared to move on, as Suddenlink and others have done, without the content."

He continued: "We try to protect our customers from two things: One, a needless price increase. And, two, paying for a product that they are viewing other places." Because Viacom's programming was available on other video streaming services, Ergen said he felt it unfair for Viacom to attempt to wring more money from a less valuable product.

These types of carriage battles are increasing in frequency as programmers look to replace lost ad revenue with fees from pay TV companies, and as pay TV companies are trying to avoid doing anything that might increase the rate of cord-cutting/shaving among their customer base (like passing on increased fees via higher prices).

And Dish isn't afraid to go to the mat. Viacom was just the latest in a string of high-profile spats between the satellite provider and cable networks like Fox News, CNN and AMC. "In general, Viacom is not alone in this," Ergen said Wednesday. "Viewership for linear cable TV channels is down."