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.
How to do it? When I just use Dial(Sip/...) without answering, there is a complete silence on both sides.
I've read (see http://fonality.com/trixbox/forums/trixbox-forums/open-discussion/call-forward-without-answer-dialplan ) 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 http://www.voip-info.org/wiki/view/Asterisk%20auto-dial%20out , but that looks too advanced.
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.
Any idea?
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:
When I add command Playback(invalid) before Dial(...) command, it is completely different:
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):
call_1.Dial(...).onAnswer(function(call_2){
call_1.Answer();
});
Asterisk tries something similar, but the Asterisk's way is buggy.
Of course, adding Answer() before Dial(...) works, but I don't want to answer the call until the redirected call is answered
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.
I was not able to create a valid zero-length sound, but following solution seems to be good enough for me:
exten => s,1,<log it>
exten => s,n,Dial(SIP/address@somewhere.com, 600, A(beeperr))
exten => s,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?:callfail)
exten => s,n(callfail),<report call fail>
The most important part of code is Dial(SIP/address@somewhere.com, 600, A(beeperr))
.
Now, it works:
In this case, the caller don't hear the beeperr sound. The sound is played only to address@somewhere.com. This makes a short pause between answering the call by address@somewhere.com and answering the original call. In the pause, beeperr is played.
Maybe directmedia=no is a part of the solution, but I am not sure.