General Joseph Dunford visits China amid tensions between U.S., North Korea over missile tests.

China and the United States agreed Tuesday to increase communication between their militaries to avoid miscalculations that could trigger a war.

Joint Chiefs of Staff Chairman General Joseph Dunford and General Fang Fenghui, chief of the People's Liberation Army's Joint Staff Department, signed a framework agreement to build a new communication mechanism between the two sides’ military personnel, China Daily reported.

The first meeting to set up the framework is scheduled for November, according to the U.S. Department of Defense.

Marine Corps Gen. Joe Dunford, chairman of the Joint Chiefs of Staff, and Gen. Fang Fenghui of the Chinese army, chief of China's joint staff, participate in a welcome ceremony at the Ba Yi, the People's Liberation Army headquarters in Beijing, Aug. 15, 2017. DoD photo by Navy Petty Officer 1st Class Dominique A. Pineiro

The visit to China by Gen. Dunford was his first since President Donald Trump assumed office.

In the meeting, General Fang was quoted as saying that President Xi Jinping and Trump "valued the friendly development of the two militaries."

The visit came amid rising tensions between the U.S. and North Korea over its recent intercontinental ballistic missile tests.

Following the North’s tests of intercontinental ballistic missiles on July 4 and July 28, the UN on Saturday imposed new sanctions on Pyongyang with a sweeping ban on exports of coal, iron, lead and seafood that could eliminate $1 billion in annual revenues.

China and the US are establishing a military business alliance mechanism ile ilgili görsel sonucu

Chinese officials opposed the sanctions and instead called for dialogue and negotiations.

But the U.S. has adopted a tough stance in an attempt to pressure the North to abandon its nuclear and missile programs.

"Military solutions are now fully in place, locked and loaded, should North Korea act unwisely," Trump tweeted on August 8, before retweeting Pentagon photographs of B1 bombers that are said to be key to U.S. plans to strike the North.

"Hopefully Kim Jong-un will find another path!" he added, referring to the country's authoritarian leader.

Pyongyang has decided to postpone plans to fire missiles into waters off the U.S. island territory of Guam and will wait to see what the U.S. does next.

Marine Corps Gen. Joe Dunford, chairman of the Joint Chiefs of Staff, participates in a welcome ceremony with his Chinese counterpart Gen. Fang Fenghui at the Ba Yi, the People's Liberation Army headquarters in Beijing, Aug. 15, 2017. DoD photo by Navy Petty Officer 1st Class Dominique A. Pineiro