I started Asterisk CLI with the below command:
asterisk -vvvvvvc
When I try to exit CLI using exit or quit, I see the errors below:
*CLI> exit
No such command 'exit' (type 'core show help exit' for other possible commands)
*CLI> quit
No such command 'quit' (type 'core show help quit' for other possible commands)
I am able to exit CLI using ^C
. Why is exit and quit not working?
As the error message states, there is no "exit" or "quit" command. But there is an entry in the Asterisk wiki discussing how to stop Asterisk from the CLI: https://wiki.asterisk.org/wiki/display/AST/Stopping+and+Restarting+Asterisk+From+The+CLI
The command you should be using is "core stop" (note, however, that this actually kills asterisk, not only the shell) and you have a few options available for it:
*CLI> help core stop
core stop gracefully -- Gracefully shut down Asterisk
core stop now -- Shut down Asterisk immediately
core stop when convenient -- Shut down Asterisk at empty call volume
In any case, by starting asterisk with the -c flag you are not starting it as a service, but in foreground, meaning that you have to leave your shell open if you want Asterisk to continue running.
You should be starting it without the -c flag and then use -r to connect to it: https://wiki.asterisk.org/wiki/display/AST/Connecting+to+the+Asterisk+CLI
Then you can just quit the "remote shell" by using ^C. Asterisk will keep running in background. I personally like to use daemontools to start and supervise services: http://cr.yp.to/daemontools/svc.html.
Hope it helps!
You should start the asterisk
daemon first. Then connect to the console.:
Starting the daemon is as simple as:
$>asterisk
Then you can connect to the console with all the verbosity:
$>asterisk -rvvvvvv
I don't believe there is any graceful exit using asterisk -c
as you have.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With