[Freeswitch-users] freetdm api - ftdm_channel_read()

Moises Silva moises.silva at gmail.com
Mon Aug 29 18:12:20 MSD 2011


On Wed, Aug 24, 2011 at 8:47 AM, jfabo <juraj.fabo at gmail.com> wrote:
> Hi Moises,
> My target platform is SLES 11. I installed wanpipe-3.5.20
> but did not find the queue setting within wanpipe.conf
> (at least not explicitely as queue size)
> However, setting it via libfreetdm API was successful.

Do not confuse it with /etc/wanpipe/wanpipex.conf, the wanpipe.conf
file I am talking about is the freetdm wanpipe.conf file, the sample
file is found in conf/wanpipe.conf in the freetdm source code
directory.

> Yes, I just have different framing on the second network stack = 20ms,
>  while on the E1 I have 10ms, that was why I asked about the reading method.
> Since read is done by polling, I would like to initiate it from the other
> network stack thread (here I use ACE framework and
> have all streams/mixers triggered from single Reactor/thread)

You are going to be better off by setting the timing to be the same as
the network stack.

> My intention was to use single thread to handle read/write operations
> on all active channels, which is different than the approach described
>  in freetdm/doc/locking.txt (where thread per call leg is mentioned).
> I worry most about calling the wait_channel() with timeout = -1 which
> afaik leads to blocking wait on single channel. As mentioned earlier,
> when this is called from single thread prio each particular
> ftdm_channel_write()
>  it represents danger of blocking and latency. I measure time spent
> in each particular channel wait+write and the result was < 10us.

If you're following this approach, you can safely assume all channels
in a card are ready to read/write at the same time, so polling in just
one channel is enough (just make sure the channel you poll on is not
alarmed, ie, physical line disconnected). The card delivers data to
the all the channels in the same card under the same hardware clock
(either coming from the telco or the internal oscillator). The
approach other applications follow is one thread per span, then you
poll in a single channel and read/write for all of them when waken up.

> Maybe rather a simple question, does the application which uses
> libfreetdm need to run thread per call/channel?

No, we have at least one application that even work in a completely
different mode (span mode), where all the IO read/write is done for
the whole span in a single operation in a single thread, unfortunately
to do this you need to modify ftmod_wanpipe or code your own I/O
module making use of libsangoma span mode. Probably not worth it yet.

> should I repost also this?

You can move your future replies there.

Moises Silva
Senior Software Engineer, Software Development Manager
Sangoma Technologies Inc. | 100 Renfrew Drive, Suite 100, Markham ON
L3R 9R6 Canada
t. 1 905 474 1990 x128 | e. moy at sangoma.com



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list