Problems transfering call betwen different machines (REFER)

I’m currently trying to enable call transfer to different domains in
my asterisk box (Asterisk 1.2.13 running on Debian etch). I have a
configuration that requires me to transfer call to separate domains
like ext@10.10.10.10:5050. My calls come from a R2 channels in a
board installed in the machine. When the call comes in I dial a sip
address in another machine and I need to receive REFER from this
other machine to transfer the call to a third sip URI, that may be or
not in any of the two machines . My machines change all the time, so
registering them in my asterisk box is not an option. The big picture
here is this: I have a asterisk box to receive calls from PSTN and I
send this calls to sip application that I made that will transfer the
call to a different sip application depending on user
input. And this other application also needs the ability to transfer
calls to different sip URI. The applications are conferences, voice
mail and others, each running on a different sip uri (ext@ip:port)
and the user needs to jump between them. So I need my asterisk box to
accept arbitrary sip URI in a REFER (xfer) command. Right now it
always tries to send the call to a local extension, for example, if I
have a call from my asterisk to “555@10.10.10.1:5060” and this
application asks asterisk to transfer this call to
"666@10.10.10.2:5070" asterisk will try to send the to the local
extension 666. Bellow I have a sip debug from the messages. My
asterisk box is running in the IP 201.73.67.5, and my first
application (the one that asterisk dials directly) is at the address
201.73.67.7:5080 and it transfers the calls to 201.73.67.7:5070, but
it fails.

All help is very much welcome.

Thanks in advance,

Thiago

Sip debug:

<-- SIP read from 201.73.67.7:5080:
REFER sip:3130296800@201.73.67.5 SIP/2.0
Via: SIP/2.0/UDP
201.73.67.7:5080;rport;branch=z9hG4bKPj3r0RqvljQLyTKpBVXgbhce5dADV20tVx
Max-Forwards: 70
From: sip:0778@201.73.67.7;tag=1jAy-XotYlPo06lq7VDTkQxfne5PnnPA
To: “3130296800” sip:3130296800@201.73.67.5;tag=as26b5df58
Contact: sip:201.73.67.7:5080
Call-ID: 67d8e3801b04410659f8ea1b635b6db6@201.73.67.5
CSeq: 15651 REFER
Event: refer
Expires: 300
Accept: message/sipfrag;version=2.0
Allow-Events: presence, refer
Refer-To: sip:5070@201.73.67.7:5070
Referred-By: sip:0778@201.73.67.7
Content-Length: 0

— (15 headers 0 lines) —
Transfer to 5070 in from-sip-external
Transfer from 0778 in from-sip-external
Transmitting (no NAT) to 201.73.67.7:5080:
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP
201.73.67.7:5080;branch=z9hG4bKPj3r0RqvljQLyTKpBVXgbhce5dADV20tVx;received=201.73.67.7;rport=5080
From: sip:0778@201.73.67.7;tag=1jAy-XotYlPo06lq7VDTkQxfne5PnnPA
To: “3130296800” sip:3130296800@201.73.67.5;tag=as26b5df58
Call-ID: 67d8e3801b04410659f8ea1b635b6db6@201.73.67.5
CSeq: 15651 REFER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:3130296800@201.73.67.5
Content-Length: 0
X-Asterisk-HangupCause: Normal Clearing


set_destination: Parsing sip:201.73.67.7:5080 for address/port to
send to
set_destination: set destination to 201.73.67.7, port 5080
Reliably Transmitting (no NAT) to 201.73.67.7:5080:
NOTIFY sip:201.73.67.7:5080 SIP/2.0
Via: SIP/2.0/UDP 201.73.67.5:5060;branch=z9hG4bK26db8c59;rport
From: “3130296800” sip:3130296800@201.73.67.5;tag=as26b5df58
To: sip:0778@201.73.67.7:5080;tag=1jAy-XotYlPo06lq7VDTkQxfne5PnnPA
Contact: sip:3130296800@201.73.67.5
Call-ID: 67d8e3801b04410659f8ea1b635b6db6@201.73.67.5
CSeq: 103 NOTIFY
User-Agent: Asterisk PBX
Max-Forwards: 70
Event: refer;id=15651
Subscription-state: terminated;reason=noresource
Content-Type: message/sipfrag;version=2.0
Content-Length: 14

SIP/2.0 200 OK

set_destination: Parsing sip:201.73.67.7:5080 for address/port to
send to
set_destination: set destination to 201.73.67.7, port 5080
Reliably Transmitting (no NAT) to 201.73.67.7:5080:
BYE sip:201.73.67.7:5080 SIP/2.0
Via: SIP/2.0/UDP 201.73.67.5:5060;branch=z9hG4bK1e66e326;rport
From: “3130296800” sip:3130296800@201.73.67.5;tag=as26b5df58
To: sip:0778@201.73.67.7:5080;tag=1jAy-XotYlPo06lq7VDTkQxfne5PnnPA
Call-ID: 67d8e3801b04410659f8ea1b635b6db6@201.73.67.5
CSeq: 104 BYE
User-Agent: Asterisk PBX
Max-Forwards: 70
X-Asterisk-HangupCause: Normal Clearing
Content-Length: 0


<-- SIP read from 201.73.67.7:5080:
SIP/2.0 200 OK
Via: SIP/2.0/UDP
201.73.67.5:5060;rport=5060;received=201.73.67.5;branch=z9hG4bK26db8c59
Call-ID: 67d8e3801b04410659f8ea1b635b6db6@201.73.67.5
From: “3130296800” sip:3130296800@201.73.67.5;tag=as26b5df58
To: sip:0778@201.73.67.7;tag=1jAy-XotYlPo06lq7VDTkQxfne5PnnPA
CSeq: 103 NOTIFY
Contact: sip:201.73.67.7:5080
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY,
PUBLISH, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, norefersub
Content-Length: 0

— (10 headers 0 lines) —

<-- SIP read from 201.73.67.7:5080:
SIP/2.0 200 OK
Via: SIP/2.0/UDP
201.73.67.5:5060;rport=5060;received=201.73.67.5;branch=z9hG4bK1e66e326
Call-ID: 67d8e3801b04410659f8ea1b635b6db6@201.73.67.5
From: “3130296800” sip:3130296800@201.73.67.5;tag=as26b5df58
To: sip:0778@201.73.67.7;tag=1jAy-XotYlPo06lq7VDTkQxfne5PnnPA
CSeq: 104 BYE
Content-Length: 0

— (7 headers 0 lines) —