Advanced Configuration of Asterisk CLI

In my last post I had shown you some very basic configuration steps of Asterisk. Now I will show you Asterisk configuration including pattern matching context.
 

Configuring SIP accounts

# cd /etc/asterisk
# vi sip.conf
[1000]
deny=0.0.0.0/0.0.0.0
secret=1000
dtmfmode=rfc2833
canreinvite=no
context=intercalling
host=dynamic
type=friend
nat=no
port=5060
qualify=yes
qualifyfreq=60
transport=udp
encryption=no
callgroup=
pickupgroup=
dial=SIP/1000
permit=0.0.0.0/0.0.0.0
[1001]
deny=0.0.0.0/0.0.0.0
secret=1001
dtmfmode=rfc2833
canreinvite=no
context=intercalling
host=dynamic
trustrpid=yes
sendrpid=no
type=friend
nat=no
port=5060
qualify=no
qualifyfreq=60
transport=udp
encryption=no
callgroup=
pickupgroup=
dial=SIP/1001
permit=0.0.0.0/0.0.0.0

type — type of connection (peer — outcoming calls only, user — incoming calls, friend — both incoming and outcoming calls)
context — context in /etc/asterisk/extension.conf that will be applied when a number is dialed
secret — password for a SIP phone
host — phone host name (dynamic host name)
nat — network address translation
qualify — setting it to YES will automaticly send OPTIONS packet after every 2000msec to the endpoint
canreinvite — reinvite policy for this device
callgroup — call group number where this device is a part of
pickupgroup — This device can pickup calls from any group. Device doesnot have to be in any group to pickup calls
dtmfmode=auto — dtmf mode (auto|inband|info|rfc2833)
disallow=all — disallows all codecs
allow=g722 — allows using codec g722
deny - IP address range where the access has to be denied
permit - IP address range to allow access from the client machine
 

Configuring Dial plan extensions

# vi extensions.conf
[general]
static=yes
writeprotect=no
clearglobalvars=no
[default]
include => intercalling
 [intercalling]
; If nobody picks up within 30 seconds, the call is sent to  voicemail
; If the extension is busy, the call is sent to voicemail
exten => _100X,1,Set(TARGETNO=${EXTEN})
exten => _100X,n,Dial(SIP/${EXTEN},30)
; routes the call to the status priority (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => _100X,n,Goto(s-${DIALSTATUS},1)
; Person at extension "is unavailable" message
exten => s-NOANSWER,1,VoiceMail(${TARGETNO},u)
; Person at extension "is busy" message
exten => s-BUSY,1,VoiceMail(${TARGETNO},b)
; To be safe, clean up the call after an answer by hanging up exten => s-ANSWER,1,Hangup()
; Handle any unhandled status the same way we handle NOANSWER exten => _s-.,1,Goto(s-NOANSWER,1)

 

For detailed information on all the used syntax above please follow this link
The Asterisk Book
 
Let me know your success and failures.