[asterisk-dev] Zaptel Programming

Doug Ehlers dehlers at css-design.us
Wed Oct 3 19:25:30 CDT 2007


Hello all,

 

I hope this is the right place to post this message, I didn't see just a
list for Zaptel programming.

 

I am working on a project using a Digium 405 T1 card.  I am trying to write
an application to talk via the T1 interface to another piece of equipment.

 

Very simply, I have set the line configs in zaptel.conf and then run ztcfg
to activate them.

 

In my C++ program, I open the data channel -> fd=open("/dev/zap/1",O_RDWR).
This application is very similar to a PRI line in that one DS0 functions as
a control channel with a pseudo HDLC communications type link and the other
23 channels get dynamically assigned usage based on incoming and outgoing
calls.  Each DS0 is setup to be CLEAR mode, no signaling.

 

After opening the device, I check the buffers and change them to some
smaller sizes, make them act immediate, etc.

 

I am able to write my message and see the opposite system get it and
acknowledge it with a message back -> write(fd, buffer, length)

 

The problem is in getting the data back.  I have just a simple read loop
setup to read the data from the buffers that I believe were setup after the
device was opened.  This is being done with a simple read(fd, buffer,
length) kind of command.  I assume with enough buffers, I should be able to
read the data rapidly enough to not lose anything.  I always get something
back buy 1 in 5 times its actually correct (when no traffic is present, the
opposite side is sending 0xFF always so its pretty easy to know when there
is data coming).  Most of the time the received data bares a resemblance to
the message that was sent, but certainly isn't it.  Occasionally the reply
message is exactly correct and all is well.  Its almost like the bit
alignment is off or something.

 

Is there something I should be doing differently to reliably read data back
from a channel like this?  My next step will be to deal with the audio
channels and the mechanism will be similar.  I have looked at a number of
example applications such as fxotune.c and spent some time in chan_zap.c
trying to discern the correct way to read data, but haven't yet turned
anything up.  There are quite a few options to the zaptel API and I haven't
yet located a good document explaining how to work with it at the level I
need.

 

Can anybody give me some pointers or point me toward other information and
resources?

 

Many thanks,

Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20071003/006daab8/attachment-0001.htm 


More information about the asterisk-dev mailing list