There needs to be a device, server, router, etc., at the remte sites that hands out IP addresses to the phones. Assuming that there is a low headcount at the branches you would need a SIPARATOR at the main office which would route the calls through the PBX. The capacity of the SIPARATOR would depend on the number of call it has to route. Have a look at Ingate
http://www.ingate.com/siparators.php