Asterisk Unable to connect to remote asterisk **Solved**

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Asterisk Unable to connect to remote asterisk **Solved**

Postby ambiorixg12 » Sat Oct 06, 2012 10:17 pm

Hi, i triying to develop a Click to call in php. this is the initial code

<?php


$cmd=<<<'EOT'
/usr/sbin/asterisk -rx "originate SIP/101 extension 100@extensiones"
EOT;


system($cmd);

?>

But i got this error message : Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

when i execute in the command /usr/sbin/asterisk -rx "originate SIP/101 extension 100@extensiones in the linux console work fine.
Last edited by ambiorixg12 on Wed Nov 07, 2012 9:18 pm, edited 1 time in total.
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Asterisk Unable to connect to remote asterisk (does /var/run

Postby ambiorixg12 » Sat Oct 06, 2012 11:27 pm

Looking on the Web, i found that is more than the simple code above, i need to edit the manager.conf and write my code more complex, a long task to perform
Last edited by ambiorixg12 on Sat Oct 06, 2012 11:59 pm, edited 1 time in total.
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Asterisk Unable to connect to remote asterisk (does /var/run

Postby itp-caesar » Sat Oct 06, 2012 11:48 pm

If i had to guess, it is because the user that is running apache, which runs your php script, has no access to the asterisk console. Is asterisk running under root?
Caesar Engroba
Innovative Tech Pros
www.itpscorp.com
itp-caesar
Newsterisk
 
Posts: 2
Joined: Sat Oct 06, 2012 11:23 pm

Re: Asterisk Unable to connect to remote asterisk (does /var/run

Postby ambiorixg12 » Tue Oct 09, 2012 8:17 pm

yes im running asterisk under the root account, how ever i already configured the manafer.conf and now i was able to perform the call through the web

First log in on the remote asterisk server

http://192.168.15.200:8088/rawman?actio ... ecret=1230

second make the phone call

http://192.168.15.200:8088/rawman?actio ... =originate SIP/100 extension 101@extensiones


but i will continue triying to make php script for full control of asterisk
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Asterisk Unable to connect to remote asterisk **Solved**

Postby ambiorixg12 » Wed Nov 07, 2012 9:19 pm

Just change the Asterisk Permision in the asterisk.conf

[files]
;astctlpermissions = 0660
astctlpermissions = 7777
astctlowner = root
astctlgroup = apache
astctl = asterisk.ctl
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Asterisk Unable to connect to remote asterisk **Solved**

Postby ajayteck » Thu Nov 08, 2012 1:25 am

try with
sudo /usr/sbin/asterisk -rx "originate SIP/101 extension 100@extensiones"
good luck :D
if above doesn't work..
why don't you try with AMI...
ajayteck
Newsterisk
 
Posts: 28
Joined: Mon Sep 17, 2012 1:01 am

Re: Asterisk Unable to connect to remote asterisk **Solved**

Postby david55 » Thu Nov 08, 2012 3:52 am

ambiorixg12 wrote:astctlpermissions = 7777


Never follow advice like this unless you are operating "system high" (i.e. everyone with potential access to the whole system is fundamentally trustworthy) or you thoroughly understand the security implications.

In particular, the above attempts to give:

execute to everyone.
set user
set group
sticky status

I'm not sure that execute is meaningful on a pipe, but the fact remains that simply opening up permissions is not something htat should be done lightly.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Asterisk Unable to connect to remote asterisk **Solved**

Postby ambiorixg12 » Thu Nov 08, 2012 6:47 am

ajayteck wrote:try with
sudo /usr/sbin/asterisk -rx "originate SIP/101 extension 100@extensiones"
good luck :D
if above doesn't work..
why don't you try with AMI...


I already did it AMI, too and is working smooth,
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Asterisk Unable to connect to remote asterisk **Solved**

Postby ambiorixg12 » Thu Nov 08, 2012 6:50 am

david55 wrote:
ambiorixg12 wrote:astctlpermissions = 7777


Never follow advice like this unless you are operating "system high" (i.e. everyone with potential access to the whole system is fundamentally trustworthy) or you thoroughly understand the security implications.

In particular, the above attempts to give:

execute to everyone.
set user
set group
sticky status

I'm not sure that execute is meaningful on a pipe, but the fact remains that simply opening up permissions is not something htat should be done lightly.



Thanks david, I know that the persmission are not set properly but im working with a test server, not a production server, will change the permission later any sugestion or advise will be aprecitated
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic


Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 1 guest