Mittwoch, 5. Oktober 2011

bug in asterisk >= 1.8

Compared with asterisk release 1.6 1.8 release is not stable.

The same test suite:

exten => _X.,1,NoOp exten => _X.,n,Answer exten => _X.,n,Echo

Using 30 channels and middle call duration of 5 sec results runs without problems with asterisk 1.6. But results in asterisk crash if using asterisk 1.8. Crash is caused by destruction of libc memory pool of by destruction of internal asterisk structures: CDR variables.

The solution for this problem is located inside of asterisk core: Multiple channel drivers are using "ast_set_callerid" from the context of internal thread. This is OK: "ast_set_callerid" calls ast_channel_lock and all changes on the channel variables are protected. After cid update is completed "ast_set_callerid" calls:

if (chan->cdr) { ast_cdr_setcid(chan->cdr, chan); }

At same time "__ast_pbx_run" ("main/pbx.c") calls:

if (c->cdr)

This call happens in the context of pbx own thread and the access to CDR is performed without any protection.

In the most of cases problem is caused by "freeing of already freed memory" and receives real problem if "freeing of freed and allocated by other memory".

The immediate solution is to change __ast_pbx_run in main/pbx.c and protect access to CDR:

ast_channel_lock(c); /* Add this line */
if (c->cdr)
ast_channel_unlock(c); /* Add this line */

This is multiple locations (inside of "__ast_pbx_run") where "ast_cdr_update" is called. You need to protect all accesses.

The newest available version of chan_capi (chan-capi-trunk 943) includes one work around for this problem: the code of "ast_set_callerid" is partially replicated and CDR is not updated if caller id changes (for example name is received from network).

But this is still problem if you use other channel driver (for example chan_sip). In this case you should modify "__ast_pbx_run" in "main/pbx.c", build and install asterisk.

chan_capi support for asterisk 10.0 BETA 1

New chan-capi-trunk 943 contains support for asterisk 10.0 BETA1 Changes are already tested and allows to use chan_capi together with new version of asterisk.

Dienstag, 30. August 2011

High Definition Conference using Diva System Release 9.6 and Wide Band audio codecs

Diva System Release 9.6 and provided as part of release chan_capi (or from SVN trunk path) provides support for wide band codecs:


This allows to use Diva hardware and chan_capi to create High Definition Conference servers.
Diva hardware supports mix of up to 900 TDM E.1/T.1/ISDN/POTS and VoIP (SIP/IAX/...) channels at same time.
Additional media processing can be applied to conference audio streams:
Echo cancellation
Noise Suppression
DTMF tome suppression
Part 168 Voice limiter
Automatic Gain Control for Rx and for Tx media streams

Together with quality of wide band codecs it allows to enhance the quality of conference signal and to achieve better use experience.

Very large conference with 900 members using Diva System Release 9.6 and chan_capi

Using Diva system release 9.6 and new chan_capi (available as part of release and using SVN trunk path) this is possible to create full duplex conferences with up to 900 members.

By default the size of conference using Diva hardware is limited to 140 (With media processing) or to 360 (simple conference without media processing) members.

Introduction of "large conference" mode allows to increase size of conference up to 900 members with media processing active.

The new conferencing mode is activated using new "g" option for chan_capi "chat" command.

All media processing features, automatic gain control and active talker evaluation are available. User is free to create conference with up to 900 members, independent from the domain members connects from (E.1/T.1/ISDN/Analog or IP).

Media processing is performed using DSP of Diva hardware.

High Density Ultra Low Power HD Audo Gateway/IVR using Diva System Release 9.6

Diva system release 9.6 offers new feature: diva streaming.
While this feature is hidden inside of the product core and use of this feature is nothing what requires and user/application actions the major effects from introduction of this feature are:

High reduction of host load
Low delay and delay variance of voice stream

Diva streaming is new media transport protocol. It is responsible for transfer of data between user application and Diva media processing resource. Diva streaming allows transport of data without host intervention and without overhead of system calls.
BUS Master DMA of Diva hardware performs direct transport of data between chan_capi and Diva media processing resources.

Provided reduction of host load allows to use smaller CPU and to reduce required power, space and price of the system. Moreover this is possible to create one passive cooled and free of maintenance system:

