email 2 sms

Support and queries relating to all previous versions of ZoneMinder
behdha
Posts: 15
Joined: Thu Feb 07, 2008 12:20 pm

email 2 sms

Post by behdha » Tue Feb 12, 2008 12:56 pm

Hi,

I wanna use Zoneminder for a project from holland to purtugal, and for a test a ordered a PV-149 - 4 port video capture card (120FPS) - Realtime recording .

My question is is there a program or device what is supported under linux what makes it's possible to send alerts / events to email and sms????


Thnx in advance,

btw, every project with zoneminder what i implemement for a customer i will donate dedicated amount off money for this project, so if anybody can give more info aobut this too please.

Dave

Secutor
Posts: 13
Joined: Wed Sep 12, 2007 9:01 pm
Location: Silicon Valley

Sending mail when an event is triggered

Post by Secutor » Tue Feb 12, 2008 4:34 pm

There are two parts to getting Zoneminder to send mail notifications when there is an event.
* Getting a camera to recognize and trigger an event.
* Getting the mail system to send the event.

First, getting the camera to recognize an event.

* On the Console screen, select a camera and, under the Function column, set the function for that camera to Modect and notice that the color of the “Modectâ€

behdha
Posts: 15
Joined: Thu Feb 07, 2008 12:20 pm

email2sms

Post by behdha » Wed Feb 13, 2008 1:05 pm

Hi,

Thnx for you're quick reply, this is very clear what you've explained, but what i missing here is if there is some peace off opensource software or program off whatever you like to call it to convert email into sms, --> or to email it 2 sms, in my case when there is an event or alarm that the system would send an email and an sms to a mobile phone, i read somewhere in the forums there is a possiblity to connect a phone to serial port and with some software to send sms, but how do you let zoneminder interact with this software and send sms, does someone has exeriences with this?

Thnx in advance,

Dave

User avatar
robi
Posts: 477
Joined: Sat Mar 17, 2007 10:48 am

Post by robi » Wed Feb 13, 2008 1:11 pm

Ask your mobile operator for a mail>sms gateway service. Most of them offer this service. They give you a virtual e-mail address (like phoneno@operator.com) that you can check ocasionally via a webmail interface, and you get an SMS with the content you can specify whenever an e-mail arrives to this address. You can select if you want the subject, the sender, the first chars of the mail body in your sms...

All you need is to set ZM to send e-mails to this address that you get from the operator.
v1.25.0 + Ubuntu Linux 12.04 Server

User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle
Contact:

Post by cordel » Wed Feb 13, 2008 6:14 pm

You can also have a look at what some other folks on the forum have done.
http://www.google.com/search?q=sms+emai ... minder.com
http://www.google.com/search?q=sms+site ... minder.com

There have certainly been a few implementations others have done.

sognenovski
Posts: 12
Joined: Mon Sep 03, 2007 8:37 am
Location: Australia/Sydney

Post by sognenovski » Wed Mar 26, 2008 11:33 am

[quote]does someone has exeriences with this? [/quote]
Perhaps, only on SME Server.

take a look here
http://www.socomms.com/contrib/howto/

and here
http://forums.contribs.org/index.php?to ... #msg175683
http://forums.contribs.org/index.php?to ... #msg175638

and this
http://forums.contribs.org/index.php?topic=38504.0

All open source and no need for SMS gateway service.

Download SME Server 7.3 iso (www.contribs.org) configure SME for server only or gateway, install the required rpms, plug in the phone, login to ZM and setup monitors, filters and your away. Yeh, I know sounds too easy.

My box has been sending SMS with ZM for last 6 months without a problem.

Let me know, I’ll gather all the requires and upload them, and time permitting assist.

My notes that maybe useful for phone hardware.
- Use genuine data cables
- Don’t use non-geniune data cables, (from experience a hit and miss)

Modems working - Australia
- Nokia 6230, 6310, 6210
- Wavecom WMOD2A-G900 (GSM modem works well)
- Motorola V3

