2
votes

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.

4
Is this a "warm" or "attended" forward, or "blind"?MichelV69
It is a unconditional call forward from GSM to SIP.v6ak
Can you check if your sip client can work with gsm codecs? Sounds to me like a codec transcoding issue. If Asterisk explicitly answers the call, then it might automatically transcode for you, but if it only forwards the call metadata back and forth, it might not realise that the two calls use incompatible codecs...Stobor
My client (SIPDroid) surely supports GSM codec and the codec is enabled. However, the original GSM codec is not much used. In both cases, it uses PCMA (aLaw) codec.v6ak
I've done some extra research and found that Dial(SIP/..., timeout, A(invalid)) does the trick. Now, I've to just make an empty sound file and use it instead of invalid.gsm.v6ak

4 Answers

3
votes

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.

2
votes

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.

0
votes

What I would suggest is this:

  1. Open your first call, and direct them into a dynamic conference, playing ringing. Set the conference number as a unique 8-digit number.
  2. Open your second call, and store the above conference number as a channel variable.
  3. IF the second call answers, read the channel variable, and drop that call into the appropriate conference.
  4. IF the second call does not answer, then hangup the first call. You determine this by polling the AMI for all conferences with only one participant, checking the "off hook" time of their channel, and if it is too long, that means a no-answer/no-join.

I've used this approach for a similar client project and it's pretty easy to implement as a combination of Asterisk Dial Plan and an AGI. I used spooled call files as a way of getting the dialing running with the appropriate channel variables and such. It's easy, quick and clean.

0
votes

Well,

Sounds to me that your primary issues are not directly dialplan related, but also network related. The situation of not hearing anything is usually caused by your Asterisk server located in one location and your client and termination located behind NAT firewalls. Or, another possibility, your Asterisk server is behind a firewall, and one of the parties as well. In any of these, if your sip.conf configuration is ill-configured, it won't work.

Now, if you want to try something funky, do the follow:

exten => _XXXX,1,Noop(*** Here we Go ***)
exten => _XXXX,n,Playback(SomeShortFile,noanswer)
exten => _XXXX.n,Dial(Your SIP destination,60,R)

The second line should change the SIP 180 messages to a SIP 183 message and the "R" parameter should generate a local ring-tone, in a case the remote end doesn't.

If this does't resolve the issue, I would suggest you past your sip.conf configuration to http://www.pastebin.ca, and share the link with us, so we can take a look.

Nir S