[asterisk-dev] asterisk how to use zaptel

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Dec 23 04:04:49 CST 2008


On Tue, Dec 23, 2008 at 01:30:17AM +0000, 张留祺 wrote:
> 
> Hi,all!
>    Now,I want use zaptel to my own program,just like asterisk use 
> zaptel! When a write a simple test,I found a problem!

Zaptel includes a number of such small programs. See e.e. the pat* ones.

> It's that: I use the TDM410p card and loop the span2 and span4,then I 
> write the channel 32 and read the data from channel 94,

TDM410P is an analog card. It has up to 4 channels in one span.

Do you mean TE410p ?

Generally in an analog loop there certainly can be noise. In a digital
loop there shouldn't be noise.

> the code like this: 
> write.c
> for(;;)
> {
> //         fd is the value of func open return it point channel 32;buffer is memset(buffer,'a',1023);buffer[1023]='\0';
>            write(fd,buffer,1024);
> }
>  
> read.c
> for(;;)
> {
> //         fd is the value of func open return it point channel 94;readbuffer is filled with 0;
>            read(fd,readbuffer,1024);
> }

Have you opened the file descriptor? Have you checked return values?
What is the complete  code?

And again, look at patget/pattest .

> then , the function read return 1024,and i use printf("%s",readbuffer); 
> I found when i send 1023 'a',i recieve 1023 'a',but in twice,the 
> first package with lots of 0xff and some 'a',the second package filled 
> parts of 'a'.
>  How can i once recieve the 1023 'a'? Can any one help me ?

Maybe the write was not complete? Maybe you need to read / write in a
loop?

BTW: Zaptel is frozen and no longer developed . Use DAHDI (dahdi-linux /
dahdi-tools).

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-dev mailing list