Connect Asterisk Server via the TDMoE

From RtpBridge
Jump to: navigation, search

Abstract

Asterisk.jpg

It is possible to use Alvis-CSI together with the RtpBridge Basic as a remote Asterisk E1/T1 PRI Interface Board. That case all you need is configure the RtpBridge with the N64 Streaming mode allows to send a full E1/T1 frame over the Ethernet to a remote host.

Check the site on the Releases soon!!!

Software Drivers

On the remote Asterisk system (could be Intel based or Embedded - no matter) all that needed is to build/install/setup a special DAHDI driver that will understand the 1K streaming packets sent by the RtpBridge.

Advantages of this solution

  • It is possible to connect not only to the Asterisk, but to other GPL softswitches like Yate or FreeSwitch. All what is needed is write a simple socket interface to be able to read/write E1 buffers.
  • No need to think about the E1 Layer1 configuration - RtpBridge has a very simple configuration interface.
  • Ability to intercept any timeslots and send them for the Analysis to some tools like the WireShark.
  • High Scalability: Need more E1 links? Install one more Alvis-CSI on your net and that's all!
  • Asterisk-side is a fully GPL, no standards violations - Remote Drivers are provided for free on the GPL basis!
  • No restrictions caused by the Embedded Systems - it is possible to build a full Call Centers etc..
  • Low ARM CPU usage - Because RtpBridge is highly uses the powerful DSP Core of the SoC, 4xE1 spans is not a problem to send/receive even on the DM644x!
  • It is possible to integrate LEC.
  • HDLC is done on the DSP side, no load of the ARM CPU.


How to setup Asterisk

My OS was CentOS 5.3

  • Install or build packages: libtonezone, libtonezone-devel, libpri, libpri-devel, ncurses, ncurses-devel, libxml2, libxml2-devel

yum didn't helped me with libtonezone so I used:

http://packages.asterisk.org/centos/5/current/i386/RPMS/libtonezone-2.4.0-2_centos5.i386.rpm

http://packages.asterisk.org/centos/5/current/i386/RPMS/libtonezone-devel-2.4.0-2_centos5.i386.rpm

http://packages.asterisk.org/centos/5/current/i386/RPMS/libpri-1.4.11.5-1_centos5.i386.rpm

http://packages.asterisk.org/centos/5/current/i386/RPMS/libpri-devel-1.4.11.5-1_centos5.i386.rpm

 rpm -i libtonezone-2.4.0-2_centos5.i386.rpm 
 rpm -i libtonezone-devel-2.4.0-2_centos5.i386.rpm
 rpm -i libpri-1.4.11.5-1_centos5.i386.rpm
 rpm -i libpri-devel-1.4.11.5-1_centos5.i386.rpm

I uses yum to install some other:

 yum install ncurses
 yum install ncurses-devel
 yum install libxml2
 yum install libxml2-devel

Also for correct building you should have kernel headers, kernel sources and build tools:

 yum install gcc-c++ kernel-headers kernel-devel


 make
 make install
 depmod

To make you also may need to take

 dahdi/include/dahdi/kernel.h

from

 dahdi-linux-2.4.1.2.tar.gz

If make says "You do not appear to have the sources for the xxx kernel installed" then you need install correct kernel-devel package. For example:

 # uname -r 
 2.6.18-92.el5

You need to install

 rpm -i kernel-devel-2.6.18-92.el5.i686.rpm

You have to uninstall wrong package first

 rpm -e kernel-devel-2.6.18-238.5.1.el5.i686.rpm

After that you have:

 /usr/src/kernels/2.6.18-92.el5-i686
 ./configure
 make 
 make install
  • Build and install Asterisk, I used asterisk-1.6.2.18 :

You should configure asterisk with libpri, libtonezone and dahdi support:

 ./configure --with-pri --with-tonezone --with-dahdi

Copy 'asterisk/res_n64conf.c' to folder 'res' in you asterisk sources

Ensure that you select chan_dahdi channel driver in configuration:

 make menuconfig
  • Build and install Asterisk:
 make
 make install
 make config
 make samples
  • Copy file n64.conf from asterisk folder of this package to asterisk configuration folder (typical /etc/asterisk)

Configure in n64.conf 2 spans:

 ;Span0 configuration
 [0]
 mac=A1:A2:A3:A4:A5:A6 
 if=eth0 
 ch=0
 ;Span1 configuration 
 [1] 
 mac=A1:A2:A3:A4:A5:A6
 if=eth0 
 ch=1

Where A1:A2:A3:A4:A5:A6 is Alvis-CSI MAC address

  • Configure dahdi, in /etc/dahdi/system.conf add 2 spans:
  span=1,1,0,ccs,hdb3,crc4
  bchan=1-15,17-31
  dchan=16
  span=2,0,0,ccs,hdb3,crc4
  bchan=32-46,48-62
  dchan=47

  • Configure PRI

