PBX in a Flash & SPA-3102 Initial Setup Help

I recently installed PIAF on a HP T5720 Thin Client and it is bootable from an 8-gig USB Flash Drive. I attempted to setup the system and am a bit confused after reading multiple sources on configuring the system to work with the Linksys SPA-3102 unit.

Background:

  1. PIAF is residing on a HP T5720 Thin Client.
  2. Linksys SPA-3102 is my VOICE Gateway Unit. I have a POTS line plugged into the LINE (FXO) Port and an Analog Phone plugged in the PHONE (FXS) Port.
  3. The WAN port of the SPA-3102 is connected to sub router (WRT54G-TM, with DD-WRT firmware – Bridged Mode). [ 192.168.1.100 ]
  4. This router is connected to one of the LAN port of my Main Router (Bridged Mode also). [ 192.168.1.3 ]
  5. The HP T5720 Thin Client LAN (PIAF) is connected to the ETHERNET (LAN) Port of the SPA-3102. [ 192.168.1.20 ]
  6. The main Router is a D-Link DGL-4100 and handles ALL DHCP Server functions. [ 192.168.1.1 ]
  7. I have another VOIP router, Linksys WRTU54G-TM, through T-Mobile. [ 192.168.1.175 ]

Objective:

I would like to have the PBX unit handle all my VOIP and POTS lines. I have the following voice setup:

a) One (AAA) XXX-XXXX line from a VIOP provider with both incoming and outgoing call capability. This line has only outgoing caller ID.
b) I have another line, (877) YYY-YYYY also from the same VOIP provider, but this toll free line has incoming call capability. This line has incoming caller ID.
c) The T-mobile line, (AAA) ZZZ-ZZZZ, has unlimited local and long distance call capability and is located on my local network and is NOT connected to the SPA-3102. This line has both incoming and outgoing caller ID.
d) The POTS line is connected directly to the SPA-3102 FXO port, and serves as primarily as my FAX line, used for 911 and local calls, if so desired. This line DOES NOT have incoming caller ID, only outgoing caller ID!

I would like to have two voicemail boxes. One for the all incoming calls from (AAA) XXX-XXX and (877) YYY-YYYY and the other voicemail box for (AAA) ZZZ-ZZZZ.

Would also like to be able to call in the PBX system from my mobile phone and after proper authentication, be able to get a dial-tone and place all my mobile calls through the T-Mobile VOIP line [ (AAA) ZZZ-ZZZZ ]. Is this possible through the local network or do I have to plug the T-Mobile router directly into say the POTS (FXO) port on the SPA-31202?

Bottom line: Given the background information, how do I go about setting up PIAF so that all my outgoing long distance calls goes thru the (AAA) ZZZ-ZZZZ unit and the local calls goes through the POTS line (& 911). Also, how would I setup the two different voicemail boxes, etc.

Any help would be greatly appreciated. Detail steps would be prefer or a how-to what trucks (incoming and outgoing) do I need setup. How would I handle the tmobile VOIP phone that is on the network, etc.