问题
I am learning asterisk.
After I installed asterisk, I tried to connect with it using
asterisk -rvvvvc.
But it gave me the following error message:
Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?)
How can I solve this issue?
回答1:
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.
回答2:
There are two common reasons why this occurs:
- Asterisk is not running.
- You are trying to run
asterisk -ras 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.
回答3:
This command should work if the others did not solve the problem:
sudo asterisk -&
回答4:
If you have SELINUX enabled, it will prevent this file being created. You need to turn it off.
vi /etc/selinux/configset SELINUX=disabled- reboot
回答5:
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
回答6:
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
回答7:
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.
回答8:
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.
回答9:
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
回答10:
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
回答11:
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.
回答12:
There is another solution if above didn't help, add:
noload => res_pjsip.so
to
/etc/asterisk/modules.conf
回答13:
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.
回答14:
You must be root.
sudo su -
asterisk -r
回答15:
If other solutions doesn't work for you, just try (as root) this:
amportal restart
Hope it helps ;-)
回答16:
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
回答17:
Try to use sudo, to run asterisk -r that works for me every time this error comes up.
回答18:
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.
回答19:
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.
回答20:
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"
回答21:
just go to installation folder
cd /usr/src/asterisk
asterisk -r
reload
来源:https://stackoverflow.com/questions/2800924/asterisk-unable-to-connect-to-remote-asterisk-does-var-run-asterisk-ctl-exis