Piping NC output to Logger for syslog
Hey guys.
Im working on a way to pipe the output of a telnet session in to the logger command.
Basically the system I'm working on (an IP PBX) has a call logging functionality. This works by presenting the data via a telnet connection. For example, I would telnet to the device, it doesnt echo anything on the console but it quietly prompts for a password (which is blank) so all u do is simply press enter and wait... Once a call hangup happens, the call detail pops up in the telnet console.
What we want to do is, rather than having to make a connection into the system like this, is to get the system to send the call logs out via syslog (as many other phone system do). To do this I thought about creating a script that runs locally on the PBX that keeps a telnet session open to 127.0.0.1 and then pipes the output to logger which then has the syslog send it out to our central syslogging box.
Using something like 'nc 127.0.0.1 port | logger -T CDR' seems to do what i want, except that it doesnt send the carriage return needed to authenticate the telnet session via the blank password as explained above. I've tried using like 'echo -e "\rn" | nc 127.0.0.1 port | logger -T CDR' which (i think works) but once i run the command it doesnt keep the netcat session open, it just runs and exits.
Does anyone have any ideas as to how I can make this work?
Things to bear in mind. The PBX is a linux based appliance, it uses busybox instead of the standard tools, so alot of the commands dont have all of their features, secondly its not straight forward to install additional tools onto the system.
Regards
Last edited by karmacop81; 11-21-2009 at 05:39 PM.
|