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

**URL:** <https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662>\
**Category:** Asterisk Support\
**Created:** [October 7, 2012, 4:17am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662 "2012-10-07T04:17:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [October 7, 2012, 4:17am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/1 "2012-10-07T04:17:34Z")

</div>

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

\<?php $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.

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [October 7, 2012, 5:27am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/2 "2012-10-07T05:27:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![itp-caesar](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@itp-caesar](https://community.asterisk.org/u/itp-caesar)\
**Post date:** [October 7, 2012, 5:48am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/3 "2012-10-07T05:48:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [October 10, 2012, 2:17am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/4 "2012-10-10T02:17:31Z")

</div>

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

[192.168.15.200:8088/rawman?actio … ecret=1230](http://192.168.15.200:8088/rawman?action=login&username=admin&secret=1230)

second make the phone call

[192.168.15.200:8088/rawman?actio … =originate](http://192.168.15.200:8088/rawman?action=command&command=originate) SIP/100 extension 101@extensiones

but i will continue triying to make php script for full control of asterisk

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [November 8, 2012, 3:19am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/5 "2012-11-08T03:19:40Z")

</div>

Just change the Asterisk Permision in the asterisk.conf

[files]  
;astctlpermissions = 0660  
astctlpermissions = 7777  
astctlowner = root  
astctlgroup = apache  
astctl = asterisk.ctl

---

<div class="post-metadata">

**Author:** ![ajayteck](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@ajayteck](https://community.asterisk.org/u/ajayteck)\
**Post date:** [November 8, 2012, 7:25am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/6 "2012-11-08T07:25:31Z")

</div>

try with  
[color=#40FFFF]sudo [/color]/usr/sbin/asterisk -rx "originate SIP/101 extension 100@extensiones"  
good luck 😃  
if above doesn’t work…  
why don’t you try with AMI…

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [November 8, 2012, 9:52am UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/7 "2012-11-08T09:52:02Z")

</div>

> [@ambiorixg12](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [November 8, 2012, 12:47pm UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/8 "2012-11-08T12:47:05Z")

</div>

[quote=“ajayteck”]try with  
[color=#40FFFF]sudo [/color]/usr/sbin/asterisk -rx "originate SIP/101 extension 100@extensiones"  
good luck 😃  
if above doesn’t work…  
why don’t you try with AMI…[/quote]

I already did it AMI, too and is working smooth,

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [November 8, 2012, 12:50pm UTC](https://community.asterisk.org/t/asterisk-unable-to-connect-to-remote-asterisk-solved/40662/9 "2012-11-08T12:50:13Z")

</div>

[quote=“david55”][quote=“ambiorixg12”]  
astctlpermissions = 7777  
[/quote]

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.[/quote]

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
