Unable to connect to remote Asterisk error

vcallaway

Guru
Joined
May 6, 2008
Messages
170
Reaction score
2
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

This is displayed when you issue an "amportal stop" command.

The system stops and starts properly, but does display an error. Has something changed on how amportal talks to asterisk?

Purple install btw.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,221
We think it's just a status message alerting you to the fact that FreePBX can no longer talk to Asterisk... since it's stopped. No big deal.
 

luckman212

Guru
Joined
Jul 7, 2010
Messages
272
Reaction score
0
I see this error too. Should I just turn and look the other way? I think this may have to do with the following lines being commented out of /etc/asterisk.conf?

; Changing the following lines may compromise your security.
;[files]
;astctlpermissions = 0660
;astctlowner = root
;astctlgroup = apache
;astctl = asterisk.ctl

If I uncomment that section, what are the security risks? I don't know what the asterisk.ctl file does really...
 

dswartz

Guru
Joined
Feb 17, 2009
Messages
1,056
Reaction score
0
here in the freepbx_engine:

stop_asterisk() {
echo
echo "STOPPING ASTERISK"
pid_length=`$PIDOF asterisk|awk '{print length($0)}'`
if [ "$pid_length" != "0" -a "$pid_length" != "" ]
then
/usr/sbin/asterisk -rx "core stop gracefully" | grep -v\
"No such command"
/usr/sbin/asterisk -rx "stop gracefully" | grep -v -E "\
No such command|deprecated"
echo "Asterisk Stopped"
fi
}

due to syntax changes in recent asterisk CLI, it can't be sure which command to use to shutdown asterisk. if the first works, the second won't. kinda ugly but harmless... p.s. i guess the second one could grep -v for the failure to connect, but no big deal.
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

It's a run file, you will see it anyway in /var/run/asterisk.

I would suggest leaving those settings alone, and ignoring the earlier error.

However, I think this error is an "unwanted feature" of the amportal stop start process, I did look at it some time ago, and it seems to try and stop asterisk twice, hence the error on the second stop command.

Joe
 

luckman212

Guru
Joined
Jul 7, 2010
Messages
272
Reaction score
0
For anyone who cares, I searched and found 3 copies of 'freepbx_engine' on my system:
/usr/src/freepbx/amp_conf/bin/freepbx_engine
/var/lib/asterisk/bin/freepbx_engine
/var/www/html/admin/modules/framework/bin/freepbx_engine

the one that you need to edit is highlighted up there in blue (in /var/lib/....)

I commented out the following line (again in blue)
/usr/sbin/asterisk -rx "core stop gracefully" | grep -v "No such command"
# /usr/sbin/asterisk -rx "stop gracefully" | grep -v -E "No such command|deprecated"
echo "Asterisk Stopped"


and it fixed the problem for me.
thanks dswartz & jroper for the guidance! :smile5:
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,221
And Here's the One-Liner Fix...

sed -i 's|/usr/sbin/asterisk -rx "stop gracefully"|# /usr/sbin/asterisk -rx "stop gracefully"|' /var/lib/asterisk/bin/freepbx_engine
 

Members online

Forum statistics

Threads
25,812
Messages
167,761
Members
19,240
Latest member
nikko
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top