Switch from E1 to Analog PSTN line on IP-PBX failure

I have two Asterisk servers,

  1. E1(PRI) Gateway Asterisk 1.4 with E1(PRI) card
  2. IP-PBX Asterisk 1.8 on VM Server
    When my e1 gateway is failed (ex. shutdown, no power…), PSTN automatically switch to analog lines

but when my IP-PBX is failed I want to make the gateway to route the call back to the PSTN again and there switch the call to an analog line.