title: Asterisk: forwarding a call without answering immediately
body: <p>I'd like to forward a call. I can define an extension, answer the call and use Dial command. But t is not what I want. I don't want to answer the call immediately. I'd rather wait the second call to be answered.</p>
  
  <p>How to do it? When I just use Dial(Sip/...) without answering, there is a complete silence on both sides.</p>
  
  <p>I've read (see <a href="http://fonality.com/trixbox/forums/trixbox-forums/open-discussion/call-forward-without-answer-dialplan" rel="nofollow">http://fonality.com/trixbox/forums/trixbox-forums/open-discussion/call-forward-without-answer-dialplan</a> ) that it can be solved by disabling fax. I've unloaded fax modules, but it didn't solve the problem. On the same page, I've read that I can try somethig like <a href="http://www.voip-info.org/wiki/view/Asterisk%20auto-dial%20out" rel="nofollow">http://www.voip-info.org/wiki/view/Asterisk%20auto-dial%20out</a> , but that looks too advanced.</p>
  
  <p>I've another idea. Use Dial(Sip/..., 60, M(a-macro)). But I don't know how to join these two calls in the macro.</p>
  
  <p>Any idea?</p>
  
  <p>EDIT: To make it clear. When I use just Dial (e.g. Dial(SIP/uri) or Dial(SIP/uri, 60, r)), it does the following:</p>
  
  <ol>
  <li>caller: It rings</li>
  <li>SIP phone (or software) rings</li>
  <li>The call is answered from the SIP phone</li>
  <li>SIP phone: There is no sound.</li>
  <li>caller: It stops ringing, there is no sound</li>
  </ol>
  
  <p>When I add command Playback(invalid) before Dial(...) command, it is completely different:</p>
  
  <ol>
  <li>caller: It rings</li>
  <li>caller: The call is answered and the message "invalid" is read.</li>
  <li>caller: It rings (but the call is answered and callers pays this ringing time)</li>
  <li>SIP phone (or software) rings</li>
  <li>The call is answered from the SIP phone</li>
  <li>The call is successfully connected</li>
  </ol>
  
  <hr>
  
  <p>Is seems that the problem occurs if and only if when the call is not explicitly answered (e.g. via Playback(...) or Answer()) before Dial(...) command. So, something like following may help (JQuery-like pseudocode):</p>
  
  <pre><code>call_1.Dial(...).onAnswer(function(call_2){
      call_1.Answer();
  });
  </code></pre>
  
  <p>Asterisk tries something similar, but the Asterisk's way is buggy.</p>
  
  <p>Of course, adding Answer() before Dial(...) works, but I don't want to answer the call until the redirected call is answered</p>
  
  <hr>
  
  <p>I've almost solved it by using Dial(SIP/..., timeout, A(invalid)). Now, I've to use another (zero-length or almost zero-length) sound.</p>