You can use CM, a Gatekeeper, or H323. If you don't have GK configured on the 3640, you can use H323. Just need to install the correct firmware on the ATA. I recommend updating to the latest anyway.
You should be able to dial directly between the ATAs using IP addresses, but I've never done it. I have several ATAs that only dial another ATA, so I just pointed all of their H323 gateways at the central one. Works fine, but thye can't call anywhere else.
By assigning a number, I assume the local phone number? Try the UID0 and UID1.