[asterisk-dev] what is "which" in ast_channel_set_fd

Mark Michelson mmichelson at digium.com
Fri Feb 11 14:01:20 CST 2011


On 02/11/2011 01:21 PM, Alok Prasad wrote:
> I am trying to Make a Channel Driver for my custom hardware,But facing 
> problem in polling of FD.
>
> i have few doubts.
> 1.What is "which" in ast_channel_set_fd(),i.e second parameter of this 
> function.

It's the index into the channel's array of file descriptors. So if 
"which" is 3, then
channel->fds[3] would be set to the fd you pass in as the "fd" parameter.

> 2.AST_MAX_FDS is 20 so that this means that ,if allocate a FD whose 
> value is greater than 20 polling
> of read/write wont work.

No. It just means a channel is limited to polling 20 file descriptors. 
This has nothing to do with the file descriptors' values.

> 3.if i use ast_channel_set_fd(temp,0,1) 
> or ast_channel_set_fd(temp,0,2) , i am not able to hear audio from SIP 
> Phone to my hardware,but if i use greater than 10 in field of FD its 
> working fine,
> but then All wait related function of dialplan never timeouts..eg 
> Waitmusichold().
>
> In short What fd values should i use for ast_channel_set_fd() and what 
> is the use of "which" fiedl in this function.

It shouldn't matter what fd values you use. In most Asterisk channels, 
the channel fds are socket fds over which signaling pertaining to the 
channel may occur. So with SIP, you'll usually have the SIP socket fd 
and RTP and RTCP fds for media.

>
> Thanks in advance
>
> Alok
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>     http://lists.digium.com/mailman/listinfo/asterisk-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110211/ce7e70c9/attachment-0001.htm>


More information about the asterisk-dev mailing list