[asterisk-users] Autodialer - call simultaneously to both ends

Antony Stone Antony.Stone at asterisk.open.source.it
Mon Jun 26 11:12:48 CDT 2017

On Monday 26 June 2017 at 18:01:22, J Montoya or A J Stiles wrote:

> On Monday 26 Jun 2017, Harel wrote:
> > Hello List,
> > I'm working on an autodialer project.
> > At the moment I use the Originate application then I "throw" it to an
> > extension where I Dial() the other party and then both legs are bridged.
> > The problem is that the Dial() will only run after the Originate finish
> > its bit and I have lots of wasted time or even worse, the remote party
> > hanging the call because instead of a human speaking to him the call
> > setup to the 2nd leg only starts when remote answers. Is there a way to
> > start calling both parties at the same time and bridge them when one
> > answers (which will then hear the ringback tone until 2nd party
> > answers)? Thank you
> Our auto-dialler works as follows;
> * Agent clicks number on screen in their web browser
> * Agent's phone rings
> * Agent picks up phone
> * Far end party's phone rings
> * Far end party answers
> * Agent and far end party are bridged.
> and is implemented using the truly ancient technology of callfiles.

These work well and are implementable using any language capable of producing 
a text file.

It's also extremely simple (so long as you can write a network client 
application) to achieve the same thing using an AMI Originate request.

> All you need then is a Perl or PHP script, which accepts the destination
> number as a query parameter.  Your script then needs to identify the
> workstation by means of its IP address and determine the number of the
> nearest phone  (this does require proper configuration of DHCP server, but
> is worth it),  then write out a callfile.
> Note:  There exists a race condition in Asterisk  (at least, when using the
> common Linux file systems, which update a folder's directory as soon as the
> *first* block of a file is written)  which means that if a callfile exceeds
> one block, Asterisk could end up reading only the first block and ignoring
> the rest.  If there is any danger that a callfile could exceed one block
> on your filesystem, you must write the callfile to a different folder, and
> then use the `mv` command to move it to /var/spool/asterisk/outgoing/ . 
> This sidesteps the race condition due to the behaviour of the mv command. 
> When moving *within* a filesystem, the whole file was already on the disk
> anyway when the directory is updated; when moving from one filesystem to
> another, it does not update the directory of the destination folder until
> the *last* block is written.

Yes, that is a very important point.  Always use mv with callfiles :)

However, to get back to the original poster's question, I believe it's the 
logic of which way round the calls are being made that's the problem (I agree 
toally with your 6-step summary above), rather than the mechanism for being 
able to make calls.


BASIC is to computer languages what Roman numerals are to arithmetic.

                                                   Please reply to the list;
                                                         please *don't* CC me.

More information about the asterisk-users mailing list