Failover PSTN/IAX2


Hi everyone. I need to solve a small (hopefully small) problem.

I have asterisk running on 2 machines. 1 IVR, 1 Machine for handling the Queue(s). I want to try out a self written callcenter solution. The Ivr is in full production, so I need to do the following.

The queue is limited for 1 user. My problem is: I want 1 user in the queue and the rest should be routed via PSTN. My dialplan does the following:

asterisk1: Dial(IAX2/123xxxxx)
asterisk2: Queue(1000/xxxxx)

this means asterisk 1 dials via IAX the 123 extension on astrisk, which connects the user to the queue. We have a second, non asterisk, queue running on a third machine, connected via pstn. I need something on asterisk 1 which does: if queue is full connect via pstn. must be a gotoif statement or something. any ideas?

thx ueberspasti