[asterisk-dev] Asterisk Beginner learning about Channels

Russell Bryant russell at russellbryant.net
Thu Aug 28 08:25:07 CDT 2014


On Wed, Aug 27, 2014 at 4:32 PM, Maiquel Breitenbach <
maiquel.breitenbach at gmail.com> wrote:

> Hi,
>
> I was already here asking about the building of new channel, I use as
> example chan_alsa, the new channel is work, the write function record a
> voice in file, but i am having problems with function read, asterisk
> doesn't call the read function, can someone explain how the asterisk works
> to call the read function of a channel?
>
> I appreciate very much your help.
>
>
Most channel drivers, including chan_alsa, set a file descriptor on the
channel that will be polled.  When that fd indicates reading is possible,
the read() callback will be called.  Search for ast_channel_set_fd() in
chan_alsa.c, for example.

It's also possible to do reading in your own way in another thread and
queue frames to the channel using ast_queue_frame().  chan_iax2 does this.
 In that case, the read calback isn't used.  chan_iax2 has to do it that
way as all data for *every* call is arriving on the same UDP socket, so it
can't put that one socket fd on every channel.

-- 
Russell Bryant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140828/1f44a9a5/attachment.html>


More information about the asterisk-dev mailing list