Using Asterisk only to reroute and generate calls in other PBXs

Hi, I appreciate any help with the following:

1.Everytime a specific number arrive to a group of PBXs, the call will be send to an Asterisk (done)
2.When the call arrive to Asterisk a php script will query a database with the origin number and return another number (kind of done using AGI)
3. With the returned number, Asterisk needs to “return” the call via SIP (maybe move temporary) to the PBX and generate the call from there (no idea how to do it)

I don’t need extensions or generate calls in the Asterisk only return the correct number to the origin PBX and make the call ¿do you think it is a good approach to do it?

To which PBX do you want to sent the call to. You have three with the same name.

The call needs to be returned to the same PBX that origin the call

Greetings

Transfer(SIP/)

The URI is partial in that it can only contain a user and domain part (sip: is understood).

This feature is relatively likely used and the error handling, particularly for answered calls, an be flakey. There is not much scope for error recovery on unanswered calls.