Im totaly new to FreePBX and since im trying to solve my problem i have allready read a few post about that but non of them really helped me out and that is why I decided to write a new post. Please if this has been answered somewhere else already, feel free to delete the post an please link me to the solution.
So my goal is to open my doors with two RaspberryPi’s, where one acts as a internal unit where the FreePBX is installed (acts as Host and Client at the same time) and the other one as outdoor unit where Linphone client is installed and registered to the internal Host. The whole Process of registration and calling is finished, meaning Im able to press the button on the outside unit and make a call to the indoor unit.
My problem begins here.
What would be the best solution to open the door. I have a Python Script on the outdoor unit that opens the door so I was thinking to use the System() application function with ssh command on the indoor unit during the call with the DTMF option. But I have no idea where to start how to configure that. There are also Feature Codes and Dynamic Features but I have no clue how does all these work.
Can anyone help please? Your help would be appreciated.
The best way would be to open the door after entering a sequence of numbers. I guess the most complex part would be done on the door phone side. From the point of view of the Asterisk side, you are just sending digits during the call. On the door phone you would need to be waiting for digits and when the right sequence is entered, the opener should be triggered.
In fact there is an example on the FreePBX wiki. Have you taken a look there?
IoT…very interesting. I newer tough about it…but certainly Ill give it a try, perhaps a hint on how do I make Asterisk publish to topic? And then again wouldn’t it be easier and faster if I could just make custom dial plan and use the system() function to send a ssh command to the other RPi? I just don’t know how to accomplish that…
How do I accomplish the TrySystem(…) thing? I mean how does it work? can I start it with DTMF or do i need an extension for it or macro or anything, do I use some custom feature code and when how do I do all that? the point is I want to make it happen during the call, so if I talk to someone and afterwards want to open the door I want to press a number on a keypad and start an action of door opener, I mean I could eventually forward a phone call to an extension that’s has that TrySystem(ssh command) option build in but then again no clue where to start in this direction…
You could of course use ssh instead but that is a very round-about way of going from a human pressing a dtmf button to powering a door latch somewhere else on the internet (use ssl if you go that route, mqtt is really quite secure if done properly) , . Use an open access mqtt broker and you can let the cleaning lady in while your at the pub. And it cost you 2x$5 for the pi zeros and another 5 for the relay, add in a few hours of R&D and you “learned to fish a bit”.
Then learn how to do it with thge AGI library straight to mqtt and there is no messing with the dialplan
or ssh or bash or routing or . . . needed as you can intercept the DTMF in there as needed.
that link helped me: https://wiki.asterisk.org/wiki/display/AST/Custom+Dynamic+Features but frankly I have already saw that one before but was to scared to alter the feature.conf and extension.conf and extension.conf files because of early media in the past, and a lot, lot, lot of other stuff…and because of the warning on the top “DO NOT ALTER”…and so on…
The fun Part:
config as above with these two new things that came along:
in the features.con file under applicationmap:
open => *3,callee,TrySystem(/usr/bin/mosquitto_pub -h “test.mosquitto.org” -t “opendoor” -m “opensesame”)
the callee option is not working, meaning both can open door with *3, but Ill check that later…
in the extension.conf file added at the end of the file:
So next Goal is to create mqtt-python-gpio connectionfor door to open , and after that forward my calls from Asterisk to the internet, so meaning I can answer to the door even from outside…and the rest of the would be the same, only the mqtt broker would be in that case on the inside…so I cut down some security issues.
So my next question is how I do it? What is the best practice when it comes to that? I know i can get a free sip account make a trunk and then Im publicly available but if I want to make it free off charge for me I would need a second sip account and register that one on my phone and then these two speak free of charge…but if I want the third one…and so on…so what would be alternatives to that?
you’ve altered FreePBX module files, which will probably trigger dashboard warnings of altered files, but more importantly will be overwritten when you update the core module. The only supported way to adding features is what you were doing first, as described in this post: