Chapter 3. Installing and Configuring Asterisk
If you want to configure and make Asterisk you will need to install dahdi-linux first, then dahdi-tools. Dahdi is needed to run telephony conference.
Installing Dahdi-linux
The required version of dahdi-linux is 2.0.0, which you can download here:
http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.digium.co...
Do the following:
- Copy Dahdi-linux files to /usr/src/dahdi-linux
- In the directory /usr/src/dahdi-linux/ type make in the command line. Press Enter.
- Type make install in the command line. Press Enter.
Installing Dahdi-tools
The required version of dahdi-tools is 2.0.0, which you can download here:
http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.digium.co...
Do the following:
- Copy Dahdi-tools files to /usr/src/dahdi-tools
- Go to the /usr/src/dahdi-tools/ directory and type ./configure in the command line. Press Enter
- Type make in the command line. Press Enter.
- Type make install in the command line. Press Enter.
Installing Asterisk
The required version of Asterisk is 1.6.0.1, which you can download here:
Do the following:
- Copy Asterisk files to /usr/src/asterisk.
- In configuration file /usr/src/asterisk/include/asterisk/channel.h, set the value AST MAX EXTENSION equal to 256.
- Go to /usr/src/asterisk/ directory and type ./configure in the command line. Press Enter
- To initiate the building process type make in the command line. Press Enter.
- After building is completed, type make install. Press Enter.
- Type make samples in the command line. Press Enter.
Installing AMD (Answering Machine Detector)
AMD is an optional Asterisk application, enabling the system to detect answering machines on response.
Do the following:
- Download to /etc/asterisk amd.conf
- Execute 'dos2unix amd.conf'
- Execute 'vi amd.conf' and change [AnsweringMachineDetector] to [amd]
- Download to /usr/src/asterisk/apps app_amd2.c
- Execute 'mv app_amd2.c app_amd.c'
- Execute 'dos2unix app_amd.c'
- In your /usr/src/asterisk/apps directory, edit Makefile by adding asterisk modul “app_amd.so” after the list of other moduls which are after “APPS=”
- Go back to your /usr/src/asterisk directory. Execute “make” and then “make install”.
Adding Configuration Files
Do the following:
- Copy extensions.conf, iax.conf and sip.conf files to your /etc/asterisk directory.
- Execute ‘dos2unix’ to each one.
Now you are ready to configure these files with respect to your personal settings.
Editing Configuration Files
There are several files copied to your /etc/asterisk directory. The following describes how to configure each one.
- amd.conf
In this file nothing has to be changed. This file describes parameters needed for answering machine detection.
- sip.conf
The first section of the configuration file describes general SIP configuration parameters. Nothing needs to be changed there.
- extensions.conf
- iax.conf
[general]
context=default
allowguest=yes
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
disallow=all
allow=ulaw
allow=alaw
promiscredir=yes
canreinvite=no
dtmfmode=rfc2833
nat=yes
musiconhold=none
; Mininum roundtrip time for messages to monitored hosts
t1min=1000
The second section of the configuration file describes parameters for DID-gateway. Sometimes, a SIP-provider requires registration; that is why there is a long direct DID-number (e.g. 6786081290 – in the template file).
; format: register => user[:secret[:authuser]]@host[:port][/extension]
; sample
register => 6786081290@sip-truck.starpoundtech.net:9000/6786081290
The next section contains parameters needed for outgoing calls. Required information is username, host and port. Please note that this section is needed only if Asterisk server is used for SIP trunking to PSTN.
[sip-outbound]
type=peer
username=[username]
host=[hostname]
port=[port]
fromdomain=[domain_name]
canreinvite=no
insecure=very
qualify=no
nat=yes
context=pstn-in
The last outline is needed for the loop connection of the Border Controller (Asterisk) and SER. In this outline, you need to set your IP instead of
[trunk-ser]
type=peer
host=[Kamailio_IP] nat=yes
canreinvite=nov
;
configuration for using Asterisk as a SIP Server
; redirect calls back to Kamailio
exten => _frm_ser.,1,Set(from=${SIP_HEADER(From)})
exten => _frm_ser.,2,SIPAddHeader(SPFrom: ${from})
exten => _frm_ser.,3,Set(to=${SIP_HEADER(To)})
exten => _frm_ser.,4,SIPAddHeader(SPTo: ${to})
exten => _frm_ser.,5,Set(callId=${SIP_HEADER(Call-ID)})
exten => _frm_ser.,6,SIPAddHeader(SPCallId: ${callId})
exten => _frm_ser.,7,Dial(SIP/frm_sbc${EXTEN:7}@trunk-ser,60,r)
exten => _frm_ser.,108,Hangup()
exten => _frm_ser.,8,Hangup()
; launching media queues
; format: ${EXTEN}@[Application_server_IP]:[Application_server_SIP_port]
exten => lmtt,1,Dial(SIP/${EXTEN}@172.26.10.39)
exten => lmtt,102,Hangup()DID Gateway configuration. This is specified within the Outbound Calls outline. Set the peer name the same as in sip.conf.
; outbound calls
; sample
exten => _9.,1,Set(LIMIT_PLAYAUDIO_CALLEE=yes
) exten => _9.,2,Dial(SIP/${EXTEN:1}@voice-ring-6786081290,60,rL(180000:20000))
exten => _9.,3,Hangup()
exten => _9.,103,Hangup()
AMD configuration. This is specified within the Outbound Calls with Answering machine detection outline. Nothing has to be changed there.
; outbound calls with Answering Machine Detection
exten => _amd.,1,Set(LIMIT_PLAYAUDIO_CALLEE=yes)
exten => _amd.,2,Dial(SIP/${EXTEN:3}@voice-ring-6786081290,60,rM(amd)L(180000:20000))
exten => _amd.,3,Hangup()
exten => _amd.,103,Hangup()
Media Server configuration. While using StarPound 1.1.0 RC2 ., you might need more than one media queue. This is set in the Processing Media Queue outline. Use the default queue as a template: character “_” specifies a mask, character “X” means “any digit 0-9”.
Note: after changing any configuration files, you need to restart Asterisk to proceed.
; processing media queues
exten => _pmq.,1,Answer
exten => _pmq.,n,SetMusicOnHold(default)
exten => _pmq.,n,MusicOnHold()
; playback media file
exten => playmedia,1,Answer
exten => playmedia,n,Set(MUSICFILE=${SIP_HEADER(SPMusicFile)})
exten => playmedia,n,Playback(${MUSICFILE})
exten => playmedia,n,Wait(999)
; enter conference
exten => conference,1,Answer
exten => conference,n,Set(CONFID=${SIP_HEADER(SPConfIdHeader)})
exten => conference,n,Meetme(${CONFID}|qd)
; enter conference (listen only mode)
exten => listenIn,1,Answer
exten => listenIn,n,Set(CONFID=${SIP_HEADER(SPConfIdHeader)})
exten => listenIn,n,Meetme(${CONFID}|qdm)
; music on hold extension
exten => hold,1,Answer
exten => hold,n,SetMusicOnHold(default)
exten => hold,n,MusicOnHold()
; ringing extension
exten => ringing,1,Answer
exten => ringing,n,Playtones(ring)
exten => ringing,n,Wait(${MAX_TIMEOUT})
exten => ringing,n,HangUp()
; dtmf extension
exten => dtmf,1,Answer
exten => dtmf,n,Set(digits=${SIP_HEADER(SPDigitsHeader)})
exten => dtmf,n,SIPDtmfMode(rfc2833)
exten => dtmf,n,SendDTMF(${digits})
exten => dtmf,n,Hangup()
; whisper
exten => whisper,1,Answer
exten => whisper,2,Set(filename=${SIP_HEADER(SPFilenameHeader)})
exten => whisper,3,Playback(${filename},j)
exten => whisper,4,Hangup()
exten => whisper,104,Wait(1)
exten => whisper,105,Hangup()
; record
exten => record,1,Answer
exten => record,n,Set(filename=${SIP_HEADER(SPFilenameHeader)})
exten => record,n,Set(callBackNumber=${SIP_HEADER(SPCallBackHeader)})
exten => record,n,Monitor(wav,/var/lib/asterisk/sounds/recorded/${filename},m)
exten => record,n,Dial(${callBackNumber})
exten => record,n,Hangup()
; simple ivr extension
exten => ivr,1,Answer
exten => ivr,n,Set(ip=${SIP_HEADER(SPAppServerIp)})
exten => ivr,n,Set(port=${SIP_HEADER(SPAgiPort)})
exten => ivr,n,Set(callId=${SIP_HEADER(SPCallId)})
exten => ivr,n,AGI(agi://${ip}:${port}/hello.agi?callId=${callId})
Click2Talk configuration. This is specified in the last configuration outline. Nothing has to be changed there; however, you need to set some parameters in iax.conf.
; click2talk configuartion
; click2talk extension, format: collab?[Launching_media_queue]?[Application_server_IP]?[Application_server_port]?[Custom_params]
exten => _collab?.?.?.,1,Set(launch=${CUT(EXTEN,?,2)})
exten => _collab?.?.?.,n,Set(ip=${CUT(EXTEN,?,3)})
exten => _collab?.?.?.,n,Set(port=${CUT(EXTEN,?,4)})
exten => _collab?.?.?.,n,Set(params=${CUT(EXTEN,?,5)})
exten => _collab?.?.?.,n,SIPAddHeader(SPParameters: ${params})
exten => _collab?.?.?.,n,Dial(SIP/${launch}@${ip}:${port})
AMD macros. Nothing has to be changed there.
[macro-amd]
exten => s,1,AMD
exten => s,n,GotoIf($[${AMDSTATUS}=AMD_PERSON]?humn:mach)
;exten => s,n(mach),WaitForSilence(500)
exten => s,n(mach),SetVar(MACRO_RESULT=ABORT)
;exten => s,n(humn),WaitForSilence(500)
exten => s,n(humn),NoOp
This file configures Click2Talk feature. You will need to set your IP and port within General IAX Configuration outline. You can create users in IAX Users outline, using the default configuration as a template.
