There are two common reasons why this occurs:
- Asterisk is not running.
- You are trying to run
asterisk -r
as a non-root user.
If Asterisk isn't running, try to start it: asterisk -vvvc
.
If you are logged in as a non-root user, then log in as the root user, or just: sudo asterisk -r
.