asterisk-howto.pdf

(114 KB) Pobierz
howto: isdn phone
<–>
sip routing (sipgate / freenet
iphone)
(software: asterisk, mISDN and festival)
Steffen Buehl
<
asterisk@sbuehl.com
>
v0.82 08.09.2004
the offical version of this document can be obtained from
<http://www.sbuehl.com/projects/asterisk/>
- pdf version is available
here
<http://www.sbuehl.com/projects/asterisk/asterisk-howto.pdf>
1
introduction
during a trip to lloret de mar (in april 2004) i read some stuff about ”pbx4linux” in the german computer
magazine c’t. they explained how to connect a standard isdn phone to a linux box (acting as pbx) running
pbx4linux. unfortunately pbx4linux supports only h.323 connections at this time so i decided to use asterisk
to connect my isdn phone to a sip (german provider ”sipgate”) network.
asterisk is a linux pbx software with a nice plugin interface that allow to use a wide spectrum of
endpoints. e.g. you can route between h.323, sipgate, capi (isdn), mISDN (new isdn interface for kernel 2.6)
etc.. there are also some application plugins for asterisk: festival - a linux text2speech engine - makes your
pbx speaking english mp3player - playback of mp3s stored on your harddisk a cgi-like extensions - called
agi (asterisk gateway interface) - allows you to control asterisk with your favourite scripting language (perl,
php, python, ...). i wrote a small phonebook script to lookup the callerid in a mysql table and display a
custom name on my isdn phone.
my configuration routes between mISDN (HFC-S card with attached isdn phone) and sipgate (multi-
ple accounts). by using different prefixes on the phone i can choose which sipgate account to use, e.g. prefix
1 for hamburg (040), prefix 2 for berlin etc.
to plug a standard isdn phone in a ISDN card you need a 100ohm resistor, a power source and a
crossed isdn cable (standard crossover ethernet doesn’t work). (see
<http://isdn.jolly.de>
). the easiest
solution for this is to use an NT1 (also called NTBA). it contains the needed resistors and supplies power
to your attached isdn phones, additionally you can wire your cable directly to internal pins - so it’s kinda
perfect for this job.
you can configure multiple MSNs on your isdn phone for each sip account (i used the sip-id as MSN) and
therefore a ringtone for each id.
Okay - i got a really cheap fritz!pci isdn card (5 eur) to continue this project... The installation was
pretty easy - just plugged that card into my box and connected it to my isdn s0 bus. I configured asterisk
to dial-out with prefix 0, see example config for more details.
festival isn’t used so far - but it’s easy to extend your configuration with the following command:
<http://www.voip-info.org/wiki-Asterisk+cmd+Festival>
2. installation
2
okay, enough theory, let’s get started...
2
2.1
2.1.1
-
-
-
-
installation
requirements
hardware
NT1 (NTBA)
HFC-S card (see
<http://isdn.jolly.de/cards.html>
ISDN phone
ISDN card (capi/mISDN)
2.1.2
other requirements
- linux (2.6 works, don’t know about 2.4)
2.2
fetching software
asterisk:
<http://www.asterisk.org/>
festival:
<http://www.cstr.ed.ac.uk/projects/festival>
chan misdn:
<http://www.beronet.com/?PageID=3018>
chan capi:
<http://ns1.jnetdns.de/jn/relaunch/asterisk/page1.html>
2.3
compiling
should be easy - just read the docs - maybe i write some documentation for this laster...
2.3.1
2.3.2
2.3.3
2.3.4
2.3.5
asterisk
mISDN
chan misdn
chan capi
festival (text2speech)
<http://www.voip-info.org/wiki-Asterisk+Festival+installation>
with gcc 3.2.2 you have to patch festival and speech tools:
<files/festival-gcc3.3.diff>
<files/speech-tools-gcc3.3.diff>
3. configuration
3
3
3.1
3.2
3.2.1
configuration
mISDN
asterisk
capi.conf
[general]
nationalprefix=
internationalprefix=0
rxgain=0.8
txgain=0.8
[interfaces]
msn=5
incomingmsn=5
controller=1
softdtmf=0
context=in
devices=2
3.2.2
misdn.conf
[general]
context=misdn
; 0 - No Debug
; 1 - mISDN Messages and * - Messages, and * - State changes
; 2 - Messages + Message specific Informations (e.g. bearer capability)
; 3 - very Verbose, the above + lots of Driver specific infos
; 4 - even more Verbose than 3
debug=1
[intern]
ports=2
context=out
3.2.3
extensions.conf
[general]
static=yes
writeprotect=no
[globals]
PHONE=mISDN/2
ISDNOUT=CAPI/5:b
NULL=
#include "macro_dial-result.inc"
[macro-process-call]
3. configuration
4
; ${ARG1} Device
; ${ARG1} MSN
exten => s,1,Ringing
exten => s,2,Wait,2
exten => s,3,agi,directory.agi
exten => s,4,Dial(${ARG1}/${ARG2})
exten => s,5,Hangup
[macro-dialout]
; ${ARG1} CIDNAME
; ${ARG2} Device
; ${ARG3} Num
; ${ARG4} SIP EXT
exten => s,1,SetCIDName(${ARG1})
exten => s,2,Dial(${ARG2}${ARG3}${ARG4},,t)
exten => s,3,Playback(invalid)
exten => s,4,Hangup
[sipgate-in]
exten => <sip-id-1>,1,Macro(process-call,${PHONE},<sip-id-1>)
exten => <sip-id-2>,1,Macro(process-call,${PHONE},<sip-id-2>)
exten => <freenet-id>,1,Macro(process-call,${PHONE},1)
[isdn-in]
exten => 5,1,Macro(process-call,${PHONE},5)
[sipgate-out]
exten => _1.,1,Macro(dialout,<Name ID 1>,SIP/,${EXTEN:1},@<sip-extension-1>)
exten => _2.,1,Macro(dialout,<Name ID 2>,SIP/,${EXTEN:1},@<sip-extension-2>)
exten => _3.,1,Macro(dialout,<Name ID 3>,SIP/,${EXTEN:1},@<sip-freenet-extension>)
[isdn-out]
;ISDN OUT
exten => _0.,1,Macro(dialout,<Name>,${ISDNOUT},${EXTEN},${NULL})
;ISDN-INTERN
exten => _8.,1,Macro(dialout,<Name>,${ISDNOUT},${EXTEN:1},${NULL})
[ip-out]
;IP DIAL
exten =>
exten =>
exten =>
exten =>
exten =>
_9.,1,SetCIDName(<Name>)
_9.,2,AGI(parseExtension.agi)
_9.,3,Dial(SIP/${CNUM}@${CIP},30,tr)
_9.,4,Playback(invalid)
_9.,5,Hangup
[in]
include => sipgate-in
include => isdn-in
exten => t,1,Macro(dial-result)
3. configuration
5
[out]
include => sipgate-out
include => isdn-out
include => ip-out
exten => s,1,Answer
exten => s,2,DigitTimeout,5
exten => s,3,ResponseTimeout,30
exten => i,1,Macro(dial-result,5)
exten => t,1,Macro(dial-result)
exten => T,2,PlayTones(congestion)
exten => T,3,Wait(5)
exten => T,4,Hangup
3.2.4
modules.conf
[modules]
autoload=yes
load => res_musiconhold.so
load => chan_misdn.so
load => chan_capi.so
noload => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
noload => app_intercom.so
noload => chan_modem_i4l.so
noload => chan_modem_bestdata.so
noload => chan_modem_aopen.so
noload => chan_modem.so;
noload => chan_zap.so
noload => chan_alsa.so
noload => chan_oss.so
noload => app_groupcount.so
noload => chan_agent.so
noload => chan_iax.so
noload => app_txtcidname.so
noload => app_controlplayback.so
[global]
chan_capi.so=yes
3.2.5
sip.conf
[general]
port = 5060
bindaddr = 0.0.0.0
localnet = 192.168.0.0
localmask = 255.255.255.0
maxexpirey=3600
defaultexpirey=300
nat=no
disallow=all
allow=alaw
Zgłoś jeśli naruszono regulamin