Asterisk send a custom REFER message

hi, I have a question about Asterik 11.2.1, and I really hope some of you can answer me.
scenarios is:

  1. SIP UA A calls SIP UA B. The call is established
  2. Sometime later SIP UA B clicks on the ‘conference’ button and enters the DTMF digits 1234
  3. Asterisk intercepts these digits in a dial-plan
  4. Asterisk builds a SIP REFER message which includes custom ‘refer-to’ header set to '1234@lsrg.com’ and sends the message back to SIP UA A within the same SIP dialog (between SIP UA A and Asterisk)

so, my question is how to build a SIP REFER message using Asterisk, can you tell me if that is possible, and if it is, how to do.
thanks

The Transfer application generates REFER without replaces if the all is already up. The error handling for outgoing REFER is poor.

Thanks david55 , but i am bigginer and your post is difficult for me.please tell me is this scenario possible?

  1. Phone send REFER to A
  2. A Send REFER to B
  3. B receive and call

thanks

Which if any of A and B are Asterisk.

As a beginner, please look for another solution. I am pretty sure that Asterisk will never generate an outgoing REFER, to someone else, in response to an incoming one, but even if it can, the rules will be complex, and the code will be so rarely used that it is very likely to be buggy.

What is the problem that you are trying to solve.

Thanks for the quick reply David. Java-gc and I work for the same company, let me answer your question regarding the scenario. The requirement is to implement the conferencing (bridging) scenario 5.5 in RFC 4579 (link below). The particular difficulty is that “Alice” in our case happens to be an Asterisk box. It needs to send a REFER message to Focus, basically asking it to add another participant to the conference.

tools.ietf.org/html/rfc4579#page-16

Asterisk doesn’t support that. In particular, it is a back to back user agent and tends to treat all SIP URIs as directed at it.

Thanks David. That makes sense, we’re considering custom module development for this.