In /etc/asterisk/chan_dahdi.conf add:

 switchtype=qsig
 group=1
 signalling=pri_net  
 channel =>1-15,17-31  
 switchtype=qsig  
 group=2  
 signalling=pri_cpe  
 channel =>32-46,48-62 
  • Configure rtpbridge

Intsall rtpbridge, I used http://packages.odints.com/csirep/otx/RPMS.arm/rtpbridge-1.10.1-1.arm_v5t_le.rpm

Add N64 span configuration to /root/cfg:

 connect tdmli:0:raw n64:0:eth0:B1:B2:B3:B4:B5:B6
 connect tdmli:1:raw n64:1:eth0:B1:B2:B3:B4:B5:B6
 connect n64:0:eth0 tdmli:0:raw
 connect n64:1:eth0 tdmli:1:raw

Where B1:B2:B3:B4:B5:B6 is Asterisk host MAC address

  • Run Asterisk
 asterisk -c

And check PRI is up, make sure that Alvis-CSI has E1 loop cable from li0 to li1

 *CLI> pri show spans
 PRI span 1/0: Provisioned, Up, Active
 PRI span 2/0: Provisioned, Up, Active


To check statistics of otxdahdin64 you can use:

 cat /proc/otxdahdin64/spans/0
 cat /proc/otxdahdin64/spans/1

If dahdi_сfg fails

 # dahdi_cfg
 DAHDI_SPANCONFIG failed on span 1: Invalid argument (22)

Do the following

 rmmod otxdahdin64
 rmmod xpp_usb
 rmmod xpp
 rmmod dahdi_dummy
 rmmod dahdi


Type the name of a command and press enter to execute it, or help for assistance.

How to setup YATE

Let say we need to connect Asterisk and YATE via PRI link. And have the following scheme:

 SIP phone -> Asterisk ->PRI[Alvis with OtxRtpBridge] ->PRI->YATE->Answering machine

Let's configure it step by step

  • First configure SIP phone. Add to sip.conf:
 [123456]
 type=friend                     ; Friends place calls and receive calls
 context=from-sip                ; Context for incoming calls from this user
 secret=blah

Configure SIP phone: set Asterisk address, user name = 123456, password = blah

  • Configure Asterisk as described above but do not configure span2

Add to /etc/asterisk/extensions.conf:

 [from-sip]
 exten =>99,1,Dial(DAHDI/1/99)

To send call to number 99 to PRI

  • Configure OtxRtpBridge, /root/cfg:
 connect tdmli:0:raw n64:0:eth0:00:0C:29:BB:18:92
 connect n64:0:eth0 tdmli:0:raw
 connect tdmli:1:raw n64:1:eth0:00:26:55:50:7B:52
 connect n64:1:eth0 tdmli:1:raw
 
 connect tdm:li1:ts16:slin rtp:127.0.0.1:5000:6002:slin
 connect rtp:127.0.0.1:5000:6004:g711u tdm:li1:ts16:g711u

00:0C:29:BB:18:92 - is Asterisk Box Mac

00:26:55:50:7B:52 - is YATE Box Mac

The last two lines is related to Hdlc plugin which have to work with OtxRtbBridge because YATE do not do HDLC stufffing. So we have to use hdlc plugin to stuff/destuff hdlc frames from YATE

  • Configure Hdlc plugin, HdlcUtil.conf:
 connect   rtp:127.0.0.1:6002:6004:5000  hdlc:192.168.33.49:20000:10049

192.168.33.49 - is YATE box IP address

  • Build wanpipe
 tar xzf wanpipe-3.3.14.11.tgz
 cd wanpipe-3.3.14.11
 make
 make install 


  • Build YATE, download it from ...{LINK}
 ./configure
 make install
  • Configure YATE

Configure /usr/local/etc/yate/ysigchan.conf: Make sure you have two sections [general] and [trunk1] In [trunk1]:

 type=isdn-pri-cpe
 switchtype=qsig
 sig=tdm1
 offset=0
 rxunderrun=0
 channelsync=300
 channellock=10000
 format=alaw
 print-messages=yes
 print-frames=yes


Configure /usr/local/etc/yate/regexroute.conf: in [contexts]

 .*=default

in [default]

 ^99$=tone/milliwatt

It will make YATE play tone when you call number 99 from you SIP phone

Configure /usr/local/etc/yate/tdmcard.conf: Make sure you have section [tdm1]:

 span=1
 type=E1
 hdlc_local_addr=192.168.33.49
 hdlc_local_port=20000
 n64_link_id=1
 n64_remote_mac=00:50:C2:81:71:B5
 hdlc_remote_addr=192.168.133.93
 hdlc_remote_port=10049

192.168.33.49 - IP address of YATE box 00:50:C2:81:71:B5 - Alvis with OtxRtpBridge mac 192.168.133.93 - IP address of Alvis with OtxRtpBridge



Type the name of a command and press enter to execute it, or help for assistance.


Type the name of a command and press enter to execute it, or help for assistance.