[asterisk-dev] when to lock a channel

Russell Bryant russell at digium.com
Wed May 7 11:58:46 CDT 2008

lumen wrote:
> When a channel get bridged to another using Bridge manager action, a thread is 
> created to manage that bridge. That thread calls ast_write on both channels 
> to transfer frames between them.
> I was wondering if it's possible from PlayDtmf manager action to, instead of 
> locking the channel and call ast_stream_dtmf, queuing dtmf frames to channel 
> throung ast_write.
> Maybe that idea seams stupid. I'm browsing the asterisk source code only for 
> few days.

It's not stupid.  :)

To directly answer the question about ast_dtmf_stream(), yes, you do need to
lock the channel before calling that function.

Using ast_dtmf_stream() should work, as long as you place the bridged channel in
the 2nd argument to ast_dtmf_stream().  That will ensure that the other channel
continues to get serviced while you are sending DTMF to the first channel.

I would not recommend using ast_write() directly in this case.

Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.

More information about the asterisk-dev mailing list