Asterisk & FreePBX
Asterisk is an open source PBX. (A PBX (private branch exchange) is a telephone system within an enterprise that switches calls between enterprise users on local lines while allowing all users to share a certain number of external phone lines.)
FreePBX is a Web interface to manage PBX.
Would be interesting to see if this could be done??
EDIT: Looks like someone has already put it on the wishlist: https://forum.cloudron.io/topic/1133/asterisk-pbx-open-source-voip-ip-pbx-server
+1 this (or some other similar Voip Server)