Why is a gateway recommended?

Probably because you can use it from multiple FreeSWITCH servers, or a remote location. Of course that comes with its own problems too (an extra point to secure).

and how can I set the freeswitch to route the PSTN calls to the IP phone?

That'll depend on the hardware. If it's a card then probably via the freetdm endpoint. If via a gateway then you'd probably send the call to the gateway via SIP (sofia endpoint). For more information look at these pages:
http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_bridge
http://wiki.freeswitch.org/wiki/FreeTDM
http://wiki.freeswitch.org/wiki/Sofia
http://wiki.freeswitch.org/wiki/Getting_Started_Guide

Also, FXO would be for a normal analog PSTN connection (like you'd normally have at home). If it's a BRI/PRI connection (pretty common in businesses) you'd need a different (but similar) card/gateway for that.

-Steve




On 9 April 2013 15:00, Ebrahim Bararian <ebrahim.bararian@gmail.com> wrote:
You need to buy a 2-port FXO SIP gateway. You can install an FXO card e.g. Digium. But a gateway is recommended.
Why is a gateway recommended?

 Configure the gateway and the FS sip_profiles, of course. Create a dialplan in the default context to route the call to the FXO gateway when you dial outside line e.g. 9+local_number.
 and how can I set the freeswitch to route the PSTN calls to the IP phone?




On Tue, Apr 9, 2013 at 5:28 PM, Nandy Dagondon <nandy1925@gmail.com> wrote:
You need to buy a 2-port FXO SIP gateway. You can install an FXO card e.g. Digium. But a gateway is recommended. Configure the gateway and the FS sip_profiles, of course. Create a dialplan in the default context to route the call to the FXO gateway when you dial outside line e.g. 9+local_number. 

================================================
www.magicbox.ph - the better magic* VoIP phone for Filipinos
Lapulapu City, Phils
Phone: +63-32-3401807,
Mobile: +63-920-6373450
USA# : (646)547-1226
Worldwide: [*462 + 17772930540 + #] via any 200+ Access Numbers (37 Countries)



On Tue, Apr 9, 2013 at 1:34 AM, Ebrahim Bararian <ebrahim.bararian@gmail.com> wrote:
Hi,
I have some soft IP phones in an internal local network.
I want to connect these IP phones to PSTN via 2 PSTN lines.

How many ways are there to solve this problem?
Which hardwares should I buy?


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org