[LCP]Transforming a linux machine into a breakout box (Serial programming related question)
James Attard
james_attard at ieee.org
Wed Sep 3 18:04:01 UTC 2003
Ok I think the title explains much. However here's my story:
I have this PABX and a billing system machine (running on windows). The
billing system requests the pabx to send it Call data records. For the
unfamiliar, a Call Data Record (CDR) is simply a string line containing
the detail of a particular call such as:
Date of Call : Call Duration : Origin : Destination
I know that these two machines communicate with each other in the
following manner:
The billing machine sends a <DC1> ASCII character to the PABX. The PABX
will then send any CDRs stored in its buffer. To stop reading from the
PABX, the billing machine sends a <DC3> ASCII character. The billing
machine is scheduled (and I don't want to interfere with its scheduling),
to send these control characters at random intervals.
So that's the description of my setup.
Now let me describe my application. I want to put a linux computer (with
two serial ports) between the pabx and the billing system in such a way to
function as a breakout box - i.e. the linux machine will be simply
monitoring the traffic between the pabx and the billing system. However I
don't only want to monitor traffic, but do some processing such as
scanning for particular CDR's which contain a specific [Call Destination]
field, and remove this CDR from the 'queue'. All other CDRs have to pass
to the billing system in a transparent way (i.e. as if the pabx was
directly connected to the billing system).
I have succeeded in sending fake control characters <DC1> to the pabx to
read the contents of the PABX, so that later I can process them and then
send them to the billing system.
But i have a couple of problems:
(1) How can i read/process the CDRs in 'real time' ??
(2) How can i make the linux machine as a breakout box so that control
signals sent from the machine are directed to the pabx immediately and act
accordingly?
I'm a little bit confused as i'm still new to the world of serial
programming. I would appreciate if you post sample codes. PS: I actually
know how to read and write to serial ports. My last personal project was
in fact driving a modem by sending AT commands and reading the status from
the modem.
Thanks in advance,
James.
More information about the linuxCprogramming
mailing list