Enhancing Busy Tone Detection Function in A810/1610/2410


Contents

Chapter 1 Overview

Because of incomplete support of Asterisk to signal tone, FXO port is always can’t hang up normally. For that, OpenVox developed a specialized DSP algorithm that can operate three different types of signal detection in every FXO channels, and standalone Voice Activity Detection (VAD). It is believed that this can completely solve long-term disturbing problems on FXO ports cannot hang-up. Until now, A810/1610/2410 series analog telephony cards have supported enhanced signal tone detection function.

1.1 System structure and application

OpenVox enhanced signal tone detection is a driver program runs on Linux kernel and load together with OpenVox cards’ driver program. After loading DSP library, it will generate a tree-type directory which includes every channel’s number and busy tone parameters and so on. It is able to read and modify busy tone parameters by reading and writing every /proc file system item. Meanwhile, the function takes advantage of Asterisk resource module to automatically load and configurate channels. 
Operation procedures: 
1. Install DAHDI; 
2. Install Asterisk patches; 
3. Configurate file opvxdsp.conf to load preset parameters; 
4. Set busy tone parameters of chan_dahdi.conf: busydetect, busycount, busypattern; 

1.2 Parameters’ Format

Total Path: /proc /opvxdsp/FXO channel number/signal tone name/parameter
Signal names are as follows:
/tone1:Parameter definition of the first signal tone; 
/tone2:Parameter definition of the second signal tone; 
/tone3:Parameter definition of the third signal tone; 
/silent_detect:Parameter definition of silent detection; 
parameters:

tone1、tone2、tone3 					        silent_detect
|____busycount							|____detect_tx
|____threshold							|____detect_rx
|____ontime						        |____length
|____offtime						        |____threshold
|____frequency1
|____frequency2

Parameters of tone 1/ tone 2/ tone 3:
busycount: Default value is 0, unit (times). It is considered having detected busy tone after the system detected several continuously,0 means busy tone detection is unable;
threshold: Default value is 20548, unit (energy). Detection threshold value, it is be detected when busy tone energy is larger that threshold value. Calculation method: 
threshold=160*((sample value/128)*(sample value/128)).(Recommended threshold value:20548) 
ontime: Default value is 0, unit(ms),busy tone duration
offtime: Default value is 0, unit(ms),break time between busy tone
frequency1: Default value is 0, unit(HZ),the first busy tone frequency,effective range is 300~700HZ
frequency2: Default value is 0, unit(HZ). If there are two busy tone frequencies, write down the second busy tone frequency here, effective range300~700HZ; If there is only one frequency , it is 0.

Parameters of silence_detect:
detect_tx: Default value is 0. Silence detection in the direction of transmitting (TX). 1 is able,and 0 is unable.
detect_rx: Default value is 0. Silence detection in the direction of receiving (RX). 1 is able,and 0 is unable.
length: Default value is 30, unit(s). It is decision value that silence duration time surpass the length value it means successful detection. (Recommended value: 30s) 
threshold: Default value is 2560, unit (energy). Detection threshold value, it is be detected when silence tone energy is smaller that threshold value.
Calculation method: threshold=160*((sample value/128)*(sample value/128)).(Recommended threshold value:2560) 

Chapter2 Install DAHDI

2.1 Download

Choose and download DAHDI driver from OpenVox official website :
http://downloads.openvox.cn/pub/drivers/dahdi-linux-complete/releases/1.3.5/
http://downloads.openvox.cn/pub/drivers/zaptel/openvox_zaptel-1.4.12.1.tar.gz

Chapter 3 Install Asterisk Patch

3.1 Download

Download the Asterisk patch from URL:
http://downloads.openvox.cn/pub/drivers/asterisk-patches/enhance.tar.gz 

3.2 Install the patch on Asterisk 1.2.x

1.Unzip

# tar –xzvf enhance.tar.gz

2.Copy res_enhance.c to $astersksource/res 

# cp res_enhance.c $asterisksource/res/

3.Copy opvxdsp.conf to /etc/asterisk 

# cp opvxdsp.conf /etc/asterisk

4.Edit $astersksource/res/Makefile

# vi /usr/src/asterisk/res/Makefile

5.Edit the line:

MODS=res_indications.so res_monitor.so res_adsi.so res_agi.so res_features.so

To:

MODS=res_indications.so res_monitor.so res_adsi.so res_agi.so res_features.so res_enhance.so

6.Recompile Asterisk 

# cd $asterisksource
# make
# make install

7.Configure /etc/asterisk/opvxdsp.conf
Please refer to Chapter 4

8.Restart Asterisk

3.3 Install the patch on Asterisk 1.4.x

1.Unzip

# tar –xzvf enhance.tar.gz

2.Copy res_enhance.c to $astersksource/res 

# cp res_enhance.c $asterisksource/res/

3.Copy opvxdsp.conf to /etc/asterisk 

# cp opvxdsp.conf /etc/asterisk

4.Recompile Asterisk

# cd $asterisksource
# make
# make install</pre>

5.Configure /etc/asterisk/opvxdsp.conf
Please refer to Chaper 4

6.Restart Asterisk

3.4 Asterisk CLI

1. Check channel

 
*CLI> busydetect show	              #show all FXO channel numbers
*CLI> busydetect show 1	              #show all parameters of channel 1

2. Set channel parameter

*CLI> busydetect set tone1 busycount 3   # Set 3 for busycount; current channel is dependent on command“busydetect show channel”

Chapter 4 Configuration files

Asterisk will load configuration file opvxdsp.conf automatically everytime when your server is start once finish installing the patch as the chapter 3 introduces. Configuring the opvxdsp.conf file is to realize acquiescently load preset parameters and setting chan_dahdi.conf to support busy tone detection. 

4.1 Configuration file opvxdsp.conf

1. Setting segment name(also called signal tone name):Effective value is [tone 1],[tone 2], [tone 3], [silence detect], it is repeatable. 

2. Setting segment parameters:
1) channel=preset FXO channel number(must be set);
2) signal tone parameter =new parameter value(please refer to 1.2 for parameter name and format)

Question 1. Channel FXO 11 need to be set busy tone detection
Detection conditions:
(1) Continuously detected 3 busy tone is regarded as detect busy tone signal;
(2) Busy tone signal has two frequencies: 480HZ and 620HZ;
(3) Busy tone duration time is 300ms, break time between busy tone is 300ms;
To solve:
Add the following lines in file opvxdsp.conf

 [tone1]
 channel=11
 busycount=3
 ontime=300
 offtime=300
 frequency1=480
 frequency2=620

Question 2. Channel FXO 6 need to be set silence detection
Detection conditions:
(1) It is allowed to detect in transmitting and receiving part;
(2) Detection time:20s
To solve:
Add the following lines in opvxdsp.conf

 [silent_detect]
 channel=6
 detect_tx=1
 detect_rx=1
 length=20

4.2 Configure chan_dahdi.conf

Set parameters:

 busydetect=yes 	  ;Support busydetect
 busycount=6 	          ;Recommended value is 6, improve successful detection rate, and effective range is 1 to 15
 busypattern=500,500      ;Fixed value, please set this parameter to combine with DAHDI driver use