I'm not sure about third party devices.
For digi devices, when you press reset button 4 times on the routers and end devices, the devices will join nearby Coordinator like X4, X2. Once the end devices and routers are joined, they will having PAN ID - 0000, so from the web interface of the gateway, you can change PAN ID of those routers and end devices.