Asterisk dialplan - Prevent Hangup

1.7k views Asked by At

Consider the following scenario :

  1. A is in call with B
  2. B hangs up

Is there any way to redirect the A's channel to some other context so that the A's call is not disconnected and I can bridge another channel to A by using a php AGI script or by using the AMI to attach an event handler and then perform the redirect via AMI ?

The following is my desired behaviour:

  1. A is in call with B, C is in a waiting list
  2. B hangs up
  3. A's call is not hung up and can use a DTMF to switch to C's call

I am using asterisk 13.

EDIT: The call is an incoming call or the call is made by writing a call file, without using the dial command

4

There are 4 answers

2
arheops On

Yes, if you dial via Dial command with "g" option call will go dialplan and you will be able call other person

[Syntax]
Dial(Technology/Resource[&Technology2/Resource2[&...]][,timeout[,options[,URL]]])

[Arguments]
Technology/Resource
    Specification of the device(s) to dial.  These must be in the format
    of 'Technology/Resource', where <Technology> represents a particular
    channel driver, and <Resource> represents a resource available to that
    particular channel driver.
Technology2/Resource2
    Optional extra devices to dial in parallel
    If you need more then one enter them as Technology2/Resource2&Te
    chnology3/Resourse3&.....
timeout
    Specifies the number of seconds we attempt to dial the specified
    devices
    If not specified, this defaults to 136 years.
options
   .....
   g: Proceed with dialplan execution at the next priority in the current
       extension if the destination channel hangs up.
1
Vivek Raj On

You can use option 'g' in dial command.Using this option,When the called party say B hangs up, continue to execute commands in the current context at the next priority.For details visit Asterisk Dial cmd options

0
Anand Kumar Gupta On

It seems that you want to put the queue like feature. If yes then implement the queue and put the phone in auto answer mode. It may resolve your purpose. A will be act as an agent and B and C will dial the queue number and will wait for A in the queue.

0
Nir Simionovich On

The best way to do this is the following:

  1. Accept the A call into a Stasis application
  2. Using the bridges API, put the A call into a holding bridge
  3. Accept the B call into a new Stasis application
  4. Obtain the location of the bridge via a shared storage (Redis, Memcache, MySQL)
  5. Using the bridges API, put the B call into the bridge

    When B call hangs up, A call is still in the bridge, waiting for the next call in line - this would be the best methodology to do this. As you are using Asterisk 13, ARI and Stasis are at your disposal.

    Take a look at http://www.phpari.org to get a feel of the idea - is't not as complicated as it sounds.