Hello Muneer,
you would need to deploy two voice gateways that can be Cisco IOS routers with FXS ports and appropriate IOS image and feature set.
The two routers can have the phones connected to the FXS ports and then can call each other using VoIP IP dial peers.
Hope to help
Giuseppe