[Asterisk-Dev] Anyone familiar with pri_dchannel in channels/chan_zap.c?

Chris Ziomkowski cziom at jsg.co.th
Tue Jul 8 12:37:40 MST 2003

Hi everyone.

I am trying to make R2 outbound dialing work with asterisk and an E400P 
card. After looking at the code it is clear this has never been done.

I have my protocol working in a test setup under the r2testcall.c file in 
the libr2 package, but I am now trying to make it run under asterisk.

I am trying to model the R2 setup after the way libpri has been designed. 
However, I am having a very difficult time understanding how PRI handles 
outbound calls.

Specifically, I am trying to figure out how the pri_dchannel thread 
interacts with the channel's owner threads in order to handle the PRI 
events such as call proceeding and answered.

Is this a good model for R2? If not, can someone suggest a better idea? Can 
you suggest an example in the source code? R2 is very similar to PRI in the 
code implementation that has been done so far, so it seems a natural fit, 
however it is unlike PRI in the sense that the signalling does not share a 
common channel, which makes hard to do a direct comparison.

I am really trying to understand the overall thread/scheduler model used by 
asterisk, but it is a rather large project and while I have found 
everything fairly well organized so far, I really have no idea what I 
should be looking for.

Can anyone who understands these aspects take a few minutes and explain to 
me the event model and scheduler interaction which is required when an 
outbound call occurs?

Example: ast_call launches a pthread which calls the underlying private 
routine. What are the responsibilities of this thread in terms of 
interacting with the larger system? How does this thread signal an answer 
to the larger system? What happens in the case of a protocol error or 
hangup? Where does this thread actually block waiting for the next event?

Thank you in advance for any assistance you can offer me. I really 
appreciate it. I apologize if my questions are vague. I am still trying to 
grasp the structure.

Chris Ziomkowski
cziom at jsg.co.th_NOSPAM

More information about the asterisk-dev mailing list