world leader in high performance signal processing
Trace: » asterisk

Enable Asterisk for uClinux

What is Asterisk

The Asterisk is an open source, converged telephony platform, which is designed primarily to run on Linux. Applications such as voice mail, hosted conferencing, call queuing and agents, music on hold, and call parking are all standard features built right into the software. For more info: Asteriskdocs uCasterisk is Asterisk ported for uClinux. For more info: uCasterisk

PBX hardware - 2FXS+2FXO daughter card

:pbx-board.jpg

There are two ports on PBX daughter card: 2 FXS ports and 2 FXO ports.

Jack Port
J1 FXS-1
J2 FXS-2
J3 FXO-1
J4 FXO-2

The jumpers on card could be set as follows:

Jumper status(BF533) status(BF537)
J6 closed closed
J9 No jumper No Jumper
J10 closed closed
J11 5 3
J12 closed closed
J13 1-2 1-2
J15 2-3 2-3
J16 4 4
J17 No jumper No jumper
J18 closed closed
J19 6 2
J20 closed closed
  1. For J13, 1-2 use RING power from STAMP board; 2-3 use RING power from J14.
  2. For J11, J16 and J19, the jumper positions should be same with that in menuconfig.
  3. Connect the card to SPORT0 of STAMP board.
  4. The PBX board asks for a power supplier of 12V to 24V output voltage. Please connect a power supplier of 12V to 24V output voltage to your bf533-stamp or bf537 stamp board instead of the original 7V one. This is safe for these boards.
  5. The available SPI chip select PIN for PBX FXO/FSX and RESET on BF537 stamp board is 2 to 4. While, 1 to 7 are available for BF533 stamp board.

Enable Asterisk in menuconfig

Enable Zaptels driver

Customize Kernel Settings ->
    Device Drivers ->
        PBX support ->
            <*> PBX support
            [*]   Use SPI framework
            (5)   FXS chip select PIN (J11) on PBX card
            (4)   Reset PIN (J16) on PBX card
            (6)   FSO chip select PIN (J19) on PBX card

You can also compile the driver as modules.

Enable Asterisk

Customize Vendor/User Settings ->
    Blackfin app programs ->
        [*] Asterisk PBX

Enable libraries

Customize Vendor/User Settings ->
    Library Configuration ->
        [*] Build libssl
        [*] Build libz
        [*] Build ncurses

Add Libssl

Download openssl-0.9.8d.tar.gz from http://www.openssl.org.

uClinux-dist$ cd lib
uClinux-dist/lib$ rm -rf libssl
uClinux-dist/lib$ tar zxf openssl-0.9.8d.tar.gz
uClinux-dist/lib$ mv openssl-0.9.8d libssl
uClinux-dist/lib$ cd libssl
uClinux-dist/lib/libssl$ patch –p1 < ../../bfin_patch/libssl_patch/libssl_bfin.patch

Other implied included things

When you selected Asterisk, other libraries are implied selected as well as libssl, libz, and ncurses. These implied included libraries are: speex, blackfin-gam, libtool, zaptel, and threadstack.

Make and download to target

  • 2007R1 and 2006R2 releases. You should enlarge your romfs size before make the whole kernel. Since Asterisk is large software, you should change your romfs from default 8192 to 25600 in uClinux-dist/vendors/AnalogDevices/BF533-STAMP/Makefile or uClinux-dist/vendors/AnalogDevices/BF537-STAMP/Makefile before building the image.
  • SVN trunk and impending 2007R2 release. We switch to ramfs in the latest source, which uses the whole available memory as the virtual root file system. Don't worry about the fs size. Just build the image.
  • Copy the image file “images/linux” to folder ”/tftpboot” and download to your target.
host:/your-uclinux-source> cp images/linux /tftpboot/

stamp> boot

Make sure your PBX card is connected to your STAMP board.

One can remove the mp3 files in user/blkfin-apps/asterisk/sounds to reduce the romsfs size. If all the 3 mp3 file are removed, the romfs size can be changed to 16384 or more.

Asterisk can now run on BF537-STAMP with the mp3 files be removed. The driver and Astersik have been tested on BF537-STAMP.

Run Asterisk

Check driver and hardware

If the driver is statically compiled to kernel, it will be automatically loaded during boot process. There are two parts of the driver, one is zaptel, and the another is wcfxs. The proper display will like following:

Zapata Telephony Interface Registered on major 196
FXS_CS=1
FXO_CS=2
RESET bit = 4
iRxBuffer1 = 0xff800000
iTxBuffer1 = 0xff800080
ISR installed OK
FXS detect..... card=0
Testing for ProSLIC
ProSLIC module 0, product 0, version 5
ProSLIC on module 0 seems sane.
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0xc8
reg 83: 0xc8
ProSLIC on module 0 powered up to -72 volts (c0) in 88 ms
Loop current set to 20mA!
Post-leakage voltage: 31 volts
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0xc8
reg 83: 0xc8
ProSLIC on module 0 powered up to -72 volts (c0) in 72 ms
Loop current set to 20mA!
Start manual calibration
Init Indirect Registers completed successfully.
Proslic module 0 loop current is 20mA
Module 0: Installed -- AUTO FXS/DPO
FXS detect..... card=1
Testing for ProSLIC
ProSLIC module 1, product 0, version 5
ProSLIC on module 1 seems sane.
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0xc7
reg 83: 0xc7
ProSLIC on module 1 powered up to -72 volts (c1) in 76 ms
Loop current set to 20mA!
Post-leakage voltage: 31 volts
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0xc7
reg 83: 0xc7
ProSLIC on module 1 powered up to -72 volts (c0) in 64 ms
Loop current set to 20mA!
Start manual calibration
Init Indirect Registers completed successfully.
Proslic module 1 loop current is 20mA
Module 1: Installed -- AUTO FXS/DPO
FXO detect..... card=2
Testing for DAA...
  VoiceDAA System: 04
  ISO-Cap is now up, line side: 03 rev 06
