On the VOIP front, the Ubuntu platform is not well supported for "ready to use" asterisk packages. Sure, you can install a working copy of asterisk but you need to be prepared to roll up your sleeves and configure it manually. Visual Dialplan works nicely here but there is nothing to equal the convenience provided by freebpx,trixbox, or pbxiaf for instance.
If a small install was my target I might look at a Raspberry PI running PBXIAF (limited testing here). Larger (more than 50 seats) I would be looking at a full blown computer with freepbx (Elastix is my favorite variant).
Either way, I don't think that I would try to keep the gateway married to the pbx ( I ran this way for a few years under Suse and it didn't really work that well). I chose to run a separate asterisk instance in both environments where I have deployed Zentyal. Zentyal is a wonderful gateway/email product. In my opinion the AD controller module is a good addition to the lineup. Asking it to play a full fledged media gateway (asterisk) as well is asking too much IMHO .