I want emulate REFER message from bleg via ${dial-string}. Please help me find how to do it.

I try 
1) originate sofia/internal/sip:1000@8.8.8.8  &bridge({execute_on_ring='transfer 1001 XML default'}loopback/9180/default)

2) originate sofia/internal/sip:1000@8.8.8.8  &bridge({execute_on_ring='transfer 1001 XML default'}sofia/internal/sip:1002@8.8.8.8)

In both cases all leg hangup.

Also two question:
1) can be lua or other scripting language used to emulate endpoint (implement endpoint interface)?
2) how can be realized "execute_on_channel_create_failure" logic similarity "execute_on_ring".

Sergey