Matt G. Watson

Just another geek
Add to Technorati Favorites
June 8th, 2008

HowTo: Asterisk AlarmReceiver with DSC Alarm

Synopsis

This HowTo is a guide on using Asterisk’s AlarmReceiver() application to make Asterisk act as an Ademco Contact ID alarm monitoring station. In short this application is capable of receiving calls from your alarm panel every time an event occurs on your system. This is essentially a complete home grown self-monitored alarm setup.

I should mention upfront that this application is not approved by the Underwriter’s Laboratory and as such, any insurance benefits you have from having an alarm system will probably be null and void with your insurance company if you go down this path. Personally, I think alarm systems in homes that do not utilize cellular connections are useless anyways. Landlines are too easy to disconnect on most homes… rendering the alarm monitoring useless.

Additionally, this guide assumes that your system is already programmed for monitored and that you just want to interface it with Asterisk.

What You Will Need

  1. DSC Alarm Panel (I imagine all system that use Ademco Contact ID will work, but you are on your own for configuration).
  2. Installers / Downloading Code
  3. DLS 2002 software (not required, but makes things easier, this can be downloaded from several places)

If you don’t have the installer or downloading code, to put it bluntly, you are more or less out of luck. The only thing you can possibly do is try factory resetting your panel to defaults, however be warned that by doing this your system will lose ALL programming and you’ll need to program it from scratch either through the keypad or using the DLS 2002 software. Unfortunately DSC systems also have an “Installer’s Lockout” ‘feature’ which prevents you from factory resetting the system without the installer code… this was the case for me, I had purchased a home with a DSC Power632 system, but the previous owners were not using it and had forgotten all codes and the installer’s lockout was enabled. In my case, instead of paying the installer for a service call, I opted to replace the main circuit board with a DSC 5010 v2 board, effectively upgrading my system to a Power832. I purchased the replacement board from ebay for roughly the same cost as a service call would have been.

Asterisk Setup

The first thing we need to do is do a little bit of Asterisk setup. This should all be pretty straightforward. All that you need to do is create two extensions, one for the panel, and one for the modem in your configuration computer. In my case I used 2 ZapTel / DAHDI FXS interfaces, but you could also use SIP ATAs and probably still be ok. I expect that anybody reading this would already be familiar with Asterisk and be capable of doing this quite easily.

DLS 2002 Programming

The next thing we need to do is change the phone number that the alarm panel is going to dial when events happen. I’ve created a series of screenshots that should guide you through this easily.

DLS Walkthrough

	

You could opt to skip this step, and simply place Asterisk between the alarm panel and your telephone connection, and simply modify your dialplan so when your alarm dials the pre-programmed number, you divert it to the AlarmReceiver() application.

AlarmReceiver Setup

In the above example we set the panel to dial 9951 when any events occur on the panel. Now we need to setup our dialplan in Asterisk to execute the AlarmReciever() application when 9951 is dialed. All you need to do is add the following to your dialplan in the proper context for your setup:

exten => 9951,1,Ringing();
exten => 9951,2,Wait(6);
exten => 9951,3,AlarmReceiver
exten => 9951,4,Hangup

Next we need to setup alarmreceiver.conf

[general]
timestampformat = %a %b %d, %Y @ %H:%M:%S %Z
eventspooldir = /tmp
logindividualevents = no
fdtimeout = 2000
sdtimeout = 200
loudness = 8192

Thats it! reload your Asterisk configuration and try setting off your alarm (if your system has an outdoor alarm somewhere, I recomend disconnecting it first! or at least warning the neighbors). If you are watching the Asterisk console hopefully you can see the call progressing. A moment later you should find some event-* files in /tmp. This is where AlarmReceiver() is recording the events, the files contain data like:

[metadata]

PROTOCOL=ADEMCO_CONTACT_ID
CALLINGFROM=19900
CALLERNAME=<unknown>
TIMESTAMP=Sun Jun 08, 2008 @ 20:58:15 EDT

[events]

0001181102010023

The format for the event codes can be found on digium’s bugzilla. I don’t believe the description their is entirely accurate, according to the Ademco Contact ID Specifications the format be 15 hex digits, however Asterisk outputs 16, from my observation so far, this is my description of the code:

AAAA MM Q X EE PP ZZZ C

AAAA = Account Number
MM = Message type (Either 18 or 98)
Q = Qualifier (1 = New Event, 3 = Restore Event, 6 = Previous Event still present)
X = ??? Every event I have received so far is a ‘1′, this could be a Panel ID perhaps, maybe this should be an ‘E’ and my system just only supports 2 digit hext event codes instead of 3
EE = Event Code - These are the codes programmed into your system for every possible event, these are what I said would come in handy later if you got them. Each code will represent something happening. (On my system “01″ means new Zone 1 event, and ‘11′ means Zone 1 restored)
PP = Partition Number
ZZZ = Zone number
C = Checksum

One last handy feature of alarmreceiver is the ability to execute system commands whenever an alarm is recorded. This can be configured in alarmreceiver.conf:

eventcmd = /usr/local/bin/alarmevent

where ‘alarmevent’ is a script or program which preforms an action whenever we receive an event, such as a script that will page your mobile phone. This is what I’ll be working on next!

5 Responses to “HowTo: Asterisk AlarmReceiver with DSC Alarm”

  1. [...] step by step, there is already a great guide on the Internet which shows how its done. Check out Matt Watson’s great HOWTO and follow the simple steps. Its as easy as [...]

  2. Greetings, fellow Asterisk/Linux/alarm hacker! Google brought me to your site when I was looking for a way to get my alarm system answered by my home Asterisk server. Your HOWTO was very helpful!

    I saw your Zenoss post, too. I recently worked as a CSE for Zenoss, and as Z’s resident Asterisk guru I was once going to build a Zenpack to monitor Asterisk. I wound up leaving Z for another gig but think an Asterisk Zenpack would be very cool. I’ll have to check it out!

    If you ever get to North Carolina, look me up. If you Canadians drink beer, that is. :)

    Cheers!
    Mark
    http://www.markturner.net

  3. HI, was very interested in ure ademco reciever article
    . I was wondering if you could help me tho. Im trying to get the string outputed on the serial , just like a real 685 would do with heart beats and the full acks. i have a real 685 here on my bench . i also run full automation software for monitoring.

    i work for an alarm install company, so i can test most formats , CID SIAII and fast format 4-8-1,

    cheers

  4. Mark,

    Thats interesting to hear! I really need to get back ontop of the Asterisk ZenPack, its been a little while since I have looked at it.

    I;m still using the version from when I orignally wrote this article, and its certainly far from feature complete.

    And yes, us Canadians drink beer, we make the good stuff too ;)

  5. fast format -

    I have a feeling that you know a lot more about the alarms than me.

    I’m really quite amateur when it comes to alarms. I really just got into it a little bit because I happened to purchase a house that had a system already in it, so it seemed like it would be something to mess around with.

Leave a Reply