Ringback function (or whatever it is called)

I dont know what this is called, but I would want a ringback function.

1: A external entity (program, webpage, whatever) asks Asterisk to do a “ringback” between caller with SIP identity XXX and SIP identity YYY
2: The phone at XXX start ringning.
3: When XXX picks up the hook, asterisk will immediately begin connecting the call to YYY.
4: The phone at YYY start ringning.
5: YYY picks up the hook.
6: A call is now connected between XXX and YYY.

How I do to accomplish this? Guess I need to do something wth call files in the /var/spool directory?

Call file, Originate action from AMI or Originate from CLI.

You could use call files or (like David said) AMI to originate calls like this. Check out voip-info.org/wiki/view/Aste … o-dial+out