I am developing an application that uses asterisk server to manage SIP calls.
I am using Asterisk.NET library for this.
I needed to connect the asterisk server through a proxy server AstManProxy. But, when I connect through the proxy, it gives me a TimeOut Exception.
Can Anybody tell me how can I connect through AstManProxy?
First test that you can connect to asterisk WITHOUT proxy.
After that check again you correctly configured proxy.
If all seams ok, use tcpdump or wireshark to see communication between your app and proxy.
This is the procedure I typically follow if astmanproxy is running on the same machine as Asterisk.
ENABLE AMI ON PORT 5039
vi /etc/asterisk/manager.conf
[general]
enabled = yes
port = 5039
bindaddr = 0.0.0.0
timestampevents = yes
[username]
secret = password
read = all
write = all
THEN ENSURE AMI IS RESPONDING
telnet localhost 5039
Action: Command
Command: core show channels<enter><enter>
Action: Logoff <enter><enter>
CONFIGURE ASTERISK MANAGER PROXY ON PORT 5038
vi /etc/asterisk/astmanproxy.conf
host = localhost, 5039, username, password, on, off
listenport = 5038
THEN TEST ON PROXY PORT 5038
telnet localhost 5038
Action: Command
Command: core show channels<enter><enter>
Action: Logoff <enter><enter>
THEN USE MONIT TO ENSURE ASTMANPROXY STAYS RUNNING
vi /etc/monit/monitrc
#Asterisk AMI Manager Proxy Monitoring Rule
check process astmanproxy with pidfile /var/run/astmanproxy.pid
start program = "/etc/init.d/astmanproxy start"
stop program = "/etc/init.d/astmanproxy stop"
if failed host 127.0.0.1 port 5038 then restart
if 5 restarts within 5 cycles then timeout
Related
I work on aspnet core web api project. I will publish this project to remote server. When Kestrel is running, default port is 5000 or anythink like this.
I want to change this port to 80 or 8080. Can I do that?
When I try to change from launchSettings, I get this error:
System.IO.IOException: 'Failed to bind to address http://localhost:80.'
Your problem may be because you already have another web server running on your system (e.g. IIS) that is already binding to port 80.
You can check with this powershell command:
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess
This command will show you what process is listening on port 80. If nothing is listening, it will return an error.
In my C# application, I have this code:
var factory = new ConnectionFactory
{
Port = 5671,
UserName = "userxxxx",
Password = "passwordxxx",
HostName = "amqps://xxxx.mq.us-east-1.amazonaws.com"
};
using var connection = factory.CreateConnection();
But during the CreateConnection I receive:
RabbitMQ.Client.Exceptions.BrokerUnreachableException
HResult=0x80131620
Message=None of the specified endpoints were reachable
Source=RabbitMQ.Client
The AWS Console shows me:
Endpoint: amqps://xxxx.mq.us-east-1.amazonaws.com:5671
What am I doing wrong?
Use a tool like "netcat" to verify you can connect to port 5671 on the AWS MQ. Netcat should be used from the same host you are trying to connect from. Alternatively, consider using a cloud-based portscanner like https://www.whatismyip.com/port-scanner/ to take your local network out of the equation.
Successful example with netcat:
$ nc -vz myownawsmq.mq.us-east-1.amazonaws.com 5671
Connection to myownawsmq.mq.us-east-1.amazonaws.com 5671 port [tcp/amqps] succeeded!
If you get an error or timeout, then your URL is incorrect or port 5671 is blocked.
When I created my AWS RabbitMQ instance, port 5671 was open to the internet because publicly accessible is the default. You cannot use a security group with RabbitMQ instance that is publicly accessible. If you set Private Access for the RabbitMQ instance, you won't be able to reach it externally.
It's also possible 5671 is blocked by local firewall rules. Check the firewall configuration in your local network to make sure 5671 is allowed. If a cloud-based port scanner can connect to the port, but a local scan can't, it's probably your local network configuration.
I ran a tutorial including HTTP server app for raspberry pi 3.
Link here: https://incredibits.io/project/windows-10-iot-internet-of-things-tips/windows-10-iot-raspberry-pi-web-server
In my local network everything works perfectly. I run server, type in browser local IP of my raspberry (192.168.x.x) and "hello world" appears - great. But, I have an issue when i want reach my HTTP server outside from my LAN.
What i did:
1. forwarded port 80 in my router
2. opened port 80 in raspberry pi with below commands in PowerShell
netsh advfirewall firewall add rule name="Open 80" dir=in action=allow protocol=TCP localport=80
netsh advfirewall firewall add rule name="Open 80" dir=out action=allow protocol=TCP localport=80
checked if above commands works by typing
netsh advfirewall firewall show rule name="Open 80"
and i get that response:
Rule Name: Open 80
----------------------------------------------------------------------
Enabled: Yes
Direction: Out
Profiles: Domain,Private,Public
Grouping:
LocalIP: Any
RemoteIP: Any
Protocol: TCP
LocalPort: 80
RemotePort: Any
Edge traversal: No
Action: Allow
Rule Name: Open 80
----------------------------------------------------------------------
Enabled: Yes
Direction: In
Profiles: Domain,Private,Public
Grouping:
LocalIP: Any
RemoteIP: Any
Protocol: TCP
LocalPort: 80
RemotePort: Any
Edge traversal: No
Action: Allow
Ok.
checked if my port is visible as open with http://www.yougetsignal.com/tools/open-ports/ - it was CLOSED (ofcourse with server app run
ran exactly the same app in my notebook (with windows 10 ofcourse). I forwarded port 80 in router into my netbook, i checked if port is open - and it was OPEN. I type my external IP into browser and it works. I even try to do it from my smartphone to be sure and it also works.
I think that is a proof that a problem is in my raspberry - its settings
Make sure you have the "Internet (Client & Server)" capability selected in your app manifest. You can find this setting by opening the Package.appxmanifest file and clicking the Capabilities tab.
I solved it.
The problem was in my router setup. I have two NAT options (Virtual Server Setup and Port Triggering Setup) and i had settings like below:
Removing "web" setting in NAT - Port Triggering Setup solved my problem. My HTTP server running on raspberry pi became visible for outside world.
I don't know why this settings didnt block HTTP server running on laptop but this is different story. Problem with raspberry pi server - solved.
I want to ask for your help on how can connect to my Cassandra DB on my droplet from remote machine. I did everything that is written in this article: Install Cassandra but when I try to connect from my C# code:
cluster = Cassandra.Cluster.Builder()
.WithCredentials("abc", "abc")
.AddContactPoints(new[] { "12.34.56.78" })
.WithPort(9168)
.Build();
var session = cluster.Connect();
var keyspace = "Test";
session.CreateKeyspaceIfNotExists(keyspace);
session.ChangeKeyspace(keyspace);
I'm getting an Exception:
'Cassandra.NoHostAvailableException' in Cassandra.dll
Additional information: None of the hosts tried for query are available
(tried: 12.34.56.78:9168)
I also tried from other Cassandra GUI Clients like DBeaver but I'm getting the same error.
My Droplet is Ubuntu 14.04. From localhost I have no problem with Cassandra my only problem is from remote.
Here is result from
sudo netstat -plunt
Why could this be and how do I fix this?
You have to use port 9042.
listen_interface is used to setup inter-node communication.
The IP address or hostname that Cassandra binds to for connecting to other Cassandra nodes. Set this parameter or listen_interface, not both.
You have to change rpc_address and then restart cassandra daemon
(Default: localhost) The listen address for client connections (Thrift RPC service and native transport). Valid values are:
make sure you can run cqlsh locally, i.e. from the host where Cassandra is running. If you can not, check if Cassandra is running (check logs) and listens on the interface you are connecting to.
if you can connect locally, check you settings for rpc_address and rpc_broadcast_address for Cassandra. It should be set to other value than 'localhost' (which is set by default).
9042 port is for CQL by default, I suggest you not to reset it.
Good Evening,
I have created a Wireless Hosted Network on my Windows 8 Laptop, via the following 2 batch commands:
"netsh wlan set hostednetwork mode=allow ssid=testing key=12345678"
and
"netsh wlan start hostednetwork"
Afterwards, a device (Android-based mobile phone) is able to connect successfully to this Wireless Hosted Network hosted on my laptop. I've also created a HttpListener on port 1234 in C#, which the device can successfully access by using the built in web browser to access:
http://192.168.138.1:1234
However, how would the host (I.E. my laptop) intercept and redirect webpage requests? That is, how would a .NET program running on my laptop be notified when a device tries to access any webpage, say, google.com or facebook.com, and then redirect the device to another webpage by sending this webpage to it instead?
I have tried the following:
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://+:80/");
listener.Start();
Console.WriteLine("Started");
while (true)
{
var c = listener.GetContext();
Console.WriteLine("Connection");
string response = "<HTML><BODY>My web page.<br></BODY></HTML>"; //Redirects device to this
byte[] b = Encoding.UTF8.GetBytes(response);
c.Response.ContentLength64 = b.Length;
c.Response.OutputStream.Write(b, 0, b.Length);
c.Response.OutputStream.Close();
}
However, the program running on my laptop does not pick up anything at all when I use the device to access any webpage (E.G. google.com). Sorry if I have asked a repeated question, I couldn't find it anywhere!
You will need to set up your own DNS server for this to work. The problem is that your laptop makes a DNS query for google.com and receives an IP which points to Google's servers and not yours.
Or, if there is only a few sites you want to redirect - add entries for them in your hosts file.