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

J Montoya or A J Stiles asterisk_list at earthshod.co.uk
Mon Jun 26 11:01:22 CDT 2017


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.


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.

-- 
JM or AJS

Note:  Originating address only accepts e-mail from list!  If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .



More information about the asterisk-users mailing list