Restart System From Extension

Home » Asterisk Users » Restart System From Extension
Asterisk Users 3 Comments

hi. i would like to be able to reboot the system from my extension. is that possible? if yes, how?

3 thoughts on - Restart System From Extension

  • System(‘sudo /sbin/reboot’)

    You need to allow that in a sudoers file, of course. This may or may not be a good idea.

    There are a host of other methods to permit unplivilidged users /
    processes to run do specific priviliged actions.

  • Could you give some more details please?

    Στις 6 Απρ 2017 8:25 μ.μ., ο χρήστης “Tzafrir Cohen” <> έγραψε:

  • It’s possible, with something this in extensions.conf;

    exten => 999999,1,NoOp(Restarting server now)
    exten => 999999,n,System(shutdown -r now)

    Then dial 999999.

    NB this is UNTESTED, for obvious reasons! You probably do not want this extension to be in a context that anyone besides you can access. And if you are not running Asterisk as root, then you will need to write a C wrapper around the shutdown binary and make it setuid root.

    But just because it is possible, does not mean it is not a really, really terrible idea. The real question is, WHY are you wanting to be able to reboot your server from your extension? Because there is almost certainly a better way of achieving whatever it is that you are hoping to achieve.