Modems not working - Australia
- Nokia 5110 (you need gnokii emulator)
- Any Nokia that uses DKU-5 data cable (no Linux driver)

Hope it helps.

Best
Steve

behdha
Posts: 15
Joined: Thu Feb 07, 2008 12:20 pm

Email2sms

Post by behdha » Thu Mar 27, 2008 10:51 am

Hi,

Thanx for you're reply, can i do this also on ubuntu or only on smeserver centos right? I hope you can help me further, btw the rpms on nluug is down.

dave

sognenovski
Posts: 12
Joined: Mon Sep 03, 2007 8:37 am
Location: Australia/Sydney

Post by sognenovski » Thu Mar 27, 2008 11:27 pm

Ubuntu is (I guess) possible or any other distro that uses procmail. Haven’t used deb as yet.

From memory
1. I made a code change in zmfilter.pl ZM_MESSAGE_ADDRESS for the email to be sent as plain text only.

2. procmail rule to pipe the email to striphtml.pl script in smstools. The perl script strips all the email headers.
Not really needed for ZM. Its only there for my personal use to filter MS outlook junk.

3. procmail rule to pipe the email to email2sms script in smstools. The script reformats the email further for smstools to handle correctly.
Then the tmp file is placed in the outgoing spooling smstools directory for processing.

4. I lot of late nights setting up correct procmail rules and permissions.

If you decide Ubuntu and compile ZM and smstools from source at the very least you need email2sms and maybe striphtml.pl scripts from the smstools rpm.

I think if you don’t want go down the SME Server path try Centos 4.6. I almost certain smstools rpm should work.
The ZM rpm might, worth a try on a test box. Startup runlevel will have to be changed. SME runs on 7.

I’ll upload the rpms over the weekend.

Steve

sognenovski
Posts: 12
Joined: Mon Sep 03, 2007 8:37 am
Location: Australia/Sydney

Post by sognenovski » Fri Mar 28, 2008 12:19 am

Or, I could post working procmail scripts here, with Moderators approval of course.

User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle
Contact:

Post by cordel » Fri Mar 28, 2008 12:42 am

Sure you could posts scripts.

I don't use sms personally but have helped to get a few systems going and without the hassle of using procmail. Best thing to do is create a script in perl to use the ZM perl modules and you can pull any information available in ZM to use in the sms through any sms program. You reduce the required configuration and dependencies.

But you can also just use BASH filters if you just want to know what monitor has detected a change in image.

Although I find that using ZM alone and sending alerts without any additional help can be very annoying unless the enviroment the cameras are in are very controled.

Just my two cents.

sognenovski
Posts: 12
Joined: Mon Sep 03, 2007 8:37 am
Location: Australia/Sydney

Post by sognenovski » Fri Mar 28, 2008 1:45 am

Cordel, you are absolutely right. I started with the perl script in the wiki but never got around finishing it because of the time constrains, so I went down the procmail path.
It’s something I should revisit and complete - hopefully soon. (my perl is dusty at best)


ZoneMinder zmfilter.pl mod to send pland text email (without multipart/mixed header)

Current code zmfilter.pl

### Create the multipart container
my $mail = MIME::Lite->new (
From => ZM_FROM_EMAIL,
To => ZM_MESSAGE_ADDRESS,
Subject => $subject,
Type => "multipart/mixed"
);
### Add the text message part
$mail->attach (
Type => "TEXT",
Data => $body
);
### Add the attachments
foreach my $attachment ( @attachments )
{
Info( "Attaching '$attachment->{path}\n" );
$mail->attach(
Path => $attachment->{path},
Type => $attachment->{type},
Disposition => "attachment"
);
}
### Send the Message
MIME::Lite->send( "smtp", ZM_EMAIL_HOST, Timeout=>60 );
$mail->send();


replacement code zmfilter.pl

