Do you also know about the PSTN part in the sip.conf file?
Here’s the extension.conf file, so I think it works correctly with the sip.conf:
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
priorityjumping=yes
[globals]
TRUNK=Zap/g2
TIMEOUT=30
MAINPHONE=SIP/103
KEEGAN=SIP/101
KCELL=13122089510
CAREY=SIP/102
CCELL=17732181055
SHARITA=SIP/103
SHARITACELL=1
SHARRY=SIP/104
NORLAKE=18472881990
; This macro dials the extension and goes to voicemail
; when no one picks up or after 22 seconds. If you call your own number from
; your own extension, you go directly to checking voicemail.
[macro-callexten]
; ${MACRO_EXTEN} - Extension
; ${ARG1} - Device(s) to ring
;
exten => s,1,Dial(${ARG1},20,Ttrm) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-NOANSWER,1,Voicemail(u${MACRO_EXTEN}) ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(inbound,s,1) ; If they press #, return to start
exten => s-BUSY,1,Voicemail(b${MACRO_EXTEN}) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(inbound,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(${MACRO_EXTEN}) ; If they press *, send the user into VoicemailMain
; Place a call to the outside. It will try calling the trunk(group 2,
; look in globals.conf) and then indicate congestion if all lines are busy.
[macro-calltrunk]
exten => s,1,Set(CALLERID(all)=Sibley Partners <7733554049>)
exten => s,2,Macro(enumdial,${MACRO_EXTEN})
exten => s,3,Dial(SIP/${MACRO_EXTEN}@viatalk,60)
exten => s,4,Macro(fastbusy)
exten => s,5,Hangup
exten => s,103,Dial(SIP/${MACRO_EXTEN}@viatalk,60)
exten => s,104,Playback(vm-sorry)
[macro-fastbusy]
exten => s,1,Answer
exten => s,2,Wait,1
exten => s,3,Playback(all-circuits-busy-now)
exten => s,4,Wait(30)
exten => s,5,Hangup
[macro-recordprompt]
exten => s,1,Answer
exten => s,2,Wait(2)
exten => s,3,Record(${ARG1}:gsm)
exten => s,4,Wait(2)
exten => s,5,Playback(${ARG1})
exten => s,6,Hangup
;; Enum Macro
[macro-enumdial]
exten => s,1,Set(DIAL_NUMBER=${ARG1})
exten => s,n,Set(E164NETWORKS=e164.arpa-e164.info-e164.org)
exten => s,n,GotoIf($[${DIAL_NUMBER:0:1} = “+”]?begin) ; Skip next line if it already is prefixed by a plus
exten => s,n,Set(DIAL_NUMBER=+${DIAL_NUMBER}) ; Add a plus to the start, becasue ENUMLOOKUP needs it.
; Checking here to see if there are any e164 networks left to check.
exten => s,n(begin),GotoIf($[${LEN(${E164NETWORKS})} < 2]?failed)
; There are, so we take the first one
exten => s,n,Set(ENUMNET=${CUT(E164NETWORKS,1)})
; And trim it from the front of E164NETWORKS
exten => s,n,Set(E164NETWORKS=${CUT(E164NETWORKS,2-)})
; OK, this is now quite complex. To remain compliant, we have to iterate
; through, in order, the returned records. Since we want to make this
; call over the network, we can ignore tel: lines. Even if it’s first
; priority.
exten => s,n,Set(ENUMCOUNT=${ENUMLOOKUP(${DIAL_NUMBER},ALL,c,${ENUMNET})})
; Documentation is wrong. It can return nothing if the enum lookup fails. Grr.
; Now the count may be zero, so if it is, check the next network
exten => s,n,GotoIf($["${ENUMCOUNT}" = “0”]?begin)
exten => s,n,GotoIf($[“x${ENUMCOUNT}” = “x”]?begin)
; Now, let’s start through them.
exten => s,n,Set(ENUMPTR=1)
exten => s,n(startloop),Set(ENUM=${ENUMLOOKUP(${DIAL_NUMBER},ALL,${ENUMPTR},${ENUMNET})})
; Sanity check the return, make sure there’s something in there.
exten => s,n,GotoIf($[${LEN(${ENUM})} = “0”]?continue)
exten => s,n,GotoIf($["${ENUM:0:3}" = “iax”]?iaxuri)
exten => s,n,GotoIf($["${ENUM:0:3}" = “sip”]?sipuri)
; It doesn’t matter if you don’t have h323 enabled, as when it tries to dial, it cares
; about dialstatus and retries if there are any enum results left.
exten => s,n,GotoIf($[${ENUM:0:3} = “h32”]?h323uri)
; If we’re here, it’s not a protocol we know about. Let’s increment the pointer
; and if it’s more than ENUMCOUNT, we know we’ve run out of options. Try the
; next e164 network.
exten => s,n(continue),Set(ENUMPTR=$[${ENUMPTR} + 1])
exten => s,n,GotoIf($[${ENUMPTR} > ${ENUMCOUNT}]?begin)
; OK. If we’re here, we’ve still got some enum entries to go through. Back to
; the start with you!
exten => s,n,Goto(startloop)
; If the prefix is ‘sip:’…
exten => s,n(sipuri),Set(DIALSTR=SIP/${ENUM:4})
exten => s,n,Goto(dodial)
; If it’s IAX2…
exten => s,n(iaxuri),Set(DIALSTR=IAX2/${ENUM:5})
exten => s,n,Goto(dodial)
; Or even if it’s H323.
exten => s,n(h323uri),Set(DIALSTR=H323/${ENUM:5})
exten => s,n(dodial),Dial(${DIALSTR})
exten => s,n,NoOp(Dial exited in macro-enum-dialout with ${DIALSTATUS})
; Now, if we’re still here, that means the Dial failed for some reason.
; If it’s CONGESTION or CHANUNAVAIL we probably want to try again on a
; different channel. However, if it’s the last one, we don’t have any
; left, and I didn’t keep any previous dialstatuses, so hopefully
; someone looking throught the logs would have seen the NoOp’s
exten => s,n,GotoIf($[${ENUMPTR} = ${ENUMCOUNT}]?noneleft)
exten => s,n,GotoIf($[$[${DIALSTATUS} = “CHANUNAVAIL”] | $[${DIALSTATUS} = “CONGESTION”] ]?continue)
; If we’re here, then it’s BUSY or NOANSWER or something and well, deal with it.
exten => s,n(noneleft),Goto(s-${DIALSTATUS},1)
; Here are the exit points for the macro.
exten => s,n(failed),NoOp(EnumLookups failed)
exten => s,n,Goto(end)
exten => s,n(nochans),NoOp(max channels used up)
exten => s,n(end),NoOp(Exiting macro-dialout-enum)
exten => s-BUSY,1,NoOp(Trunk is reporting BUSY)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()
exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS})
; Since all inside lines include this context, they can all call outside local
; and long distance.
[external]
exten => _NXXNXXXXXX,1,Dial(SIP/1${EXTEN}@viatalk,30,r)
exten => _1NXXNXXXXXX,1,Macro(calltrunk)
exten => _011XXXXXXXXXXXX,1,Macro(calltrunk)
; We want the phones to be able to call 911, 311, and 411. To be included
; by the phones context.
[specialnumbers]
exten => 311,1,Dial(Zap/g2) ; Call the non-emergency police on the trunk.
exten => 411,1,Macro(calltrunk) ; Call information on the trunk.
exten => 911,1,Dial(zap/g2) ; Call 911 on the trunk.
; Context to allow the extentions for checking voicemail. Again, will be
; included by the phones context.
[accessvm]
exten => _2XX,1,Wait(1)
exten => _2XX,2,VoicemailMain($[ ${EXTEN} - 100 ])
exten => _2XX,3,Hangup
; All inside phones start off in this context(both SIP and cordless)
; Include the extenions for internal services, for calling out, and for
; special numbers.
[office]
include => specialnumbers
include => default
include => external
; Initial context when a call comes in from the two normal outside lines.
; It will start ringing every phone inside the office and connect if someone
; picks up. If the dial times out(Set by dialing 600 from an inside line),
; it will answer the call and go to the main menu(The same thing as if you had
; dialed 666 from an inside line).
[incoming]
exten => s,1,System(/usr/local/bin/logcid ${CALLERID(num)} “${CALLERID(name)}”)
exten => s,2,Answer
exten => s,3,BackGround(greeting)
exten => s,4,Dial(Zap/1&Zap/2&SIP/800&SIP/801&SIP/803,25,Ttrm)
:exten => s,5,Playback(we-are-slackers)
exten => s,5,Goto(mainmenu,s,1)
; Comment this if you don’t want to check voicemails from the outside…
exten => #,1,Voicemailmain; Prompt for login/password
[inbound-sip]
exten => 17733554049,1,Goto(mainmenu,s,1)
[inbound-zap]
exten => pstn,1,Goto(incoming,s,1)
; Only used so that we can have a context to go into for the call files made
; with the pagepeople script. The call file sets the message variable to be
; the phone number we want to send. It also handles the dialing.
[sendpage]
exten => s,1,Macro(sendpageinfo,${message})
[mainmenu]
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,System(/usr/local/bin/logcid ${CALLERID(num)} “${CALLERID(name)}”)
exten => s,4,PlayBack(thank-you-for-calling)
exten => s,5,BackGround(ext-or-zero)
exten => s,6,BackGround(for)
exten => s,7,BackGround(directory-assistance)
exten => s,8,BackGround(press-9)
exten => s,9,BackGround(mainmenu-prompt)
exten => s,10,Set(TIMEOUT(digit)=5)
exten => s,11,Set(TIMEOUT(response)=10)
exten => s,12,WaitExten
exten => h,1,Hangup
exten => t,1,BackGround(please-try-again)
exten => t,2,Goto(s,6)
exten => T,1,Hangup
exten => i,1,BackGround(please-try-again)
exten => i,2,Goto(s,6)
exten => 9,1,Directory(default)
exten => 1,1,Goto(account,s,1)
exten => 2,1,Goto(missori,s,1)
exten => 3,1,Goto(illinois,s,1)
exten => *,1,VoicemailMain
include => default
[account]
exten => s,1,BackGround(account-prompt)
[missori]
exten => s,1,BackGround(missori-prompt)
exten => 1,1,Goto(internal,124,1)
exten => 2,1,Goto(internal,125,1)
[illinois]
exten => s,1,BackGround(chi-nor-prompt)
exten => 1,1,Goto(internal,120,1)
exten => 2,1,Goto(internal,121,1)
;[mainmenu]
;exten => s,1,BackGround(mainmenu-prompt)
;exten => s,2,Set(TIMEOUT(digit)=5)
;exten => s,3,Set(TIMEOUT(response)=10); Will go to the timeout extension after 10 sec
;exten => s,4,WaitExten
; Emergecy Service
; “A technician will be paged, please leave your message.”
; Dial “503” from an inside line to record this message
exten => 1,1,Playback(emergency-service-vm)
;exten => 1,2,System(/usr/local/bin/pagepeople 804 ${CALLERID(num)} “${CALLERID(name)}”)
;exten => 1,2,Voicemail(u804&810&811&813)
;exten => 1,3,Playback(goodbye)
;exten => 1,4,Hangup
; Non-emergency service
; “Please leave your message, we will respond during normal buisiness hours”
; Dial “504” from an inside line to record this message
;exten => 2,1,Playback(service-vm)
;exten => 2,2,Voicemail(u808)
;exten => 2,3,Playback(goodbye)
;exten => 2,4,Hangup
; Sales
; “Please leave your message, we will have a sales associate return your call”
; Dial “505” from an inside line to record this message
;exten => 3,1,Playback(sales-vm)
;exten => 3,2,Voicemail(u808); Voicemail for sales
;eten => 3,3,Playback(goodbye)
;exten => 3,4,Hangup
; Accounting
; “Please leave your message, we will call you back, yada yada yada”
; Dial “506” from an inside line to record this message
;exten => 4,1,Playback(accounting-vm)
;exten => 4,2,Voicemail(s808); Voicemail for accounting
;exten => 4,3,Playback(goodbye)
;exten => 4,4,Hangup
; This is for all of the full time people’s extensions
;exten => _80[0-3],1,Voicemail(u${EXTEN})
;exten => _80[0-3],2,Playback(goodbye)
;exten => _80[0-3],3,Hangup
; This provides for extensions 804-809 to fake more employees
;exten => _80[4-9],1,Voicemail(u807)
;exten => _80[4-9],2,Playback(goodbye)
;exten => _80[4-9],3,Hangup
; This provides for extensions 810-812 to fake more employees
;exten => _81[0-3],1,Voicemail(u${EXTEN})
;exten => _81[0-3],2,Playback(goodbye)
;exten => _81[0-3],3,Hangup
; Comment this if you don’t want to check voicemails from the outside…
exten => #,1,Voicemailmain; Prompt for login/password
exten => t,1,BackGround(please-try-again)
exten => t,2,Goto(s,1); They are sitting, replay the message
exten => h,1,Hangup
exten => T,1,Hangup
exten => i,1,BackGround(please-try-again)
exten => i,2,Goto(s,1)
exten => 9,1,Goto(s,1); Press 9 to the beginning of this menu.
include => internal
; “Press one for a 20 second timeout, 2 for no timeout.”
; Dial 502 to set this message
[timeoutmenu]
exten => s,1,Background(timeout-prompt)
exten => s,2,Set(TIMEOUT(response)=10); 10 second timout
exten => 1,1,Set(TIMEOUT(digit)=20)
exten => 1,2,SayNumber(20)
exten => 1,3,Playback(seconds)
exten => 1,4,Wait(1)
exten => 1,5,Hangup
exten => 2,1,Set(TIMEOUT(digit)=0)
exten => 2,2,SayNumber(0)
exten => 2,3,Playback(seconds)
exten => 2,4,Wait(1)
exten => 2,5,Hangup
exten => t,1,Goto(s,1); Replay the message
exten => i,1,Goto(s,1); Replay the message
; We want to be able to record these menu prompts.
; This context is included by the phones context, only accessable from an
; inside line.
[recordprompts]
exten => 190,1,Macro(recordprompt,mainmenu-prompt)
exten => 191,1,Macro(recordprompt,missori-prompt)
exten => 192,1,Macro(recordprompt,chi-nor-prompt)
exten => 193,1,Macro(recordprompt,missori-illinois)
exten => 194,1,Macro(recordprompt,acount-prompt)
exten => 195,1,Macro(recordprompt,accounting-vm)
exten => 196,1,Macro(recordprompt,greeting)
exten => 197,1,Macro(recordprompt,we-are-slackers)
; Paste a number grabbed from the cid log into here if you want to block it.
; You can also do patterns if you wanted to block a range of numbers, or such.
exten => s/9734372125,1,Goto(internal,669,1)
exten => s/7133310146,1,Goto(internal,669,1)
exten => s/4108640019,1,Goto(internal,669,1)
; Used for testing out a caller id unit
[fakecall]
exten => s,1,SetCIDName(“John Doe”)
exten => s,2,SetCIDNum(6666666)
exten => s,3,SetCallerId(“John Doe” 6666666)
; Some things insist on checking for the default context, this does NOTHING.
[default]
include => operator
include => internal
include => external
[operator]
exten => 0,1,Macro(callexten,${MAINPHONE})
[internal]
include => external
;; user 1
exten => 101,1,Macro(callexten,${user 1})
;; user 2
exten => 102,1,Macro(callexten,${user 2})
;; user 3
exten => 103,1,Macro(callexten,SIP/103)
;; user 4
exten => 104,1,Macro(callexten,SIP/104)
;; user 5
exten => 105,1,Macro(callexten,SIP/105)
;; user 6
exten => 106,1,Macro(callexten,SIP/106)
;; Zap1
;exten => 804,1,Dial(Zap/1,20,Ttrm); This is for the cordless phone.
;; Zap2
:exten => 805,1,Dial(Zap/2,20,Ttrm); This is for office 2.
exten => 805,2,ADSIProg()
exten => 806,1,Macro(callexten,SIP/806)
;; user 2 Cell
exten => 120,1,Dial(SIP/${CCELL}@viatalk,25,Ttrm)
;; North Lake
exten => 121,1,Dial(SIP/${NORLAKE}@viatalk,25,Ttrm)
;; user 1 Cell
exten => 122,1,Dial(SIP/${KCELL}@viatalk,25,Ttrm)
exten => 666,1,Goto(mainmenu,s,1); If you just want to mess with the menus.
exten => 667,1,Goto(incoming,s,1); If you want to test calling in…
exten => 669,1,Wait(1)
exten => 669,2,Playback(tt-allbusy)
exten => 669,3,Playback(tt-monkeysintro)
exten => 669,4,Playback(tt-monkeys)
exten => 669,5,Playback(tt-somethingwrong)
exten => 669,6,Playback(tt-weasels)
exten => 669,7,Goto(internal,669,1)
exten => 123,1,Dial(IAX2/guest@flauto.dyndns.org/guest,60,r)
exten => 156,1,Goto(timeoutmenu,s,1); Toggle the timeout
include => accessvm; Voicemail checking for inside.
include => recordprompts; Some extensions for recording menu prompts.
;; Meetme
exten => 155,1,Wait(1)
exten => 155,2,MeetMe(|MD)
;; Weather
exten => 153,1,Answer
exten => 153,2,Playback(weather-station)
exten => 153,3,System(/usr/bin/curl -s podcasts.weather.com/common/podcasts/chicago.mp3 > /tmp/chicago.mp3)
exten => 153,4,Wait(1)
exten => 153,5,Playback(/tmp/chicago)
exten => 153,6,System(rm /tmp/chicago.mp3 -f)
exten => 153,7,Hangup
; Music on hold
exten => 152,1,Answer
exten => 152,2,SetMusicOnHold(default)
exten => 152,3,MusicOnHold
; Wakeup
exten => 150,1,agi,/var/lib/asterisk/agi-bin/wakeup/wakeup.php
exten => 150,2,Hangup
exten => 151,1,agi,/var/lib/asterisk/agi-bin/wakeup/wakeup.1.30/wakeup.php
exten => 151,2,Hangup