[asterisk-dev] Zaptel Programming

Wai Wu wkwu at calltrol.com
Wed Oct 3 21:24:18 CDT 2007


Did you configure the span as PRI or RobBit? If your span is PRI, is
your channel 0 the D-Channel? If RobBit, (anyone correct me it I am
wrong) the zaptel driver inserts controlling bits into the data frames.
If I am not mistaken, the 6th and 12th frame. That means, you might have
a hard time send and receiving pure data across those channels.

________________________________

From: asterisk-dev-bounces at lists.digium.com
[mailto:asterisk-dev-bounces at lists.digium.com] On Behalf Of Doug Ehlers
Sent: Wednesday, October 03, 2007 8:26 PM
To: asterisk-dev at lists.digium.com
Subject: [asterisk-dev] Zaptel Programming



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/7eefabde/attachment.htm 


More information about the asterisk-dev mailing list