asterisk : Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?) [closed]

假装没事ソ 提交于 2019-11-30 02:56:31

It's probably because asterisk is not running on your server.

Try to run it with this command :

asterisk -vvvvvvc

You'll enter into the Asterisk CLI and if something goes wrong you'll see it. After that you can quit the CLI by entering the exit command. Then you can reconnect to the CLI by typing asterisk -r. All this commands assumed you're the root user. If you are not root prefix them by sudo, by example sudo asterisk -vvvvvvc.

Hope it helps, regards, Duc.

There are two common reasons why this occurs:

  1. Asterisk is not running.
  2. 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.

This command should work if the others did not solve the problem:

sudo asterisk -&

Tim Davies

If you have SELINUX enabled, it will prevent this file being created. You need to turn it off.

  1. vi /etc/selinux/config
  2. set SELINUX=disabled
  3. reboot
Basem Hegazy

actually it's an ownership problem

try to:

ls -l /var/run/asterisk/asterisk.ctl

you will see that the file has ownership of 'root'

although you have changed the ownership with:

chown -R asterisk /var/run/asterisk

once you restart the asterisk server the ownership gets back to the 'root' again

they should be for 'asterisk:asterisk' user and group

Basem Hegazy

You have to make a change in the asterisk.conf file located at /etc/asterisk

astrundir => /var/run/asterisk

Reboot your system and check

Hope this helps you

John Thicke

I had this problem today. It had nothing to do with any of the posted answers. I tried them all. My problem was a misconfiguration with the zaptel.conf (running old asterisk!). I had commented out some span details trying to troubleshoot a PRI issue. When the server got rebooted this issue presented itself. I was able to discover this by looking at the wanrouter messages in the logs. I noticed there were 3 errors, and the corresponding line numbers, once I corrected these issues, and ran an #asterisk -vvvvc the server came back up and everything worked.

First check if the file /var/run/asterisk/asterisk.ctl exists if it doesn't, then the asterisk server is not running. So start it like

/usr/sbin/asterisk -gvvc

and then asterisk -r to drop to the command line prompt worked for me.

kaptanSOM

This is common problem for asterisk and this works for me

sudo su
/etc/init.d/asterisk start 
asterisk -rvvv

If not working stop it

sudo su
/etc/init.d/asterisk stop

Start it again

sudo su
/etc/init.d/asterisk start 
asterisk -rvvv

That is all

It's showing asterisk server is not running.

You may type following commands at cli:

  • asterisk

  • asterisk -rvvvv

above commands worked for me!

first command starts asterisk

second command gets you to asterisk cli

In the source contrib directory are example scripts for init.d - it is simplest to run the server in background mode - the init scripts also contain a monitor to relaunch asterisk if it goes down.

Then you just need to use

sudo asterisk -vvvvvvvr 
  • to connect to the server that is already running in background mode.

Note you need to run this as root to gain privileges to connect.

If you installed via a distro - then the init.d scripts are usually supplied as standard.

There is another solution if above didn't help, add:

noload => res_pjsip.so to /etc/asterisk/modules.conf

Only you need to empty /tmp directory using command & hit reboot your system. now you are able to play on asterisk CLI whatever you want.

If other solutions doesn't work for you, just try (as root) this:

amportal restart

Hope it helps ;-)

TheSenior

It may not be running.

try runnign /etc/init.d/asterisk status

If its not running, Start it using:

/etc/init.d/asterisk start

Or in RH 7:

Systemctl start asterisk

Try to use sudo, to run asterisk -r that works for me every time this error comes up.

I solved this problem by using: chown -R etc/asterisk chown -R var/lib/asterisk

this is bacause, as said here, I wasn't running as administrator. So, I made my user as owner of the Asterisk directories.

Daniel Ramos

You must be root.

sudo su -
asterisk -r

I had a similar issue, which was a result of the hard drive being filled up. Turns out the issue was with the cdr table being corrupted and running repair in mysql remedied the issue.

I have just installed asterisk 13.18.5 on CentOS7. After logging in as root, I was having the same problem and I just did "SELINUX=disabled" in /var/selinux/config and that was all. My asterisk started in verbose mode by doing asterisk -rvvvvvv. No errors !!!

Another way to get it done is to use "asterisk -&" command first and then wait for a while for an "OK" message from asterisk and then "asterisk -rvvvvv"

just go to installation folder

cd /usr/src/asterisk
asterisk -r
reload
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!