Firstly what is your definition of "cheap"? How will you be interfacing this to the outside world - SIP trunks or POTS/ISDN lines? What type of phones do you want? How vital is the uptime of such a system?
If you're wanting a system for a small office with 5 new VoIP phones as extensions using regular POTS phone lines you'll be looking at somewhere around the $2k mark for something good. You could hack something together for well under half that if you're not worried about the quality.
Cheap and reliable are two words that are difficult to use in the same sentence in the IT world!