Вы находитесь на странице: 1из 9

Setting up transcoding on Asterisk

Prerequisites
Windows OS + VMware 2.0 Server installed - IP: 10.0.0.55
guest OS on VMware - Linux Slackware 12.0 kernel 2.6.21.5-smp installed - IP:
10.0.0.77
IP-Phones (or Softphones)
Snom 370 registered as number 102 in Asterisk
Yealink T-10 - registered as number 103 in Voipswitch
Purpose
This document will show how to set transcoding on Asterisk and how use it with VPS.
Links
For HOWTO purposes I used below versions of software:
Asterisk 1.4.21.1 - http://downloads.digium.com/pub/asterisk/releases/asterisk1.4.24.1.tar.gz
Zaptel 1.4.9 - http://downloads.digium.com/pub/telephony/zaptel/releases/zaptel1.4.9.tar.gz
Libpri 1.4.9 - http://downloads.digium.com/pub/telephony/libpri/libpri-1.4.9.tar.gz
G.729 & G.723 Codecs - http://asterisk.hosting.lv/src/asterisk-g72x-1.0-beta8.tar.bz2
Intel IPP libraries (needs registration to download, trial 30days free) - https://
registrationcenter.intel.com/regcenter/register.aspx;
Zaptel/Libpri/Asterisk Installation
1. First copy Asterisk, Zaptel, Libpri tarballs to /usr/src/ location of your Slackware linux
box before going
to next step.
2. Zaptel installation
1. cd /usr/src/
2. tar -zxvf zaptel-1.4.9.tar.gz
3. cd zaptel-1.4.9
#./configure
4. make
5. make install
3. Libpri installation
1. tar -zxvf libpri-1.4.9.tar.gz
2. cd libpri-1.4.9
3. make
4. make install
4. Asterisk installation
a) if you had Asterisk installed before please be sure to remove all modules from
/usr/lib/asterisk/
modules/ directory.
1. cd /usr/lib/asterisk
2. mv modules modules.old
b) main installation
1. tar -zxvf asterisk-1.4.21.1.tar.gz
2. cd asterisk-1.4.21.1
3. ./configure

4. make
5. make install
6. make samples
Document generated by Confluence on Jan 18, 2010 10:09 Page 2
Note: All above packages must be installed without any errors! If you see any error
messages do not go
to next step !
Intel IPP Installation
1. Copy IPP package to /usr/src/ location of your Slackware linux box.
2. Main installation
1. cd /usr/src/
2. tar -zxvf l_ipp_itanium_p_6.0.2.076.tar.gz
3. cd l_ipp_itanium_p_6.0.2.076
4. ./install.sh
Note: The install script will display a series of dialog screens. Please follow instructions to
begin the Intel
IPP installation. You will then be prompted to read and accept EULA by "accept" or reject
it by "decline".
You will then be prompted to enter your Intel IPP for Linux serial number which you
received during
registration. For most questions just enter recommended options.
Codecs Compiling
1. Copy asterisk-g72x-1.0-beta8.tar.bz2 to /usr/src/ location of your Slackware linux box.
2. Compile and make install with commands:
1. cd /usr/src/
2. tar xvjpf asterisk-g72x-1.0-beta8.tar.bz2
3. cd asterisk-g72x-1.0-beta8
4. configure --enable-pentium
5. make
6. make install
Note: After correct installation you should see new codecs installed in
/usr/lib/asterisk/modules/. Files:
codec_g723.so* & codec_g729.so* should be there.
Asterisk & Voipswitch Configuration
Locations of Asterisk's configuration files:
sip.conf - /etc/asterisk/sip.conf
extensions.conf - /etc/asterisk/extensions.conf
SIP.CONF
general
port=5060
bindaddr=10.0.0.77
maxexpiry=6400
minexpiry=60
qualifyfreq=10
relaxdtmf=yes
useragent=AsteriskPBX

dtmfmode=rfc2833
videosupport=no
threewaycalling=yes
transfer=yes
101
fullname=ASTERISK
type=peer
context=testujemy
host=10.0.0.55
port=5060
nat=no
;canreinvite=yes
disallow=all
allow=alaw
allow=ulaw
allow=g723
allow=g729
allow=gsm
Document generated by Confluence on Jan 18, 2010 10:09 Page 3
102
fullname=SNOM
type=friend
context=testujemy
username=102
secret=102
callerid="SNOM" <102>
host=dynamic
nat=no
;canreinvite=yes
disallow=all
allow=g723
;allow=gsm
;allow=alaw
;allow=ulaw
;allow=g729
EXTENSIONS.CONF
; Dialplan
internal
exten => 102,1,Dial(SIP/102,20)
;exten => 102,n,PlayBack(vm-goodbye)
exten => 102,n,Hangup()
;
testujemy
include => internal
----- VPS Configuration

