I'm a veteran of Asterisk 1.4 and am looking to build a new application on Asterisk 11 (which is currently beta, but is planned to be LTS release some time before I need it.)
I can't get Asterisk Manager Interface on 11 to send me any events. (Now, obviously, in production, I need to cut down these AMI rights drastically, but as I'm exploring I've opened the firehose, if you will.)
manager.conf looks like this:
[general]
enabled = yes
port = 5038
bindaddr = 127.0.0.1
[manager]
secret = squirrel
deny = 0.0.0.0/0.0.0.0
permit = 127.0.0.1/255.0.0.0
read = all
write = all
I then use telnet to try to get in and explore the event stream:
$ telnet localhost 5038
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.3
Action: Login
Username: manager
Secret: squirrel
Events: on
Response: Success
Message: Authentication accepted
Event: FullyBooted
Privilege: system,all
Status: Fully Booted
...and there it sits, not moving, no matter what I actually do with the system. I've also tried using the Event manager action with EventMask: on to try to get something out of it; the command is accepted, but nothing changes. It will happily respond to any other actions I send it, though.
Any leads? This sort of thing worked fine under 1.4, and I'm not finding anything in any documentation suggesting I'm doing something wrong. I suppose the next thing to try is 1.8...
(There is little else in /etc/asterisk; I'm using example configs only for reference. This is as minimal as we get...)
It's may be bug in Asteriks / FreePBX. I had same situation, and my API php script didn't receive any events from AMI.
For fix this bug, you must install "Conferences" module and restart Asterisk from SSH: service asterisk restart
I just tested this with the latest 11 from subversion using your configs. I see events being generated. For example, executing this from the CLI:
*CLI> channel originate Local/Foo application Bar
While invalid, will cause some events to be spit out to the manager interface.
Related
I have a setup where I use Flask-MQTT to connect my python Flask API to a Mosquitto broker. Whenever I run the Flask API with the development server all is well. But whenever I spin it up for production (using wsgi+nginx), the connection with Mosquitto is made, but everytime i try to publish something i get the following error:
Socket error on client <unknown>, disconnecting.
My app.ini has the processes configured to 1 (processes = 1)
My mosquitto.config has the allow_anonymous flag set to trye (allow_anonymous true)
I can't really seem to figure out what I'm doing wrong here...
Update:
So what i think is happening is that the Flask-uwsgi application is trying to connect to mosquitto more than once. There is a master process that connects with Mosquitto on initialize. Then there is a second process that is being used whenever input is given on the Flask app. I'm not sure, but I think Mosquitto only wants one connection at the time, therefor erroring on the second. So now i either need to:
A) Configure Mosquitto in a way that it accepts multiple connection from the same device
B) Configure Flask in a way that wil only use one single process (configuring processes = 1 is not enough, it will still spawn two processes)
99% of the time, a "Socket error on client <unknown>" is an authentication error. I don't know Flask, so I don't know where to point you at, but something in your code is either trying to pass a username/password that is not defined to Mosquitto, or its trying a TLS connection with an cert that Mosquitto doesn't like.
Alright, it turns I could've read that the whole multiple processes wouldn't work from the start at the official Flask-MQTT documentation. It sais right there in think letters:
Flask-MQTT is currently not suitable for the use with multiple worker
instances.
So I looked at my uwsgi app.ini file again closely and actually the answer is quite simple. I turned out i had a like in there master = true.. after I removed that it works like a charm.
I have faced this issue many times, when I call on my sip line the server responds that the line is busy, though no call is going on when I see with asterisk -vvvr command. When I reload it, it starts working.
Is there a way to troubleshoot this problem or at least get a trigger form some command that sip needs to be reloaded.
Thanks in Advance
Asterisk work for years without reload.
Try update it to latest system or find bug in your config(like no dns, nat settings changed, bad router etc).
Asterisk have no any triggers for such case. You can use external monitoring system(like nagios) which will check sip channel and reload if needed. But better find issue and fix it.
Watch the CLI with a high debug/verbosity to see what's going wrong.
Set verbosity to a high value:
core set verbose 10
Set Debug to a high value:
core set debug 10
You can also check the status of the SIP endpoint with:
sip show peer <extension> (Replace with the number you'd use to dial the endpoint).
If you add verbose CLI output and the output of sip show peer to your question we'll be able to tell you how to fix the issue. Use pastebin or a similar site if the output is very long.
I frequently travel by buses, most of which have some sort of WiFi onboard. The usual way to connect to them with an automagical connection manager like Wicd is to select the network and then, upon launching the browser some additional authentication takes place and I'm done. But OpenBSD has no such manager, so I came to use and like the standard ifconfig method. In the standard case, where I have e.g. WEP2 encryption and password authentication, the way to go about it is to first run:
ifconfig iwn0 nwid <network_id> wpakey <password>
and after that:
dhclient iwn0
The question is how to connect in the bus case, where there's no password? So far I tried several things like not specifying the password at all or giving an empty password (rejected immediately), but all of them resulted in output like this:
iwn0: no link ............. sleeping
upon running dhclient.
I dug deeper into the man pages (ifconfig(8)) and found out the following way. I first issue:
ifconfig iwn0 nwid <network_id> -wpa
according to the following excerpt form the manpage:
-wpa Disable Wi-Fi Protected Access.
I then issue:
dhclient iwn0
And after loading any website (and going through the authentication) I have the connection established.
I currently have a Java Applet running on my web page that communicates to a display pole via COM1. However since the Java update I can no longer run self-signed Java Applets and I figure it would just be easier to send an AJAX request back to the server and have the server send a response to a TCP port on the computer...the computer would need a TCP > COM virtual adapter. How do I install a virtual adapter to go from a TCP port to COM1?
I've looked into com0com and that is just confusing as hell to me, and I don't see how to connect any ports to COM1. I've tried tcp2com but it doesn't seem to install the service in Windows 7 x64. I've tried com2tcp and the interface seems like it WOULD work (I haven't tested), but I don't want an app running on the desktop...it needs to be a service that runs in the background.
So to summarize how it would work:
Web page on comp1 sends AJAX request to server
Server sends text response to comp1 on port 999
comp1 has virtual COM port listening on port 999, sends data to COM1
pole displays data
EDIT: I'm using Win 7 x64 and tcp2com doesn't work as a service. I tried using srvany but I get an error stating that the application started then stopped. If I use powershell and pass the tcp2com as an argument, it doesn't quit but it also doesn't run. So I nixed the whole 'service' deal and put the command: powershell -windowstyle hidden "tcp2com --test tcp/999 com1" and it works...sort of. The characters that get sent are all effed. I can write "echo WTF > COM1" on another computer which has COM2TCP (different vendor) and it'll come up as a single block on the POS display pole. However if I use COM2TCP on both the server and client machines, everything works fine...but that's only a trial version and it costs several hundred dollars! On another note, is there a way to send the raw text over IP without having to use another Virtual COM > IP adapter on another computer? Sort of like how curl works but different...?
After somewhat of an exhaustive search, I came across a program called 'piracom'. It's a very simple app that lets you specify port settings for the express purpose of connecting a serial port to an listening port over the network. So this is IP > Serial. For Serial > IP I used HW-VSP3-Single as even on the piracom website it said it's compatible! I've tested and it works!
I just put a shortcut to piracom in the startup folder of my user account; the app runs off of a .ini that it updates every time you make a change...so if you run the server and hide it, on the next reboot of the pc it'll start up running and hidden with all prior settings. Easy.
Now it's a matter of installing HW-VSP3 on the server and making a method on the Rails app which will write to the virtual COM port. The only issue I can see right now is that writing echo \14Test This! > COM3 actually prints the \14...if I do that in my Java applet, it sends the "go to beginning" signal.
Addendum 1: The \14 problem was fixed by using the serialport gem for RoR. I created a method in a controller that returned head :no_content and then send data to the COM port. Calls to this method were made via jQuery's $.Ajax, using "HEAD" HTTP method. Apparently though I had to add the GET verb in Rails routes because the HEAD option isn't supported for some gimpy reason.
Addendum 2: Some garbage data was being sent to the display pole at the end of the string...turns out I needed to turn off the "NVT" option in HW-VSP3. Also keep in mind that firewalls need to be modified to allow communication.
I have CoreFTP configured for localhost and the next code:
JSch.setLogger(new MyJschLogger()); //class for console output
Session session = jsch.getSession("user", "localhost", 21);
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.setPassword("password");
session.connect();
when program achieves connect(), two messages appear at console output:
INFO: Connecting to localhost port 21
INFO: Connection established
...and nothing more happens. After some minutes, connection is closed by foreign host exception appears.
Why?
Thanks for all!
Port 21 is the normal port for FTP. JSch is only an SSH client, with support for SFTP in the ChannelSFTP class. JSch knows nothing about FTP (and SFTP is unrelated to FTP, other than by name and that it allows similar things).
You need to setup your server to use the SSH protocol (usually on port 22, but you can use any port, as long as you use the same port on the client). See the documentation - I think you have to check the SSH check box.
Also, if your code is nothing more than what you posted, then nothing more than connecting will happen. To transfer files, you will need to open a ChannelSFTP, and issue the right commands (e.g. call one or more of the put/get methods).
I also faced the similar issue:
"ERROR 2016-04-27 15:05:16,489 [CollectionThreadPool-0] com.dell.supportassist.collector.cli.executor.SSHExecutor: com.jcraft.jsch.JSchException: connection is closed by foreign host"
In my case, channel was getting closed randomly. And when we are trying to re-connect the channel then it was not re-connecting and failing.
This was happening due to looping logic while connecting, so I tried to connect the session without channel by calling method connectWithoutOpenChannel instead of connectinternal(). This resolved my issue.