Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to quit Asterisk CLI using exit or quit

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?

like image 400
Blesson Jose Avatar asked Dec 25 '22 04:12

Blesson Jose


2 Answers

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!

like image 155
marcelog Avatar answered Jan 05 '23 11:01

marcelog


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.

like image 39
JNevill Avatar answered Jan 05 '23 10:01

JNevill