Trunk refer question

I have a SIP trunk with a call into Asterisk which then calls a SIP client. The SIP client wants to transfer to a third SIP device that is external to the trunk and Asterisk. Is there a way to forward this transfer to the trunk to pull the call away from Asterisk?

Asterisk doesn’t have a concept of trunks, and SIP can only ever call SIP Servers!

chan_sip can do blind transfers, using the Transfer application. If the call hasn’t been answered, this will issue a 302 response, with Asterisk as the server. If the call has been answered, it will reverse roles and issue a REFER as client.

The initial destination can use a 302 response as server, that directs to dialplan that issue the Transfer. It could also answer and then reverse roles and issue REFER, for a blind transfer, as client, which could be handled the same.

Note that some phones do blind transfers as attended transfers, and if you use the simple logic above, Asterisk will issue to REFER back to party B, not to the party A that you want it to target.