[asterisk-users] Check for the voicemail

Roberto Piola roberto.piola at visiant.it
Wed Aug 22 05:35:09 CDT 2012


Ok: this is the complete recipe.

first, make a sendmail.cf configuration file so that you are sure that
sendmail tries to deliver directly to your server, and not to spool
the file locally in order to send it later.

cp /etc/mail/sendmail.cf /etc/mail/direct-delivery-sendmail.cf
vi +/^DS /etc/mail/direct-delivery-sendmail.cf
end modify the line that begins with DS (for smart relay host) into:
DSyour.exchange.server.name

save and then write a script like this:

#!/bin/bash
# this is the location of the temporary file for redirecting stdout-
anything unique will go
TEMPFILE=/dev/shm/checkeddelivery.$$
/usr/lib/sendmail -v -g -C  /etc/mail/direct-delivery-sendmail.cf  $*
2>&1 >/dev/shm/checkeddelivery.$$
if [ $? != 0 ]; then
  .... do domething: sendmail returned an immediate local error
elif [ $( grep -c ^250\\.2\\.0\\.0 $TEMPFILE) == 0 ]; then
  .... something: sendmail did not get a "250 2.0.0 OK message" from
the remote server
  .... just check that your.exchange.server.name answers wth "250
2.0.0 OK", or adjust the script accordingly
 ... here you can also check for some different errors and behave
differently for over quota,
fi
#on the first runs, you may leave the file in order to inspect it
rm $TEMPFILE


and invoke the script as:
myscript recipientaddress
piping over standard input the complete mail you want to send (not
only the .wav attachment)

On Wed, Aug 22, 2012 at 12:09 PM, Danilo Dionisi
<dionisi.danilo at gmail.com> wrote:
> How can I, with a bash script to take the standard output?
> When I take the standard output, I'll do the grep to see if there is a code
> 450.
> Right?
>
> Il 22/08/12 11:56, Roberto Piola ha scritto:
>
>> no. when you issue sendmail -v ...., the output is sent on the standard
>> output
>
>
> --
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users



-- 
Roberto Piola, Ph.D.
Senior Network Engineer
Outsourcing Infrastructure

VISIANT OUTSOURCING

strada del Drosso 128/6 - 10135 Torino
T +39 011 3473520 - T +39 02 45413318 - F +39 011 3473522
M +39 3356961505
roberto.piola at visiant.it

www.visiantoutsourcing.it


Questo messaggio è destinato alle sole persone indicate e può
contenere informazioni riservate. Se avete ricevuto questo e-mail per
errore siete pregati di comunicarlo immediatamente al mittente o di
inviare un e-mail a: info.outsourcing at visiant.it. Ogni altro uso del
messaggio è vietato.

This e-mail may contain confidential and/or privileged information. It
is intended solely for the addressee. If you are not the intended
recipient please notify immediately the sender or email:
info.outsourcing at visiant.it. All other use is prohibited.



More information about the asterisk-users mailing list