[asterisk-dev] Zaptel Programming

Doug Ehlers dehlers at css-design.us
Wed Oct 3 22:17:59 CDT 2007


My zaptel.conf is like this:

 

span=1,0,0,esf,b8zs

bchan=1-24

 

span=2,0,0,esf,b8zs

bchan=25-48

 

Is there something better to use?

 

If I read this right that should turn off the robbed bit signaling.  I
believe this matches the opposite equipment.  You are correct, in D4 the 6th
and 12th frames rob for the A and B bit, in ESF the 6th, 12th, 18th, and
24th rob for the A, B, C, and D bits.

 

I have been working further since my previous message.  Another clue might
be this:  The message I send is 10 bytes long, the response is 10 bytes and
then some additional data of 10-20 bytes for each message.  Exactly every
eighth time I send the my message, the reply message comes back correctly.
I have a sniffer that says the opposite end is sending the correct string
everytime.  I am running this as a little command prompt program at the
moment and each time I run it, it sends the message once, so there is no
particular timing involved.  Also, if I loop back from port 1 of the Digium
405 card to port 2 of it with a crossover cable, I get perfect TX/RX between
the same app running in two different windows.  One app operates on chan 1
the other on chan 25.

 

Thanks all,

Doug

 

  _____  

From: Wai Wu [mailto:wkwu at calltrol.com] 
Sent: Wednesday, October 03, 2007 9:24 PM
To: dehlers at css-design.us; Asterisk Developers Mailing List
Subject: RE: [asterisk-dev] Zaptel Programming

 

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


More information about the asterisk-dev mailing list