Step 1
cd /opt/etc/asterisk
cp -p extensions.conf extensions.conf.hold
Step 2
Comment out the following two lines in [demo]:
;exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory
;exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions
Now if you dial your home phone number Asterisk will answer with no messages. When prompted enter 6002 and it will ring your SIP phone.
Step 3
Now let's create a real dialplan that will allow the SPA3102 to answer the phone, ring a single SIP extension and go to voicemail. You will also be able to dial out, but note the example here is for the 604 and 778 area codes which require 10 digit dialing. Adjust for your local scenario.
You will need to create a new extensions.conf file so make double sure you backed up the original one.
Part of this script was borrowed from the slug samples and from
http://swik.net/AsteriskDialplanHere's the new extensions.conf file:
;!
;! Automatically generated configuration file
;! Filename: extensions.conf (/opt/etc/asterisk/extensions.conf)
;! Generator: Manager
;! Creation Date: Mon Dec 17 21:40:38 2007
;!
[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static = yes
;
;
; if stati=yes and writeprotect=no, you can save dialplan by
; CLI command 'save dialplan' too
;
writeprotect = yes
[globals]
PHONE1 = SIP/2203
; These variables are to avoid the irritating problem
; with inability to use regexp's on strings that have
; not been defined.
;
CALLFILENAME = foo
FOO = foo
[macro-stdexten];
;
; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
;
exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHAN
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user in
[macro-failann]
; Failure announcement playback macro:
; ${ARG1} - Status of the call, one of:
; (CHANUNAVAIL | CONGESTION | BUSY | NOANSWER |
; ANSWER | CANCEL | DONTCALL | TORTURE)
;
exten => s,1,Goto(s-${ARG1},1)
exten => s-CHANUNAVAIL,1,Playback(all-circuits-busy-now)
exten => s-CHANUNAVAIL,2,Playback(pls-try-call-later)
exten => s-CHANUNAVAIL,3,Hangup
exten => s-CONGESTION,1,Playback(cannot-complete-temp-error)
exten => s-CONGESTION,2,Playback(pls-try-call-later)
exten => s-BUSY,1,Playback(the-party-you-are-calling)
exten => s-BUSY,2,Playback(is-curntly-busy)
exten => s-BUSY,3,Hangup
exten => s-NOANSWER,1,Playback(the-party-you-are-calling)
exten => s-NOANSWER,2,Playback(is-curntly-unavail)
exten => s-NOANSWER,3,Hangup
exten => s-ANSWER,1,Hangup
exten => _s-.,1,Playback(cannot-complete-network-error)
exten => _s-.,2,Playback(pls-try-call-later)
exten => _s-.,3,Hangup
[pstn-outgoing]
exten => 911,1,Dial(SIP/${EXTEN}@LinksysFXO,,T)
exten => 911,2,Macro(failann,${DIALSTATUS})
exten => _604NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _604NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _778NXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _778NXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _18XXNXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _18XXNXXXXXX,2,Macro(failann,${DIALSTATUS})
[default]
; We start with what to do when a call first comes in.
;
exten => s,1,Wait(1) ; Wait a second, just for fun
exten => s,n,NoOp(CURRENT CALLER ID= ${CALLERID(num)})
exten => s,n,Answer ; Answer the line
exten => s,n,Macro(stdexten,6001,SIP/6001)
exten => 6000,1,VoiceMailMain
include => pstn-outgoing
[asterisk_guitools]
exten = executecommand,1,System(${command})
exten = executecommand,n,Hangup()
exten = record_vmenu,1,Answer
exten = record_vmenu,n,Playback(vm-intro)
exten = record_vmenu,n,Record(${var1})
exten = record_vmenu,n,Playback(vm-saved)
exten = record_vmenu,n,Playback(vm-goodbye)
exten = record_vmenu,n,Hangup
exten = play_file,1,Answer
exten = play_file,n,Playback(${var1})
exten = play_file,n,Hangup
hasbeensetup = Y
Also, please note that this dialplan blocks long distance calls (other than to the 18XX toll free numbers). If you want to have everything go through replace
[pstn-outgoing]
with this code:
[pstn-outgoing]
exten => 911,1,Dial(SIP/${EXTEN}@LinksysFXO,,T)
exten => 911,2,Macro(failann,${DIALSTATUS})
exten => _XXXXXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _XXXXXXXXXX,2,Macro(failann,${DIALSTATUS})
exten => _XXXXXXXXXXX,1,Dial(SIP/${EXTEN}@LinksysFXO,60,T)
exten => _XXXXXXXXXXX,2,Macro(failann,${DIALSTATUS})
No comments:
Post a Comment