"Unable to connect to remote asterisk"!

Hi all,

I’ve searched through posts about this error message but none have exactly the same symptoms as me. When I try launching “asterisk -rvvv”, I get the following message :

[ul]
== Parsing ‘/etc/asterisk/asterisk.conf’: == Found
== Parsing ‘/etc/asterisk/extconfig.conf’: == Found
== Binding sipusers to odbc/asterisk/sip_buddies
== Binding sippeers to odbc/asterisk/sip_buddies
== Binding voicemail to odbc/asterisk/ast_voicemail_users
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
[/ul]
The file indeed does not exist. Here’s one thing that works :

[ul]
root@ubuntu:~# mkdir /var/run/asterisk
root@ubuntu:~# chown asterisk:asterisk /var/run/asterisk
root@ubuntu:~# asterisk -&
[1] 1597
root@ubuntu:~# asterisk -rvvv
[/ul]
After that, I am successfully connected. However, if I restart the server, upon next boot the /var/run/asterisk directory no longer exists. I cannot tail the /var/log/asterisk/full file because it does not exist either.

Help!

(this is happening with Asterisk 1.6.2.5 on Ubuntu 2.6.31-14)

It appears that you are trying to run under the user asterisk. For this to work, the asterisk user will need to be able to write to certain directories, including /var/run/asterisk and /var/log/asterisk. Have you checked that this is the case?

Ian

The basic symptom indicates that Asterisk failed to start.

I would try starting it with -c, rather -r, and seeing what error messages you get.

Pmlco, that indeed seems to be the case. How do I determine which user asterisk runs as, and how can I change it? I don’t remember choosing during initial configuration.

Thanks for the idea David, here are the only to error messages I get:

[ul]Unable to open pid file ‘/var/run/asterisk/asterisk.pid’: No such file or directory
Unable to bind socket to /var/run/asterisk/asterisk.ctl: No such file or directory[/ul]
As I mentioned earlier, when I manually create the /var/run/asterisk directory it works (those two files are created), but the directory dissapears upon server reboot.

Does anyone know what “asterisk -&” does? It’s not explained when I type “asterisk -h”, but it helps somehow. Only after typing that line can I start asterisk with “asterisk -r”…

The & character forks a separate process running asterisk (the & is not unique to asterisk, it’s standard bash syntax) that you can then connect to with asterisk -r. How are you starting asterisk on reboot? Do you have a script in /etc/init.d? However, I think the cleanest solution would be to do a complete reinstall. If you want to run asterisk under the asterisk uid, then you should do the build and install as asterisk. During the install you will have to change some permissions so that asterisk can write to certain directories - for example on /usr/sbin/asterisk, you can

chgrp asterisk /usr/sbin chmod 775 /usr/sbin
then resume the install with “make install”.