Dual core 1.2 or 1.6GHz Atom with 2 ... 4 GByte memory and 32Bit Ubuntu 10.04 LTS, updated to backport kernel with SSD support.
SSD or SD card with 4 ... 32 Gbyte as solid state disk.
Diva 4PRI PCIe HS (Half Size) or Diva 8PRI PCIe FS (Full Size) hardware.
Asterisk 1.8 compiled from sources.

In the test we used:
Dual core 1.6GHz Atom, 4GByte SD card, passive cooled, Diva 4PRI PCIe HS.

This results in one VoIP (SIP) Gateway with power usage of 40 WT and complete free of maintenance.

The space can be saved by use of PCIe connector cable. PCIe BUS allows to use cable as extension. This allows better place,ent of Diva hardware and as result smaller unit size.

The test shows that this is no problem to double channel density up to 240 channels.
This can be done by use of Diva 8PRI PCIe FS (Full Size) hardware.

Dialogic(R) Diva(R) System Release 9.6LIN is available

The new release of Diva system release ( is available now. This 9.6 release provides huge amount of rand new features:

Support for Wide Band Audio (G.722 and related), inclusive support for chan_capi and Diva chan_capi WEB configuration. Now it is possible to create VoIP Gateways and conferences using Wide Band Audio codecs.
Wide band audio increases productivity and is one great enhancement for every conference server.

Diva streaming allows direct streaming of data between Diva media processing resources and running in user or in kernel mode applications with zero host intervention (using PCI/PCIe BUS Master DMA).
chan_capi supports Diva streaming. This reduces host load and allows to use low power dual core Atom boards to process up to 240 voice channels (IVR, Fax, SIP Gateway). This results 240 channels/40 WT: 0.167 WT for Channel, fully passive cooled system.

MWI (message waiting indication) support for chan_capi. chan_capi supports now MWI server and MWI client modes. This is possible to manage MWI atomatic by chan_capi or using dial plan commands.

chan_capi support for Asterisk 1.8

chan_capi support for extra huge conference with up to 900 members using single host.

Support for Blue Line
Support of Blue Line range of E.1/T.1 hardware:
Blue Line 1 PRI PCIe low profile with software echo cancellation
Blue Line 1/2/4/8 PRI PCIe Half Size with hardware echo cancellation

Blue Line range of hardware is optimized for use with chan_capi

Significant performance enhancement of Diva softIP. Now is possible to create up to 1024 channels on single host. No application change is necessary - all softIP channels are presented as N x E.1 or T.1 interfaces.

Diva softIP allows use of Diva T.30 and T.38 protocol stack with intelligent fax processing together with chan_capi, Hylafax and other applications.

Support for true Hot Plug operation fo all PCIe hardware:
Surprise removal without affecting the running applications
Free from human intervention insertion and replacement of Diva hardware

Montag, 25. Juli 2011

Blue line 1/2/4/8 PRI PCIe available from Dialogic

Finally got in the hands new Dialogic hardware. All together it is a new family of host media processing hardware:

Low Profile Blue Line 1 PRI PCIe
Half Size Blue Line 2/4/8 PRI PCIe

The half size boards are equipped with DSP (Digital Signal Processor) for offload of most resource extensive and critical task - G.168 Echo Cancellation.

Boards are supported by standard Dialogic Diva product release and drivers and are exposing same API. This is no problem to use the board with chan_capi. This is just like to Diva boards, only certain media processing features which available on Diva are not available with Blue Line. But Blue Line is even more powerful compared to Diva PRI CTI boards: Echo cancellation is performed using hardware DSP, supporte real time media (RTP). Of cause processing extensive vocoders are not supported by Blue Line.

The Blue Line driver self is provided as binary toolkit and adapter to kernel at build time. This works without problems. Once loaded driver spreads his processing power across of multiple CPU and seems to run at software interrupt level.
At same time user mode driver provided just in case kernel mode driver can not be build. This is no difference taken a look from API which driver is used. But kernel mode scales better.

The conferencing is available too, chancapi "chat" command works without problems.

Taken all together is is very simple to use - just like Diva hardware, using same installation, build and configuratiuon tools.