Get help with installing, upgrading and running a PBX such as Asterisk.
User avatar
By WelshPaul
#1944
Edit /etc/asterisk/extensions_custom.conf and add:
Code: Select all
[macro-shutdown]
exten => s,1,Authenticate(1234)     
exten => s,1,NoOp(Looks like we're going to shutdown!)
exten => s,n,System(/usr/bin/sudo /sbin/shutdown -h now)

[macro-reboot]
exten => s,1,Authenticate(1234)     
exten => s,1,NoOp(Looks like we're going to reboot!)
exten => s,n,System(/usr/bin/sudo /sbin/shutdown -r now)
You can change the password (1234) to what ever you like (digits only).

Go to Custom Destinations and add the following Custom Destinations:
Code: Select all
Custom Destination: macro-shutdown,s,1
Description: SHUTDOWN

Custom Destination: macro-reboot,s,1
Description: REBOOT
Then go to Misc Applications and add the following Misc Applications:
Code: Select all
Description SHUTDOWN
Feature Code 3001
Feature Status Enabled

Destination
Custom Destinations Shutdown

Description REBOOT
Feature Code 3002
Feature Status Enabled

Destination
Custom Destinations REBOOT
Add asterisk to sudo group by typing:
Code: Select all
sudo adduser asterisk sudo
Finally edit /etc/sudoers and add:
Code: Select all
asterisk ALL=(ALL:ALL) ALL
%sudo ALL= NOPASSWD: /sbin/shutdown
Now reboot the system.

You can dial 3001 and enter password 1234 to shutdown the pbx or dial 3002 and password 1234 to reboot the system.
User avatar
By WelshPaul
#2341
Se7ev wrote:
WelshPaul wrote:You can change the password (1234) to what ever you like (digits only).
Does it has to be 4-digit password or can it have more digits?
It can be any length you require it to be. :)
#2351
WelshPaul wrote:
Se7ev wrote:
WelshPaul wrote:You can change the password (1234) to what ever you like (digits only).
Does it has to be 4-digit password or can it have more digits?
It can be any length you require it to be. :)
Thought so. Thanks. More digits - better security I guess :)
User avatar
By WelshPaul
#3123
Hi Will,

I take it you have Custom Context in use? If so you need to set 'app-miscapps' to 'allow' in your custom context.
By Will Manning
#3126
Hi Paul, yes I'm using a custom context. So where do I set app-miscapps to allow? From within FreePBX admin settings, or by editing extensions_custom.conf? I can't find any related settings within FreePBX - maybe I've missed it. Thanks.
User avatar
By WelshPaul
#3127
Login to your FREEPBX admin panel and go to Conectivity > Custom Context and select the context in use by the phone your trying to run the command on...

Scroll down and you should find 'app-miscapps' half way down the page. :)
By Will Manning
#3128
Hi Paul - sorry I don't have the Custom Context module. I have created a custom context manually via extensions_custom.conf. Do I need to upload the Custom Context module to FreePBX, or can I manually add the command via an editor to the relevant config file? Many thanks for your help!
User avatar
By WelshPaul
#3129
It's never a good idea to edit the core files unless you really need to (not with freepbx), it leads to issues like this. If there is a module or browser based configuration option then use it. In this case you're better off using the custom context module...

You can however get it working by editing the file and manually adding 'include => app-miscapps' to your custom context.
Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests

Supported Products: OBi504vs OBi508vs Firm…

Supported Products: OBi200 OBi202 OBi300 OB…

Enter your email address here: https://haveibeenpw…

Well, with VoiceHost you can! I needed to report …