SIP Transfer (REFER) to external SIP address?

I’m using Asterisk, and I’m trying to Transfer() a call from one Asterisk server to another.

The REFER request comes in, with the correct Refer-To header- showing the correct SIP address to transfer to, but Asterisk gives me an error saying it can’t find that extension (the extension that exists on the remote server), in a local context- which is right- it doesn’t exist locally.

Why is asterisk looking for this extension in a local context, when the Refer-To header clearly points to a remote server?

My setup is like this:

Server A calls server B; server B has a dial plan

s,2,do some stuff over agi

So server B sends server A a REFER request to server C, with Refer-To: sip:100@c.c.c.c

Server A receives the REFER request, but then fails with:

Call 10cfd8e65c0df2c759731d685ef6fefc@b.b.b.b got a SIP call transfer from callee: (REFER)!
Failed SIP Transfer to non-existing extension 100 in context main

Just as a test, I add a local 100 extension on server A under the main context, and it works- but the goal is to transfer to server C, and it seem to just be ignoring the remote IP address of server C.

I’m I missing something to make this work?



Asterisk is a back to back user agent, so it normally only looks at the user part and interprets it locally.

However, I believe there is a sip.conf option that tells it, at least for transfers, that it should take account of the domain part, in which case I got the impression from the code that it would generate real outgoing INVITEs.

Please note that the error handling for failed REFERs is fairly broken in 1.6 and I don’t believe it has been fixed in 1.8, although I haven’t checked this.

Thanks David,

Yeah- I haven’t been able to find any SIP commands that indicate that they make that work- plus- I went through the source code and- after a quick scan- it looks like the only way the transfer request handling code finishes successfully, is if it’s an attended transfer, or if it finds the extension locally- I don’t see anything in the current code base to suggest that it can send an INVITE out to another machine.

I guess I can do something really hokey and add a local extension that I transfer to, with a dialplan that just does a Dial() out to the real host.


I believe allowexternaldomains may have an effect.

Asterisk Me too facing the same issue even after playing with allowexternaldomains.
However 302 works perfectly with external SIP address when promiscredir is set to yes.
@Panic, did you find solution to your problem?