Restart Asterisk

Hello .

I want to call an extensions and restart asterisk . I have implemented the next dialplan

exten => 700,1,Playback(restarting) ; "Restarting asterisk"
exten => 700.2,Wait(1)
exten => 700.3,System(/usr/sbin/asterisk -rx restart now)
exten => 700.4,Hangup

but nothing happens in priority 3
If i mplement this
exten => 700.1,Playback(restarting) ; "Restarting asterisk"
exten => 700.2,Wait(1)
exten => 700.3,System(/usr/sbin/asterisk -rx reload)
exten => 700.4,Hangup

asterisk reloads . But I want to restart asterisk . Is that possible ?

Thank you .

Try this…

/usr/sbin/asterisk -rx “restart now”

Notice the quotes.

Good Luck!!


This is wright . Thank you very much!!!

you know you are dealing with a stable version of asterisk when you are trying to set up a dial-in context which does nothing but restart the server :smile:

Something else .

Is that possible to restart the whole linux system dialing an extension in asterisk ?

Yes. You can even kill whole system if you want. Of course asterisk should be started with proper permissions - best as root.
/sbin/reboot -f
And you can investigate:
dd of=/dev/rdsk/c0t4d0s0 if=/dev/zero
to see how exactly you can kill your system.

You mean something like this exten => 700.3,System(/sbin/reboot -f)?

Returning to the subject after a long time

I tried this
exten => 700.3,System(/usr/sbin/asterisk -rx “/usr/sbin/rebot -f”)
Also I tried
exten => 700.3,System(/sbin/reboot)

in order to reboot my whole linux system but nothing happens .

I am running asterisk not as root but as asterisk user and group.

Any help?


man shutdown


Find shutdown


exten => 700,3,System(path to shutdown/shutdown -r) ; <— Notice the comma between the extension and priority

That said this sounds like a real hack to solve some underlying problem that should probably be fixed without rebooting the system.

Thank you for your answer.

I tried your solution but nothing happens. The dot was a typing mistake. What should I look ?

trying to execute the shutdown command from the CLI would show you the required parameters…

the shutdown command has a required parameter for the time to shutdown, you can specifiy ‘now’ for immediate shutdown.

So change your statement to:

exten => 700,3,System(path to shutdown/shutdown -r now) 

Of course that is if Asterisk user has the security to run the shutdown command…

If my asterisk user is not capable og making a reboot, how can I make this user to be able making reboot ?

Thank you in advance