Asterisk Door Control

He Guys,I just want to share what I’ve been using for years, and I think it may be helpful to others.
I can trigger a relay just by ringing a FXS port. The relay is Labco TM-15 or TM-60 it doesn’t matter it is a timer relay that I connect to the Tip and Ring in a way that you can see on the photo.
So in my files I have:
in globals_custom.conf
DYNAMIC_FEATURES=open
in features_applicationmap_custom.conf
open=9,callee,macro,opendoor
(9 is the digit that the DTMF listens before dialing the relay it can be any digit)
in extensions_custom.conf
[macro-opendoor]
exten=>s,1,Playback(beep)
exten=>s,2,NoOp(opening the main door)
exten=>s,3,System(/etc/asterisk/open.sh)
exten=>s,4,Hangup()
And finally in my file open.sh
asterisk -rx “channel originate SIP/123456 Application Call”
123456 is my FXS extension number.
it works also by dialing it directly from the macro instead calling a shell script but i find it more flexible, because at some places I use multiple doors and intercoms.
the relay costs 10-15CAD in my case.
the FXS Gateway must be fine tuned sometimes on the ring voltage and frequency.
If you use Grandstream it doesn’t need any intervention.
In my case I use freepbx and thats why I have customs.conf files.


and by the way it is mandatory to connect the Tip and Ring correctlyit defers when you cut the cable one side Tip is green the other side Tip is red wire. the best is to measure the 48v from the FXS the positive should be in the middle(trigger pin).

2 Likes