Catching an input from IVR and then placing it as outbound call from second server

I have two freepbx servers at different locations both connected using IAX trunk. Incoming calls are directed to an IVR on server1.
How do i configure it in a way that server1 saves the input from IVR and then checks if it starts with +1, it will sends it to server2. further the input from IVR will be placed as an local call by server2 using a SIP trunk.

I’m no expert, but that doesn’t sound like how an IVR works, so I think we need a better understanding of what it is you are trying to do.