This is more just more to show little how I have configured my Asterisk set up and slimmed it down to use the minimal modules needed.
My Needs
– SIP calls between my IP phone and Softphone
– Incoming/Outgoing calls through a SIP Provider
– Echo test to make sure audio is working
– Music On Hold (moh)
– Date and Time
Hardware Setup
– 12V fanless Mini ITX @ 533MHz (VIA Samuel 2) & 512MB RAM
– 10/100 Switch + WiFi AP
– Nortel 2002 IP Phone (NTDU91)
– Softphones
Not needed conf files have been moved to backup/ directory
ls -lh /etc/asterisk/
-rw-r----- 1 asterisk asterisk 3.2K Feb 16 01:21 asterisk.adsi
-rw-r----- 1 asterisk asterisk 247 Feb 16 00:50 asterisk.conf
drwxr-xr-x 2 asterisk asterisk 4.0K Feb 16 01:19 backup
-rw-r----- 1 asterisk asterisk 13K Feb 16 01:21 extensions.ael
-rw-r----- 1 asterisk asterisk 935 Feb 16 15:12 extensions.conf
-rw-r----- 1 asterisk asterisk 5.3K Feb 16 01:21 extensions.lua
-rw-r----- 1 asterisk asterisk 5.2K Feb 16 00:57 features.conf
-rw-r----- 1 asterisk asterisk 25K Feb 16 13:38 indications.conf
-rw-r----- 1 asterisk asterisk 2.2K Feb 16 00:57 logger.conf
-rw-r----- 1 asterisk asterisk 363 Feb 16 15:18 manager.conf
drwxr-xr-x 2 asterisk asterisk 4.0K Jan 24 19:43 manager.d
-rw-r----- 1 asterisk asterisk 807 Feb 16 14:51 modules.conf
-rw-r----- 1 asterisk asterisk 2.8K Feb 16 22:48 musiconhold.conf
-rw-r----- 1 asterisk asterisk 496 Feb 16 00:55 rtp.conf
-rw-r----- 1 asterisk asterisk 1.1K Feb 16 14:37 sip.conf
-rw-r----- 1 asterisk asterisk 4.9K Feb 16 23:15 unistim.conf
/etc/asterisk/modules.conf
[modules]
autoload=no ; only load explicitely declared modules
load => app_echo.so ; echo application
load => codec_ulaw.so ; ulaw codec for voice
load => codec_gsm.so
load => pbx_config.so ; reading and loading configuration
load => chan_sip.so ; SIP protocol
load => chan_unistim ; IP Phone Nortel
load => app_dial.so ; Dial application
; Say date and time
load => app_sayunixtime.so
; Music On Hold
load => format_gsm.so
load => res_musiconhold.so
[global]
Note: the order the Music On Hold modules are loaded, the format before the resource.
/etc/asterisk/extensions.conf
[from-trunk]
; Incoming calls from [sip-provider] to Asterisk are directed to the extension
; 101 the IP Phone
exten => [sip-provider],1,Dial(USTM/101@i2002,30)
exten => [sip-provider],2,Congestion
exten => [sip-provider],102,Busy
[to-trunk]
; Send all outbound calls with prefix 9 via [sip-provider]. Strip the prefix 9
; before sending call to [sip-provider] SIP proxy
exten => _9.,1,Dial(SIP/${EXTEN:1}@[sip-provider],30)
exten => _9.,2,Congestion
exten => _9.,102,Busy
[apps]
; echo test
exten => 600,1,Answer()
exten => 600,n,Wait(1)
exten => 600,n,Echo
; Answer required as Music On Hold does not answer the call for testing
exten => 601,1,Answer
exten => 601,2,MusicOnHold()
; Say date and time
exten => 602,1,Answer
exten => 602,2,SayUnixTime()
[local]
exten => _1XX,1,Dial(SIP/${EXTEN},30)
exten => _1XX,2,Congestion
exten => _1XX,102,Busy
[default]
include => apps
include => local
include => from-trunk
include => to-trunk
/etc/asterisk/sip.conf
; This section is how we are logging into our VoIP provider
[general]
register=account:password@sip00.mynetfone.com.au/account
; This section is how outbound calls are handle to our
; VoIP provider and the codecs we want to use etc.
[MyNetFone]
username=account
type=friend
secret=password
qualify=yes
pedantic=no
nat=yes
insecure=port,invite
host=sip00.mynetfone.com.au
fromdomain=sip00.mynetfone.com.au
port=5060
fromuser=account
dtmfmode=rfc2833
disallow=all
canreinvite=no
authname=account
allow=g729
; This section is for how we connect to our VoIP provider for
; inbound calls.
[MyNetFone-In]
username=account
type=friend
secret=password
qualify=no
insecure=port,invite
host=sip00.mynetfone.com.au
fromuser=account
context=from-trunk
canreinvite=no
[102]
defaultuser=102
type=friend
context=default
qualify=yes
secret=secret
host=dynamic
dtmfmode=rfc2833
call-limit=2
nat=yes
canreinvite=no
disallow=all
allow=gsm
callerid="Laptop" <102>
[103]
defaultuser=103
type=friend
context=default
qualify=yes
secret=secret
host=dynamic
dtmfmode=rfc2833
call-limit=2
nat=yes
canreinvite=no
disallow=all
allow=gsm
callerid="HTC Desire" <103>
/etc/asterisk/unistim.conf
;
; chan_unistim configuration file.
;
[general]
port=5000 ; UDP port
;
; See qos.tex or Quality of Service section of asterisk.pdf for a description of these parameters.
;tos=cs3 ; Sets TOS for signaling packets.
;tos_audio=ef ; Sets TOS for RTP audio packets.
;cos=3 ; Sets 802.1p priority for signaling packets.
;cos_audio=5 ; Sets 802.1p priority for RTP audio packets.
;
;keepalive=120 ; in seconds, default = 120
;public_ip= ; if asterisk is behind a nat, specify your public IP
;autoprovisioning=no ; Allow undeclared phones to register an extension. See README for important
; informations. no (default), yes, tn.
autoprovisioning=yes
qualify=yes
;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
; SIP channel. Defaults to "no". An enabled jitterbuffer will
; be used only if the sending side can create and the receiving
; side can not accept jitter. The SIP channel can accept jitter,
; thus a jitterbuffer on the receive SIP side will be used only
; if it is forced and enabled.
; jbforce = no ; Forces the use of a jitterbuffer on the receive side of a SIP
; channel. Defaults to "no".
; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
; resynchronized. Useful to improve the quality of the voice, with
; big jumps in/broken timestamps, usually sent from exotic devices
; and programs. Defaults to 1000.
; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP
; channel. Two implementations are currently available - "fixed"
; (with size always equals to jbmaxsize) and "adaptive" (with
; variable size, actually the new jb of IAX2). Defaults to fixed.
; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
;-----------------------------------------------------------------------------------
[i2002] ; name of the device
device=001122aabbcc ; mac address of the phone
rtp_port=10000 ; RTP port used by the phone, default = 10000. RTCP = rtp_port+1
rtp_method=3 ; If you don't have sound, you can try 1, 2 or 3, default = 0
status_method=0 ; If you don't see status text, try 1, default = 0
titledefault=Asterisk ; default = "TimeZone (your time zone)". 12 characters max
;maintext0="you can insert" ; default = "Welcome", 24 characters max
;maintext1="a custom text" ; default = the name of the device, 24 characters max
;maintext2="(main page)" ; default = the public IP of the phone, 24 characters max
dateformat=1 ; 0 = month/day, 1 (default) = day/month
timeformat=2 ; 0 = 0:00am ; 1 (default) = 0h00, 2 = 0:00
contrast=5 ; define the contrast of the LCD. From 0 to 15. Default = 8
country=au ; country (ccTLD) for dial tone frequency. See README, default = us
ringvolume=3 ; ring volume : 0,1,2,3, can be overrided by Dial(), default = 2
ringstyle=2 ; ring style : 0 to 7, can be overrided by Dial(), default = 3
callhistory=1 ; 0 = disable, 1 = enable call history, default = 1
callerid="Nortel IP Phone" <101>
context=default ; context, default="default"
mailbox=101 ; Specify the mailbox number. Used by Message Waiting Indication
linelabel="101" ; Softkey label for the next line=> entry, 9 char max.
extension=line ; Add an extension into the dialplan. Only valid in context specified previously.
; none=don't add (default), ask=prompt user, line=use the line number
line => 100 ; Only one line by device is currently supported.
; Beware ! only bookmark and softkey entries are allowed after line=>
bookmark=3@VoiceMail.@9121 ; Use a softkey to dial 123. Name : 9 char max
bookmark=Time@602 ; 54 shows a mailbox icon. See #define FAV_ICON_ for other values (32 to 63)
;bookmark=Test@*@USTM/violet ; Display an icon if violet is connected (dynamic), only for unistim device
bookmark=4@Acc. Bal.@9151 ; Display a pager icon and dial 54321 when softkey 4 is pressed
And the rest of the conf files are basically default configuration
> module show
Module Description Use Count
app_echo.so Simple Echo Application 0
codec_ulaw.so mu-Law Coder/Decoder 0
codec_gsm.so GSM Coder/Decoder 0
pbx_config.so Text Extension Configuration 0
chan_sip.so Session Initiation Protocol (SIP) 0
chan_unistim.so UNISTIM Protocol (USTM) 0
app_dial.so Dialing Application 0
app_sayunixtime.so Say time 0
format_gsm.so Raw GSM data 0
res_musiconhold.so Music On Hold Resource 0
10 modules loaded
> core show applications
-= Registered Asterisk Applications =-
Answer: Answer a channel if ringing.
BackGround: Play an audio file while waiting for digits of an extension to go to.
Bridge: Bridge two channels.
Busy: Indicate the Busy condition.
Congestion: Indicate the Congestion condition.
DateTime: Says a specified time in a custom format.
Dial: Attempt to connect to another device or endpoint and bridge the call.
Echo: Echo audio, video, DTMF back to the calling party
ExecIfTime: Conditional application execution based on the current time.
Goto: Jump to a particular priority, extension, or context.
GotoIf: Conditional goto.
GotoIfTime: Conditional Goto based on the current time.
Hangup: Hang up the calling channel.
ImportVar: Import a variable from a channel into a new variable.
Incomplete: Returns AST_PBX_INCOMPLETE value.
MSet: Set channel variable(s) or function value(s).
MusicOnHold: Play Music On Hold indefinitely
NoOp: Do Nothing (No Operation).
Park: Park yourself.
ParkedCall: Answer a parked call.
Proceeding: Indicate proceeding.
Progress: Indicate progress.
RaiseException: Handle an exceptional condition.
ResetCDR: Resets the Call Data Record.
RetryDial: Place a call, retrying on failure allowing an optional exit extension.
Ringing: Indicate ringing tone.
SayAlpha: Say Alpha.
SayDigits: Say Digits.
SayNumber: Say Number.
SayPhonetic: Say Phonetic.
SayUnixTime: Says a specified time in a custom format.
Set: Set channel variable or function value.
SetAMAFlags: Set the AMA Flags.
SetMusicOnHold: Set default Music On Hold class
SIPAddHeader: Add a SIP header to the outbound call.
SIPDtmfMode: Change the dtmfmode for a SIP call.
SIPRemoveHeader: Remove SIP headers previously added with SIPAddHeader
StartMusicOnHold: Play Music On Hold
StopMusicOnHold: Stop Playing Music On Hold
Wait: Waits for some time.
WaitExten: Waits for an extension to be entered.
WaitMusicOnHold: Wait, playing Music On Hold
-= 42 Applications Registered =-
> core show functions
Installed Custom Functions:
--------------------------------------------------------------------------------
CHECKSIPDOMAIN CHECKSIPDOMAIN(domain) Checks if domain is a local domain.
EXCEPTION EXCEPTION(field) Retrieve the details of the current dialplan exception.
SIP_HEADER SIP_HEADER(name[,number]) Gets the specified SIP header.
SIPCHANINFO SIPCHANINFO(item) Gets the specified SIP parameter from the current channel.
SIPPEER SIPPEER(peername[,item]) Gets SIP peer information.
5 custom functions installed.
Hopefully this is little help to get started with your own Asterisk setup 🙂
Reference:
http://www.voip-info.org/wiki/view/Asterisk+Slimming
23:47, Sunday, February 20, 2011Scott /
Just curious, are you using this to connect to nodephone ?
0:43, Monday, February 21, 2011Dale /
No. I am not, but it would not be that hard to alter for NodePhone though.