Asterisk: forwarding a call without answering immediately

15,441

Solution 1

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/[email protected], 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/[email protected], 600, A(beeperr)).

Now, it works:

  1. A caller makes a call.
  2. A call to [email protected] is created.
  3. Call to [email protected] is answered by user.
  4. A short sound (i.e. beeperr) is played to [email protected]
  5. The original call is answered and bridged.

In this case, the caller don't hear the beeperr sound. The sound is played only to [email protected]. This makes a short pause between answering the call by [email protected] 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.

Solution 2

Yes, correct way is just do dial.

IF you not get any ringing, you have play with ringing/early media paramters of asterisk and gsm gateway.

But if you use cheap gsm gateway you can't send anything to provider side(gsm provider will not allow that).To send early media via gsm network you have be connected via digital equipment like e1 line to gsm provider.

As option you can try dial command with r option or use Ringing command before dial, but that very higly depend of gsm gateway setup.

Share:
15,441
v6ak
Author by

v6ak

Focused on security and crypto. Got in Google HoF. Scala enthusiast. Static typing and fail-fast advocate.

Updated on June 04, 2022

Comments

  • v6ak
    v6ak almost 2 years

    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:

    1. caller: It rings
    2. SIP phone (or software) rings
    3. The call is answered from the SIP phone
    4. SIP phone: There is no sound.
    5. caller: It stops ringing, there is no sound

    When I add command Playback(invalid) before Dial(...) command, it is completely different:

    1. caller: It rings
    2. caller: The call is answered and the message "invalid" is read.
    3. caller: It rings (but the call is answered and callers pays this ringing time)
    4. SIP phone (or software) rings
    5. The call is answered from the SIP phone
    6. The call is successfully connected

    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.