Gateways:
Description: asterisk
IP: 10.0.0.77
Port: 5060
Sip Device ticked
Send Remote Party ticked
Codecs ticked: g711u, g711a, g7231, g729, gsm
Also number 103 must be added in Common Clients and dialplan for 102 to asterisk
external gateway.
-----Working scenarios
Dialing from 103 -> 102.
snom (g723) <- asterisk (102-g723) <- VPS (asterisk gateway) <- common client (103g729) <- yealink
(g729)
snom (ulaw) <- asterisk (102-ulaw) <- VPS (asterisk gateway) <- common client (103g729) <- yealink
(g729)
snom (alaw) <- asterisk (102-alaw) <- VPS (asterisk gateway) <- common client (103g729) <- yealink
(g729)
snom (gsm) <- asterisk (102-gsm) <- VPS (asterisk gateway) <- common client (103-g729)
<- yealink
(g729)
snom (g723) <- asterisk (102-g723) <- VPS (asterisk gateway) <- common client (103alaw) <- yealink
(alaw)
snom (g729) <- asterisk (102-g729) <- VPS (asterisk gateway) <- common client (103alaw) <- yealink
(alaw)
Transcoding times
Translation times between formats (in milliseconds) for one second of data can be found
here
Testing transcoding with SIPp
First download SIPp (http://sipp.sourceforge.net) and compile the software:
1. tar -zxvf sipp.3.1.src.tar.gz
2. cd sipp.svn
3. make pcapplay_ossl
Document generated by Confluence on Jan 18, 2010 10:09 Page 4
SIPp is generating traffic according to selected scenario. How to write it you can read in
documentation. I
have prepared scenario which generates calls from numbers 201, 202, ... 220 to
5001,5002,...5020.
Scenario can be found here: ^uac.xml
Numbers 201,202 ... etc. are created in asterisk. 5001, 5002 etc... are set in dialplan and
goes to

VoipBox.
Example configuration of users 102 (snom), 201 is in SIP.CONF in asterisk and should
look like below:
general
port=5060
;bindaddr=0.0.0.0
bindaddr=10.0.0.77
maxexpiry=6400
minexpiry=60
qualifyfreq=10
relaxdtmf=yes
useragent=AsteriskPBX
dtmfmode=rfc2833
videosupport=no
threewaycalling=yes
transfer=yes
disallow=all
allow=g729
allow=ulaw
allow=alaw
allow=g723
allow=gsm
register => 9595:9595@10.0.0.55/9595
sipp
type=friend
context=testujemy
host=dynamic
port=6000
user=ssip
canreinvite=no
nat=yes
insecure=very
disallow=all
allow=ulaw
out2vps
type=peer
username=9595
secret=9595
fromusername=9595
fromdomain=10.0.0.55
context=testujemy
host=10.0.0.55
nat=yes
canreinvite=no
insecure=very
disallow=all

allow=g729
allow=ulaw
allow=alaw
allow=g723
;allow=gsm
102
fullname=SNOM
type=friend
;type=peer
context=testujemy
;context=from-internal
Document generated by Confluence on Jan 18, 2010 10:09 Page 5
username=102
secret=102
callerid="SNOM" <102>
;host=192.168.100.30
host=dynamic
nat=no
;canreinvite=yes
disallow=all
;allow=g726aal2
;allow=gsm
;allow=alaw
;allow=ulaw
allow=g723
201
;fullname=Test
user=201
type=friend
context=testujemy
;context=internal
;username=201
;secret=201
;callerid="201" <201>
host=dynamic
port=6001
;nat=no
;canreinvite=yes
canreinvite=no
insecure=very
disallow=all
;allow=g726aal2
;allow=gsm
;allow=alaw
allow=ulaw
;allow=g723

Also please create user 9595 in GK/Registar Clients and tick codecs: g711u, g711a, g729,
g7231,gsm
Dialplan in asterisk should look like this (/etc/asterisk/extensions.conf):
; Dialplan
internal
exten => 102,1,Dial(SIP/102,20)
exten => 102,n,Hangup()
;
exten => _5.,1,Dial(SIP/$(EXTEN)@out2vps) ;
exten => 5001,n,Hangup()
;
exten => 201,1,Dial(SIP/201,20)
exten => 201,n,Hangup()
;
exten => 103,1,Dial(SIP/$(EXTEN)@out2vps)
exten => 103,n,Hangup()
;
testujemy
include => internal
Now you can dial from asterisk to vps selecting numbers 5001, etc..
To start using SIPp you need to create reg.csv file. Inside this file you need this:
SEQUENTIAL
201;10.0.0.77;aaa;5001;
202;10.0.0.77;aaa;5002;
203;10.0.0.77;aaa;5003;
204;10.0.0.77;aaa;5004;
205;10.0.0.77;aaa;5005;
Document generated by Confluence on Jan 18, 2010 10:09 Page 6
206;10.0.0.77;aaa;5006;
207;10.0.0.77;aaa;5007;
208;10.0.0.77;aaa;5008;
209;10.0.0.77;aaa;5009;
210;10.0.0.77;aaa;5010;
211;10.0.0.77;aaa;5011;
212;10.0.0.77;aaa;5012;
213;10.0.0.77;aaa;5013;
214;10.0.0.77;aaa;5014;
215;10.0.0.77;aaa;5015;
216;10.0.0.77;aaa;5016;
217;10.0.0.77;aaa;5017;
218;10.0.0.77;aaa;5018;
219;10.0.0.77;aaa;5019;
220;10.0.0.77;aaa;5020;
'aaa' is not used by XML scenario file, but don' remove it from file!
To run SIPp just type:
#./sipp -sf uac.xml -mp 5609 10.0.0.77 -r 20 -rp 4s -l 3000 -inf reg.csv

You can check the transcoding between each numbers on live by typing command (in your
Asterisk box)
CLI> sip show channels
Here are results of above command:
User/ANR Call ID Seq (Tx/Rx) Format Hold Last Message
5020 7fb749db166 00103/00000 0x1 (g723) No Tx: ACK
220 140-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
5019 2dc11a5f44b 00103/00000 0x1 (g723) No Tx: ACK
5018 060513d45d0 00103/00000 0x1 (g723) No Tx: ACK
219 139-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
218 138-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
5017 79d336ce631 00103/00000 0x1 (g723) No Tx: ACK
217 137-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
5016 6fa249a4176 00103/00000 0x1 (g723) No Tx: ACK
5015 3057665759f 00103/00000 0x1 (g723) No Tx: ACK
216 136-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
5014 50eb201d43d 00103/00000 0x1 (g723) No Tx: ACK
5012 345c335336b 00103/00000 0x1 (g723) No Tx: ACK
5009 5c1c4ff4676 00102/00000 0x8 (alaw) No Tx: ACK
5013 7b1c66793e6 00103/00000 0x1 (g723) No Tx: ACK
215 135-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
214 134-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
213 133-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
5010 13c3ded15fa 00102/00000 0x8 (alaw) No Tx: ACK
212 132-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
210 130-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
5008 52738ba5639 00102/00000 0x8 (alaw) No Tx: ACK
5007 73b34ebe571 00102/00000 0x8 (alaw) No Tx: ACK
209 129-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
208 128-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
207 127-6213@10 00101/00001 0x4 (ulaw) No Rx: ACK
5004 33216f4570c 00102/00000 0x8 (alaw) No Init: INVITE
204 124-6213@10 00101/00001 0x4 (ulaw) No Rx: INVITE
5016 5351c4256d9 00102/00000 0x100 (g729) No Init: INVITE
216 116-6213@10 00101/00001 0x4 (ulaw) No Rx: INVITE
5010 0486a95c263 00102/00000 0x8 (alaw) No Init: INVITE
210 110-6213@10 00101/00001 0x4 (ulaw) No Rx: INVITE
5003 682ac0f051c 00102/00000 0x4 (ulaw) No Tx: ACK
203 603-5317@10 00101/00001 0x4 (ulaw) No Rx: ACK
5010 1a1c271f686 00102/00000 0x8 (alaw) No Tx: ACK
210 1970-4169@1 00101/00001 0x4 (ulaw) No Rx: ACK
5004 730f7cad6ec 00102/00000 0x8 (alaw) No Tx: ACK
5020 250f80c353d 00103/00000 0x1 (g723) No Tx: ACK
204 64-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK
Document generated by Confluence on Jan 18, 2010 10:09 Page 7
220 60-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK

5008 4149ce327a3 00102/00000 0x8 (alaw) No Tx: ACK


208 48-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK
5007 2c258b16483 00102/00000 0x8 (alaw) No Tx: ACK
207 47-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK
5019 2879474d21e 00103/00000 0x1 (g723) No Tx: ACK
219 39-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK
5016 4d88cd3b3da 00103/00000 0x1 (g723) No Tx: ACK
216 36-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK
5016 4c4dfd33678 00103/00000 0x1 (g723) No Tx: ACK
216 16-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK
5012 62677ebe23f 00103/00000 0x1 (g723) No Tx: ACK
212 12-4169@10. 00101/00001 0x4 (ulaw) No Rx: ACK
5010 48bafafb513 00102/00000 0x8 (alaw) No Tx: ACK
103 0ef38834747 00103/00000 0x100 (g729) No Tx: INVITE
102 3c267df68e3 00101/00002 0x1 (g723) No Rx: INVITE
103 0ef38834747 00103/00000 0x100 (g729) No Tx: ACK
102 3c267df68e3 00101/00002 0x1 (g723) No Rx: ACK

Вам также может понравиться