Module 2: Installed -- AUTO FXO (FCC mode)
BATTERY on 1/3 (+)!
FXO detect..... card=3
Testing for DAA...
  VoiceDAA System: 04
  ISO-Cap is now up, line side: 03 rev 06
Module 3: Installed -- AUTO FXO (FCC mode)
BATTERY on 1/4 (-)!
Found: Blackfin STAMP (4 modules)
NET: Registered protocol family 2
4294893405 Polarity reversed (0 -> 1)

There are 4 ports on PBX daughter card. In driver, they are named card 0 to card 3, also module 0 to module 3. Module 0 and Module 1 are FXS ports, here are ProSLIC. Module 2 and Module 3 are FXO ports, here are DAA or VoiceDAA. If all is OK, ProSLIC will power up to -72V for ring power. If no power is configured for ring power ( form J14 or STAMP board), it will display like following:

FXS detect..... card=0
Testing for ProSLIC
ProSLIC module 0, product 0, version 5
ProSLIC on module 0 seems sane.
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0x0
reg 83: 0x0
ProSLIC on module 0 failed to powerup within 520 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM400P??
Unable to do INITIAL ProSLIC powerup on module 0
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0x0
reg 83: 0x0
ProSLIC on module 0 failed to powerup within 520 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM400P??
Unable to do INITIAL ProSLIC powerup on module 0
Module 0: FAILED FXS (FCC)
FXS detect..... card=1
Testing for ProSLIC
ProSLIC module 1, product 0, version 5
ProSLIC on module 1 seems sane.
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0x0
reg 83: 0x0
ProSLIC on module 1 failed to powerup within 520 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM400P??
Unable to do INITIAL ProSLIC powerup on module 1
reg 0: 0x85
reg 14: 0x0
reg 74: 0x32
reg 80: 0x0
reg 81: 0x0
reg 92: 0xff
reg 82: 0x0
reg 83: 0x0
ProSLIC on module 1 failed to powerup within 520 ms (0 mV only)

 -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM400P??
Unable to do INITIAL ProSLIC powerup on module 1
Module 1: FAILED FXS (FCC)

If jumpers are not set correct for J11 or J19, it will display like following:

FXS detect..... card=0
Testing for ProSLIC
  ProSLIC not loaded...
FXS detect..... card=1
Testing for ProSLIC
  ProSLIC not loaded...
FXO detect..... card=2
Testing for DAA...
  DAA not found! (blah = 0xff)
Module 2: Not installed
FXO detect..... card=3
Testing for DAA...
  DAA not found! (blah = 0xff)
Module 3: Not installed

If your driver is compiled as modules, you should insmod zaptel.ko first, and then insmod wcfxs.ko.

ztcfg

This step is simple but important.

root:‾> ztcfg
Registered tone zone 0 (United States / North America)

Run Asterisk

Before run Asterisk, we should copy some thing from /usr/var to /var.

root:/> cp -a /usr/var/* /var/
root:/> rm -rf /usr/var

Now things are OK to run Asterisk.

root:> asterisk -c

or:

root:> asterisk -vvvc

default extension number

FXS-1: 1001

FXS-2: 1002

Configurations

Now Asterisk is started. You connect two analog phones to FXS ports. But you cannot call one another only use the default extension numbers. You can configure FXS channel and FXO channel, as well as VoIP channels. We give our configurations here.

Zaptel Hardware configuration: zaptel.conf

#blackfin 2FXS+2FXO card
#channel 1 = FXS
fxoks=1
#channel 2 = FXS
fxoks=2
#channel 3 = FXO
fxsks=3
#channel 4 =FXO
fxsks=4

Zapata Hardware configuration: zapata.conf

;Blackfin 2FXS+2FXO card
signalling=fxo_ks
context=internal
group=1
channel=> 1-2

signalling=fxs_ks
group=2
context=incoming
channel=> 3-4

Dialplan configuration: extensions.conf

[internal]
; dummy extension just for testing
;include => outbound-local

exten => 2005,1,Answer
exten => 2005,2,Wait(2)
exten => 2005,3,Hangup

exten => 1001,1,Dial(Zap/1,10)
exten => 1001,2,Playback(vm-nobodyavail)
exten => 1001,3,hangup

exten => 1002,1,Dial(Zap/2,10)
exten => 1002,2,Playback(vm-nobodyavail)
exten => 1002,3,hangup

; IAX2 softphone and SIP IP-phone
exten => 2003,1,Dial(IAX2/iaxcomm)
exten => 2004,1,Dial(SIP/sipguest)

; reach standard asterisk demo
exten => 2000,1,Goto(demo,s,1)

[incoming]
; FXO port connected to Blackfin reaches standard demo
exten => s,1,Answer
exten => s,2,Background(vm-enter-num-to-call)
exten => 1001,1,Dial(Zap/1,10)
exten => 1001,2,Playback(vm-nobodyavail)
exten => 1001,3,Hangup
exten => 1001,102,Playback(tt-allbusy)
exten => 1001,103,Hangup
exten => 1002,1,Dial(Zap/2,10)
exten => 1002,2,Playback(vm-nobodyavail)
exten => 1002,3,Hangup
exten => 1002,102,Playback(tt-allbusy)
exten => 1002,103,Hangup

[outbound-local]
exten => 9NXX,1,Dial(Zap/3/NXX)