# Asterisk Project : Troubleshooting

Added by malcolmd , edited by lmadsen on May 17, 2011

If you're able to get the command-line examples above working, feel free to skip this section. Otherwise, let's look at troubleshooting connections to the Asterisk CLI.

The most common problem that people encounter when learning the Asterisk command-line interface is that sometimes they're not able to connect to the Asterisk service running in the background. For example, let's say that Fred starts the Asterisk service, but then isn't able to connect to it with the CLI:

    [root@server ~]# service asterisk start
    Starting asterisk:                                         [  OK  ]
    [root@server ~]# asterisk -r
    Asterisk version, Copyright (C) 1999 - 2010 Digium, Inc. and others.
    Created by Mark Spencer <markster@digium.com>
    =========================================================================
    Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

What does this mean? It most likely means that Asterisk did not remain running between the time that the service was started and the time Fred tried to connect to the CLI (even if it was only a matter of a few seconds.) This could be caused by a variety of things, but the most common is a broken configuration file.

To diagnose Asterisk start-up problems, we'll start Asterisk in a special mode, known as console mode. In this mode, Asterisk does not run as a background service or daemon, but instead runs directly in the console. To start Asterisk in console mode, pass the -c parameter to the asterisk application. In this case, we also want to turn up the verbosity, so we can see any error messages that might indicate why Asterisk is unable to start.

    [root@server ~]# asterisk -vvvc
    Asterisk version, Copyright (C) 1999 - 2010 Digium, Inc. and others.
    Created by Mark Spencer <markster@digium.com>
    Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
    This is free software, with components licensed under the GNU General Public
    License version 2 and other licenses; you are welcome to redistribute it under
    certain conditions. Type 'core show license' for details.
    =========================================================================
      == Parsing '/etc/asterisk/asterisk.conf':   == Found
      == Parsing '/etc/asterisk/extconfig.conf':   == Found
      == Parsing '/etc/asterisk/logger.conf':   == Found
      == Parsing '/etc/asterisk/asterisk.conf':   == Found
      Asterisk Dynamic Loader Starting:
      == Parsing '/etc/asterisk/modules.conf':   == Found
    ...

Carefully look for any errors or warnings that are printed to the CLI, and you should have enough information to solve whatever problem is keeping Asterisk from starting up.

Running Asterisk in Console Mode

Icon

We don't recommend you use Asterisk in console mode on a production system, but simply use it for debugging, especially when debugging start-up problems. On production systems, run Asterisk as a background service.