### Create the single part container
my $mail = MIME::Lite->new (
From => ZM_FROM_EMAIL,
To => ZM_MESSAGE_ADDRESS,
Subject => $subject,
Data => $body
);
### Send the Message & scrub headers
$mail->scrub;
MIME::Lite->send( "smtp", ZM_EMAIL_HOST, Timeout=>60 );
$mail->send();


and use this code for ZM_MESSAGE_BODY under options

ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% score.

sognenovski
Posts: 12
Joined: Mon Sep 03, 2007 8:37 am
Location: Australia/Sydney

Post by sognenovski » Fri Mar 28, 2008 1:51 am

email2sms script

#!/bin/sh

# Smsd can send eMails via SMS. You simply need to store the eMail as text
# file in the outgoing queue directory with a unique filename.
# The eMail must include the phone number in the Subject: field, for example:
# To: sms@localhost Subject: 491721234567

# This simple script creates a unique filename and copies the eMail from
# stdin to that file.

# If you use procmail to deliver local eMail. Create the user sms and create
# the file /home/sms/.procmailrc with this content:

# VERBOSE=off
# MAILDIR=/var/spool/mail
# DEFAULT=/var/spool/mail/sms
# LOGFILE=/var/log/procmail
#
# :0
# | /usr/sbin/email2sms



# If you use QMail and vpopmail you need the file
# /home/vpopmail/domains/your-domain/.qmail-sms with this content:

# | /usr/sbin/email2sms


PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
INFILE=$(mktemp /var/tmp/sendsmsemail.in.XXXXXX) || exit 1
OUTFILE=$(mktemp /var/tmp/sendsmsemail.out.XXXXXX) || exit 1
tee $INFILE | formail -X "From:" -X "Subject:" | sed -e "s/^Subject:/To:/" > $OUTFILE
cat $INFILE | formail -I "" >> $OUTFILE
mv $OUTFILE /var/spool/sms/outgoing
# Comment out to see messages sent in /var/tmp
#rm $INFILE

echo "SMS queued"

sognenovski
Posts: 12
Joined: Mon Sep 03, 2007 8:37 am
Location: Australia/Sydney

Post by sognenovski » Fri Mar 28, 2008 2:00 am

and .procmailrc setting


# ---- Defaults ------------------
SHELL=/bin/bash
DEFAULT=$HOME/Maildir/
FORMAIL=/usr/bin/formail
MAILDIR=$HOME/Maildir/
PMDIR=$HOME
SENDMAIL=/usr/sbin/sendmail

# ---- some logging------------------
VERBOSE=no
LOGFILE=$HOME/procmail.log

# ---- delete duplicates -------
:0 Wh: msgid.lock
| $FORMAIL -D 8192 msgid.cache



# ---- user sms rules --------------


:0 fw
* ^.*
| /usr/sbin/email2sms

behdha
Posts: 15
Joined: Thu Feb 07, 2008 12:20 pm

Ok Confused here

Post by behdha » Fri Mar 28, 2008 8:20 am

Hi Guys,

I'm a bit confused here, but maybe that is a lack of knowledge, i want to learn more about scripting, but also confused here, because the some uses bash then the other one uses perl, ok what my question will be, can someone give me the scripts and tools and programs to get zoneminder going on with email and sms, i will promise that i'm going to do my best to make rpm's and debs from the l;ates version of zoneminder including these script so it would be a complete package and them provide them to to the public, btw other quick question is it possible to adjust the layout logo's etc of zoneminder? And which files to translate ?

explanation in steps please!

Thnx for you're time.

Dave

Holland

User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle
Contact:

Post by cordel » Fri Mar 28, 2008 9:11 am

Thanks but we have people who make rpms and debs already. Certainly no need to recreate the wheel. Also there are plenty of examples in the posts above and the links that are given.
There are plenty of ways to go about it.
Heres more.
http://www.zoneminder.com/forums/viewtopic.php?t=4132
http://www.zoneminder.com/forums/viewtopic.php?t=9747
http://www.zoneminder.com/forums/viewtopic.php?t=10976
http://www.zoneminder.com/forums/viewtopic.php?t=7209

Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests