[asterisk-users] Asterisk Automated Outbound Messaging

Arturo Ochoa aochoa at e-electrosystems.com
Tue Mar 20 15:33:43 MST 2007


Sorry for my bad english,

I've developed a web interface for one of our customers, that allow them 
to create lists of telephone numbers, (even from excel files), and then 
a couple of scripts, one of them running on the background:
Script 1: Reads the file containing the telephone numbers and then 
creates .call files for each number, and then put all the .call files on 
a temp directory. You can start this process at any time. Even from a 
cron job.
Script 2: Every specific time checks the temp directory, and if it 
founds .call files, then it will copy the .call files to the outgoing 
asterisk directory, but only allowing, for example 5 .calls at the time. 
That way the asterisk only will let go 5 calls at the time. This script 
must be running on the background.

This is script 2:

#!/bin/bash
INTERVALO=10
tmp=/tmp/calls   #directory containing the .calls files
limite_canales=5   #number of simultaneus calls
asterisk=/var/spool/asterisk/outgoing
logger=/var/log/llamadas.log
fecha=`date`

function Generar_llamada {
        outgoing=`ls -1 $asterisk | wc -l`
        if [ "$outgoing" -eq "0" ] ; then
                echo "`date` No existen llamadas en este momento.. 
podemos incluir $limite_canales llamadas!!" >> $logger
                ls -1 $tmp > /tmp/lista_llamadas_totales
                tail -n $limite_canales /tmp/lista_llamadas_totales > 
/tmp/lista_llamadas
                cat /tmp/lista_llamadas | while read line
                do

                        mv $tmp/${line} $asterisk
                done


        fi

        if [ "$outgoing" -gt "0" ] && [ "$outgoing" -lt 
"$limite_canales" ] ; then

                let "extras=$limite_canales-$outgoing"
                echo "`date` Existen $outgoing llamadas en curso.. 
podemos incluir $extras llamadas" >> $logger
                ls -1 $tmp > /tmp/lista_llamadas_totales
                tail -n $extras /tmp/lista_llamadas_totales > 
/tmp/lista_llamadas
                cat /tmp/lista_llamadas | while read line
                do
                        mv $tmp/${line} $asterisk
                        echo "`date` Archivo $line fue movido a 
$asterisk" >> $logger
                done

        fi

        if [ "$outgoing" -ge "$limite_canales" ] ; then
                echo "`date` No existen llamadas Disponibles en este 
momento.. favor de intentar mas tarde!!" >> $logger
        fi

}

while : ; do

        call_files=`ls -1 $tmp | wc -l`
        if [ "$call_files" -gt "0" ] ; then
                 echo "`date` Comenzando con el procedimiento de 
generacion de llamadas..." >> $logger
                 Generar_llamada
        else
                 echo "`date` No existen cambios en el directorio $tmp" 
 >> $logger
                 echo "`date` A dormir por $INTERVALO segundos" >> $logger
        fi
sleep $INTERVALO
done


Hope it helps!



-- 
Ing. Arturo Ochoa N
Network Administrator
Electrosystems,



Yuan LIU escribió:
>> From: Rob Schall <rschall at callone.net>
>> Date: Tue, 20 Mar 2007 16:00:01 -0500
>>
>> Cory Andrews wrote:
>> >
>> > These folks have 6-8 T's worth of outbound they do on a daily basis, I
>> > need an interface that would allow them to stick a comma delimited 
>> file
>> > or file(s) in every day via FTP, the file would contain call #'s, and
>> > some additional variables, and then the Asterisk box would schedule 
>> the
>> > calls.  It would pull a voice file locally and deliver to answering
>> > machines or live call recipients.
>
> Looks like user interface is not a concern - if they are thinking of 
> FTP text files.  In this case, a simple script to kick off some call 
> files should suffice.  Won't take a week. (Search for call file.)  But 
> having to deal with answering machines is always tricky for any 
> automation.
>
> Yuan Liu
>
>> > Cory Andrews
>> >
>> > -----Original Message-----
>> > From: asterisk-users-bounces at lists.digium.com
>> > [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Lee
>> > Jenkins
>> > Sent: Tuesday, March 20, 2007 3:33 PM
>> > To: Asterisk Users Mailing List - Non-Commercial Discussion
>> > Subject: Re: [asterisk-users] Asterisk Automated Outbound Messaging
>> >
>> > Cory Andrews wrote:
>> >
>> >> I have a client application looking for an Asterisk based solution.
>> >> Client wants to deliver pre-recorded messages for a variety of
>> >>
>> > clients.
>> >
>> >> Wondering if anyone is offering an middleware for Asterisk for
>> >> management of outbound messaging?
>> >>
>> >>
>> >
>> > Someone can correct me if I'm wrong, but I think a friend of mine
>> > mentioned that TrixBox has a gab cast function.
>> >
>> > It also shouldn't be that difficult to put together a script to do 
>> this.
>> >
>> >   I actually have plans to do this myself, but no need for it just
>> > yet...
>> >
>> >
>> >
>> If they want a decent interface to see the next "caller" before calling,
>> you might want to have a database that reads in all the numbers, then
>> users that grab the next "non-checked" number from the database. This
>> also gives you the option of leaving notes with that call (such as
>> calling back, etc). Then when ready, press the "call" button which
>> creates a call file.
>>
>> Rob
>
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
>



More information about the asterisk-users mailing list