 |
American Communications Cooperative Dedicated to advancements in communications worldwide
|
| View previous topic :: View next topic |
| Author |
Message |
agidi
Joined: 07 May 2007 Posts: 10
|
Posted: Mon Jul 07, 2008 10:21 am Post subject: Execute CLI and shell commands via Dialplan |
|
|
You can dial this to execute the command as if typed.
Careful, this is a "toolbox" but can reboot, or drop calls if used without care.
Thanks to n3glv for the tips.
This should go into :extensions_custom.conf (dont forget to CLI reload)
exten => *6055,1,System(asterisk -rx \"meetme kick 888 all\")
exten => *6055,n,Playback(vm-goodbye)
exten => *6055,n,Hangup
exten => *6054,1,System(asterisk -rx \"restart now\")
exten => *6054,n,Playback(vm-goodbye)
exten => *6054,n,Hangup
exten => *6053,1,System(asterisk -rx \"restart when convenient\")
exten => *6053,n,Playback(vm-goodbye)
exten => *6053,n,Hangup
exten => *6052,1,System(asterisk -rx \"reload\")
exten => *6052,n,Playback(vm-goodbye)
exten => *6053,n,Hangup
exten => *6051,1,System(asterisk -rx \"iax2 reload\")
exten => *6051,n,Playback(vm-goodbye)
exten => *6051,n,Hangup
exten => *6050,1,System(asterisk -rx \"zap restart\")
exten => *6050,n,Playback(vm-goodbye)
exten => *6050,n,Hangup
; Warning this will reboot the system
exten => *6059,1,System(shutdown now -r)
exten => *6059,n,Playback(vm-goodbye)
exten => *6059,n,Hangup
exten => *6047,1,System(asterisk -rx \"sip reload\")
exten => *6047,n,Playback(vm-goodbye)
exten => *6047,n,Hangup _________________ http://LujoyModa.com
http://GustavoMendoza.com |
|
| Back to top |
|
 |
ssaud
Joined: 28 Aug 2008 Posts: 2
|
Posted: Thu Aug 28, 2008 6:55 am Post subject: |
|
|
This is nice TIP but this could be dangerous. Imagine why someone will do that using his/her phone? for restarting Asterisk service will first need the Asterisk running. So if the admin intimated any problem with a particular module and admin runs the restart command, this way what if Asterisk doesn't get back?
And admin can't see what's wrong.
However reload can be sufficient remotely. _________________ Syed Networks VoIP telephony htt://www.syednetworks.com |
|
| Back to top |
|
 |
n3glv Co-Op-Founder
Joined: 16 Apr 2007 Posts: 32
|
Posted: Fri Sep 12, 2008 4:23 am Post subject: danger, yes |
|
|
I agree, it runs with whatever privs the * user has. (on some systems
that's ROOT)
So, caveat emptor. Use with caution and it would be a good idea to restrict what users can dial it, or otherwise password it eh? |
|
| Back to top |
|
 |
n3glv Co-Op-Founder
Joined: 16 Apr 2007 Posts: 32
|
Posted: Thu Aug 13, 2009 6:33 am Post subject: Home Automation, (or how to controll/flash a desk lamp w/*) |
|
|
Thanks agidi for the write up so long ago that this is based on.
I have wanted for years to have home devices controlled via the pbx.
With this in mind I had collected an x-10 'firecracker' rs-232 dongle.
And the radio reciever that has a single AC relay switch.
A bit of google reveals there is a package for many os's called "bottle rocket".
A quick download to the pbx of the gz and very simple install and I can now
do the following code, wich should be obvious in function.
The third 'extension' when placed in a ring group as *6049# will make
the unit cycle 5 times while ringing an extension list.
cat extensions_custom.conf
exten => *6047,1,System(/usr/local/bin/br --ON)
exten => *6047,n,Playback(on)
exten => *6047,n,Hangup
exten => *6048,1,System(/usr/local/bin/br --OFF)
exten => *6048,n,Playback(something-terribly-wrong)
exten => *6048,n,Hangup
;The ring group is ringing!
exten => *6049,1,System(/usr/local/bin/br --ON --OFF --repeat=5)
exten => *6049,n,Busy
It was required that I setuid on the br program to 4555 so it can be executed as root. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|