I have installed Asterisk using AsteriskNow image in VirtualBox. I open the FreePBX configuration web page and the server status for every service is OK (green). I want to connect to Asterisk server using Asterisk.NET library:
manager = new ManagerConnection(ASTERISK_HOST, ASTERISK_PORT, ASTERISK_LOGINNAME, ASTERISK_LOGINPWD);
manager.Login();
Which username and password should I use?
I’ve tried “admin”/"admin"which I use for logging in at FreePBX web administration and with “admin”/“amp111”, none of which work. I have not modified anything after installing AsteriskNow in VirtualBox.
Does anyone has experience connecting from .NET to Asterisk server?
I dont see any username or password here. Only secret = “amp111”. Can you please tell me what this mean?
Should I manually add a new user with password in the manager.conf and use those credentials to connect from .NET?
It appears that not the authentication is the problem, but the connection to the Asterisk is not established. I am using the following code to connect to Asterisk:
Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse("192.168.0.35"), 5038);
clientSocket.Connect(serverEndPoint);
and I get the following error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.35:5038
Can someone tell me what am I doing wrong or what is the solution to this?
Where should I modify so that I can connect from Windows?
I my manager.conf file I have “bindaddr = 0.0.0.0” under [general] which should permit all addresses to connect to it right?
(I have AsteriskNow installed in VirtualBox using bridged connection and I want to connect to it from a .NET application that runs on the Windows host using that code sample).
Can you please help me out to figure this out?
Go through manager.conf and eliminate the options that couldn’t affect which machines could connect. There is only one in the fragment you quoted that is left that should be left. Incidentally it is wrong, even for what it is trying to do, although, depending on the implementation, that might not matter.
Is there anything wrong that prevents me from connecting from the Windows machine? I have tried all ports from 5030 to 5150 at 192.168.2.35 (the IP where I can configure from FreePBX on my Windows machine) and none work.
Can I publish (just for testing) the Asterisk server from the VirtualBox VM on a public IP? Maybe I can connect that way to Asterisk. Which steps should I take in order to have my Asterisk server open to public?
I have changed “all” to 0.0.0.0/0.0.0.0. This should permit connections form all addresses right? If not, how can I permit connections from all addresses?
Hi!
I’d have tried disabling iptables and selinux
Then try connecting to your asterisk server from your windows machine with telnet:
telnet asterisk_ip 5038
If success, then there is no network connected problems.
and no interaction to the Asterisk server was made.
From .NET, by running the above code, connecting to the same IP/Port, I get the same error:
Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse("192.168.0.35"), 5038);
clientSocket.Connect(serverEndPoint);
===>
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.35:5038
Presumably because that .NET framework call’s parameters don’t mean what you think they mean. There is nothing Asterisk specific in that line of code.
However the examples in the Visual Studio documentation suggest your original was correct, and IP makes no sense with stream. IP is a lower level protocol which is intrinsically datagram.
You should note that very few people use AMI from Windows.