(gdb) bt full
#0  0x00002b4da522f485 in waitpid () from /lib/libc.so.6
No symbol table info available.
#1  0x0000000000433cb7 in ?? ()
No symbol table info available.
#2  0x00000000004359ce in wait_for ()
No symbol table info available.
#3  0x00000000004293a4 in execute_command_internal ()
No symbol table info available.
#4  0x0000000000429289 in execute_command_internal ()
No symbol table info available.
#5  0x000000000042748f in execute_command ()
No symbol table info available.
#6  0x00000000004285d8 in execute_command_internal ()
No symbol table info available.
#7  0x000000000042748f in execute_command ()
No symbol table info available.
#8  0x0000000000429261 in execute_command_internal ()
No symbol table info available.
#9  0x000000000042748f in execute_command ()
No symbol table info available.
#10 0x0000000000429261 in execute_command_internal ()
No symbol table info available.
#11 0x000000000042748f in execute_command ()
No symbol table info available.
#12 0x0000000000429261 in execute_command_internal ()
No symbol table info available.
#13 0x000000000042748f in execute_command ()
No symbol table info available.
#14 0x0000000000429261 in execute_command_internal ()
No symbol table info available.
#15 0x000000000042748f in execute_command ()
No symbol table info available.
#16 0x0000000000429261 in execute_command_internal ()
No symbol table info available.
#17 0x000000000042748f in execute_command ()
No symbol table info available.
#18 0x0000000000427529 in ?? ()
No symbol table info available.
#19 0x00000000004285f7 in execute_command_internal ()
No symbol table info available.
#20 0x000000000042887b in execute_command_internal ()
No symbol table info available.
#21 0x0000000000429989 in ?? ()
No symbol table info available.
#22 0x0000000000429bc7 in ?? ()
No symbol table info available.
#23 0x000000000042a27a in ?? ()
No symbol table info available.
#24 0x0000000000428673 in execute_command_internal ()
No symbol table info available.
#25 0x00000000004292fa in execute_command_internal ()
No symbol table info available.
#26 0x000000000042748f in execute_command ()
No symbol table info available.
#27 0x000000000041ab12 in reader_loop ()
No symbol table info available.
#28 0x000000000041a728 in main ()
No symbol table info available.
(gdb) bt
#0  0x00002b4da522f485 in waitpid () from /lib/libc.so.6
#1  0x0000000000433cb7 in ?? ()
#2  0x00000000004359ce in wait_for ()
#3  0x00000000004293a4 in execute_command_internal ()
#4  0x0000000000429289 in execute_command_internal ()
#5  0x000000000042748f in execute_command ()
#6  0x00000000004285d8 in execute_command_internal ()
#7  0x000000000042748f in execute_command ()
#8  0x0000000000429261 in execute_command_internal ()
#9  0x000000000042748f in execute_command ()
#10 0x0000000000429261 in execute_command_internal ()
#11 0x000000000042748f in execute_command ()
#12 0x0000000000429261 in execute_command_internal ()
#13 0x000000000042748f in execute_command ()
#14 0x0000000000429261 in execute_command_internal ()
#15 0x000000000042748f in execute_command ()
#16 0x0000000000429261 in execute_command_internal ()
#17 0x000000000042748f in execute_command ()
#18 0x0000000000427529 in ?? ()
#19 0x00000000004285f7 in execute_command_internal ()
#20 0x000000000042887b in execute_command_internal ()
#21 0x0000000000429989 in ?? ()
#22 0x0000000000429bc7 in ?? ()
#23 0x000000000042a27a in ?? ()
#24 0x0000000000428673 in execute_command_internal ()
#25 0x00000000004292fa in execute_command_internal ()
#26 0x000000000042748f in execute_command ()
#27 0x000000000041ab12 in reader_loop ()
#28 0x000000000041a728 in main ()
(gdb) quit


[general]
context=inbound			; Default context for incoming calls
;allowguest=no			; Allow or reject guest calls (default is yes)
allowoverlap=no			; Disable overlap dialing support. (Default is yes)
;allowtransfer=no		; Disable all transfers (unless enabled in peers or users)
				; Default is enabled
;realm=mydomain.tld		; Realm for digest authentication
				; defaults to "asterisk". If you set a system name in
				; asterisk.conf, it defaults to that system name
				; Realms MUST be globally unique according to RFC 3261
				; Set this to your host name or domain name
bindport=5060			; UDP Port to bind to (SIP standard port is 5060)
				; bindport is the local UDP port that Asterisk will listen on
bindaddr=0.0.0.0		; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes			
				
disallow=all			; First disallow all codecs
allow=ulaw			; Allow codecs in order of preference

register => foo:bar@asterlink.com/biz

externhost=foo.gotdns.com	; Alternatively you can specify an 
				; external host, and Asterisk will 
				; perform DNS queries periodically.  Not
				; recommended for production 
				; environments!  Use externip instead
externrefresh=10		; How often to refresh externhost if 
				; used
				; You may add multiple local networks.  A reasonable 
				; set of defaults are:
localnet=10.0.0.0/255.0.0.0	; Also RFC1918

nat=no				; Global NAT settings  (Affects all peers and users)
                                ; yes = Always ignore info and assume NAT
                                ; no = Use NAT mode only according to RFC3581 (;rport)
                                ; never = Never attempt NAT mode or RFC3581 support
				; route = Assume NAT, don't send rport 
				; (work around more UNIDEN bugs)

[asterlink]
type=friend
username=blah	
fromuser=blah
fromdomain=asterlink.com
host=asterlink.com
secret=blah
nat = yes
sendrpid = yes
disallow=all
canreinvite=no
allow=ulaw,g726,gsm
context=inbound
insecure=very

[Carmen]
type=friend
username
secret=blah
host=dynamic
context=outbound
callerid=Carmen <101>
disallow=all ; better for custom-tunning codec selection
allow=ulaw
allow=gsm
subscribemwi=yes
subscribecontext=outbound	; Only allow SUBSCRIBE for local extensions
dtfmode=rfc2833 ; inband is not supported in compressed codecs like gsm, so we better set it t$
canreinvite=no ; canreinvite must be set to 'no'
mailbox=0,101
call-limit=5				; permit only 5 simultaneous outgoing calls to this peer
nat=no
qualify=yes

[Aron]
mailbox=100
type=friend
username=Aron
secret=blah
host=dynamic
context=outbound
subscribecontext=outbound	; Only allow SUBSCRIBE for local extensions
subscribemwi=yes
callerid=Aron <100>
disallow=all ; better for custom-tunning codec selection
allow=ulaw
allow=gsm
dtfmode=rfc2833 ; inband is not supported in compressed codecs like gsm, so we better set it t$
canreinvite=no ; canreinvite must be set to 'no'
call-limit=5				; permit only 5 simultaneous outgoing calls to this peer
nat=no
qualify=yes

[Register]
type=friend
username=Register
secret=blah
host=dynamic
context=outbound
subscribecontext=outbound	; Only allow SUBSCRIBE for local extensions
subscribemwi=no
callerid=Register <102>
disallow=all ; better for custom-tunning codec selection
allow=ulaw
allow=gsm
dtfmode=rfc2833 ; inband is not supported in compressed codecs like gsm, so we better set it t$
canreinvite=no ; canreinvite must be set to 'no'
call-limit=5				; permit only 5 simultaneous outgoing calls to this peer
nat=no
qualify=yes

[Maria]
mailbox=109
type=friend
username=Maria
secret=blah
host=dynamic
context=outbound
subscribecontext=outbound	; Only allow SUBSCRIBE for local extensions
subscribemwi=yes
callerid=Maria <109>
disallow=all ; better for custom-tunning codec selection
allow=ulaw
allow=gsm
dtfmode=rfc2833 ; inband is not supported in compressed codecs like gsm, so we better set it t$
canreinvite=no ; canreinvite must be set to 'no'
call-limit=5				; permit only 5 simultaneous outgoing calls to this peer
nat=no
qualify=yes





[general]
;#include <local_extensions.conf>

[globals]
ARON=SIP/Aron
CARMEN=SIP/Carmen
CARLOS=SIP/Register
MARIA=SIP/Maria
BRIAN=SIP/RemoteBrian
CLAUDIA=IAX2/Claudia
JUANITA=IAX2/Juanita
FILOMENA=IAX2/Filomena
BE=IAX2/Be
WALTER=IAX2/Walter
VOIPOUT1=IAX2/voicepulse01
VOIPOUT2=IAX2/voicepulse02
VOIPOUT3=SIP/asterlink

;VOIPOUT=iax2/RabinGlove@nufone

;VOIPOUT=proxy01.sipphone.com
POTSOUT=ZAP/g1

[inbound]
exten=> 8882717336,1,goto(open,s,1) ;use toll free for failover

; First, let's do the holidays
include => holiday|*|*|1|jan
include => holiday|*|*|28|may
include => holiday|*|*|4|jul
include => holiday|*|*|4|sep
include => holiday|*|*|23|nov
include => holiday|*|*|25|dec
include => holiday|*|*|31|dec

; these are the days we're open
include => open|06:20-18:45|mon-fri|*|*
include => open|06:20-13:45|sat|*|*

; if we're not open, we're closed (duh!)
include => closed
 


[open]
exten => s,1,Answer
exten => s,n,wait(1)
exten => s,n,Dial(zap/1&zap/2&sip/carmen&sip/aron&sip/maria&sip/register&sip/RemoteBrian,25)
exten => s,n,voicemail(b0)
exten => s,n,hangup

[holiday]
exten => s,1,Answer
exten => s,n,wait(1)
exten => s,n(dial),Dial(zap/1&zap/2&zap/3&sip/carmen&sip/aron&sip/maria&sip/register&sip/RemoteBrian,3)
exten => s,n,voicemail(u00)
exten => s,n,hangup

[closed]
exten => s,1,Answer
exten => s,n,wait(1)
exten => s,n(dial),Dial(zap/1&zap/2&zap/3&sip/carmen&sip/aron&sip/maria&sip/register&sip/RemoteBrian,3)
exten => s,n,voicemail(u0)
exten => s,n,hangup

[outbound]
exten => asterisk,1,VoiceMailMain("${CALLERIDNUM}") 

;test incoming
;exten=> 1640,1,goto(open,s,1)
;mess with the hog (or someone)
exten => 812016180234,1,setcallerid(<9734651640>) ;his mom (sara)
exten => 812016180234,2,dial(iax2/voicepulse01/${EXTEN:1},60)

;hints
exten => 100,hint,SIP/Aron
exten => 101,hint,SIP/Carmen
exten => 102,hint,SIP/Carlos
exten => 103,hint,SIP/Register
exten => 108,hint,SIP/RemoteBrian
exten => 109,hint,SIP/Maria

exten => 701,1,ParkedCall(701) 
exten => 701,hint,park:701@parkedcalls 
exten => 702,1,ParkedCall(702) 
exten => 702,hint,park:702@parkedcalls
exten => 703,1,ParkedCall(703) 
exten => 703,hint,park:703@parkedcalls


'lines'
exten => 00,1,goto(700,1)
exten => 01,1,goto(701,1)
exten => 02,1,goto(702,1)
exten => 03,1,goto(703,1)

include => emergency
include => parkedcalls
include => inside
include => local
include => toll


[notoll]
include => emergency
include => parkedcalls
include => inside
include => local

[internal]
include => emergency
include => parkedcalls
include => inside


[toll]
;Force use of POTS with "9" prefix, w/ or w/o "1" prefix
exten => _91NXXNXXXXXX,1,Dial(${POTSOUT}/ww${EXTEN:1},60)
exten => _91NXXNXXXXXX,2,hangup
exten => _9NXXNXXXXXX,1,Dial(${POTSOUT}/ww${EXTEN:1},60)
exten => _9NXXNXXXXXX,2,hangup

exten => _1NXXNXXXXXX,1,macro(voip_call,${EXTEN})
exten => _NXXNXXXXXX,1,macro(voip_call,1${EXTEN})
exten => _81NXXNXXXXXX,1,macro(voip_call,${EXTEN:1})
exten => _8NXXNXXXXXX,1,macro(voip_call,1${EXTEN:1})

exten => _71NXXNXXXXXX,1,set(CALLERID(num)=9734651640)
exten => _71NXXNXXXXXX,n,dial(${VOIPOUT3}/${EXTEN:1})
exten => _7NXXNXXXXXX,1,dial(${VOIPOUT3}/1${EXTEN:1})
exten => _71NXXNXXXXXX,1,dial(${VOIPOUT3}/${EXTEN:1})
exten => _7NXXNXXXXXX,1,dial(${VOIPOUT3}/1${EXTEN:1})


[inside]
;Internal Extensions
exten => 0,1,Dial(zap/G2,60)
exten => 00,1,Dial(SIP/Carmen&SIP/Aron&SIP/Carlos&SIP/Maria&SIP/Register,60)

exten => 100,1,macro(internal_extension,100,${ARON})
exten => 101,1,macro(internal_extension,101,${CARMEN})
exten => 102,1,macro(internal_extension,102,${CARLOS})
exten => 103,1,macro(internal_extension,103,sip/Register)
exten => 104,1,macro(internal_extension,104,zap/1)
exten => 105,1,macro(internal_extension,105,zap/2)
exten => 106,1,macro(internal_extension,106,zap/3)

exten => 109,1,macro(internal_extension,109,${MARIA})
exten => 108,1,macro(internal_extension,108,${BRIAN})

exten => 999,1,dial(zap/4) ;the horn
exten => 999,n,hangup

exten => _*10[0-9],1,voicemail(b${EXTEN:1})
exten => _**10[0-9],1,voicemail(u${EXTEN:2})
exten => *0,1,voicemail(b${EXTEN:1})
exten => **0,1,voicemail(u${EXTEN:2})
exten => *00,1,voicemail(b${EXTEN:1})
exten => **00,1,voicemail(u${EXTEN:2})

exten => 199,1,answer 
exten => 199,n,wait(2)
exten => 199,n,Set(CALLERID(name)=M-${CALLERIDNAME})
exten => 199,n,sipaddheader("Alert-Info:<http://www.notused.com>\;info=alert-external\;x-line-id=0") ;DISTINCT RING
exten => 199,n,dial(sip/maria&sip/carmen&sip/remotebrian,15)
exten => 199,n,voicemail(u109) 

;snom PAGE
exten => _910[0-9],1,SIPAddHeader(Call-Info:<sip:domain>\;answer-after=0)
exten => _910[0-9],n,goto(inside,${EXTEN:1},1)
exten => _910[0-9],n,hangup


;MeetMe
exten=> _50X,1,meetme(${EXTEN})

;MM Extensions
exten => _*31XX,1,Dial(${FILOMENA}/*${EXTEN:2})
exten => _*31XX,2,hangup
exten => _31XX,1,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=3]?9${EXTEN},1)
exten => _31XX,n,set(CALLERID(num)=4${CALLERID(num)})
exten => _31XX,n,Dial(IAX2/Filomena/${EXTEN:1})
exten => _31XX,n,hangup
exten => 300,1,Dial(${FILOMENA}/${EXTEN:2})
exten => 300,2,hangup
exten => _35000,1,Dial(IAX2/Filomena/5000)
exten => _35000,2,hangup
exten => _931XX,1,set(CALLERID(num)=4${CALLERID(num)})
exten => _931XX,n,Dial(IAX2/Filomena/9${EXTEN:2})
exten => _931XX,n,hangup

;Meiga Extensions
exten => _*61XX,1,Dial(${JUANITA}/*${EXTEN:2})
exten => _*61XX,2,hangup
exten => _61XX,1,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=3]?9${EXTEN},1)
exten => _61XX,n,set(CALLERID(num)=4${CALLERID(num)})
exten => _61XX,n,Dial(IAX2/Juanita/${EXTEN:1})
exten => _61XX,n,hangup
exten => 600,1,Dial(${JUANITA}/${EXTEN:2})
exten => 600,2,hangup
exten => _65000,1,Dial(IAX2/Juanita/5000)
exten => _65000,2,hangup
exten => _961XX,1,set(CALLERID(num)=4${CALLERID(num)})
exten => _961XX,n,Dial(IAX2/Juanita/9${EXTEN:2})
exten => _961XX,n,hangup

;Boutique Extensions
;exten => _7[*1]X.,1,Dial(${WALTER}/${EXTEN:1})
;exten => _7[*1]X.,2,hangup
;exten => 700,1,Dial(${WALTER}/${EXTEN:2})
;exten => 700,2,hangup
;exten => _75000,1,Dial(IAX2/Walter/5000)
;exten => _75000,2,hangup
;exten => _691XX,1,Dial(IAX2/Walter/${EXTEN:1})
;exten => _691XX,n,hangup

;Voicemail System
exten => 5000,1,answer()
exten => 5000,2,voicemailmain()
exten => 5000,3,hangup() 

exten => 900,1,goto(func,s,1)

[func] ;I have the func
exten => s,1,Answer
exten => s,n,Background(func_instruct) ;for away vm, 2 for busy vm, 3 to page
exten => s,n,Set(TIMEOUT(response)=15)
exten => s,n,Set(TIMEOUT(digit)=3)
 
exten => _[123],1,Set(DB(FLAGS/${CALLERID(num)})=${EXTEN}) ;set db vals and hangup so some channels get dialtone ASAP
exten => _[123],n,hangup

[macro-pots_call]
exten => s,1,dial(${POTSOUT}/${ARG1},60)
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status 
exten => s-CHANUNAVAIL,1,playback(tt-somethingwrong)
exten => s-CHANUNAVAIL,2,wait(5)
exten => s-CHANUNAVAIL,3,macro(voip_call,${ARG1})
exten => s.,1,hangup

[macro-voip_call]
exten => s,1,set(CALLERID(num)=9734651640)
exten => s,n,set(PROV_COUNT=1)
exten => s,n(start),dial(${VOIPOUT${PROV_COUNT}}/${ARG1},60)
exten => s,n,Goto(s-${DIALSTATUS},1) ; Jump based on status 
exten => s-CHANUNAVAIL,1,set(PROV_COUNT=$[${PROV_COUNT}+1])
exten => s-CHANUNAVAIL,n,gotoif($[${PROV_COUNT}<4]?s,start)
exten => s-CHANUNAVAIL,playback(please-hold)
exten => s-CHANUNAVAIL,n,macro(pots_call,${ARG1})
exten => s.,1,hangup

[macro-internal_extension]
; Based on 'Standard Extension' macro
; ${ARG1} - Voicemail box 
; ${ARG2} - Device extension(s) to ring 
; Usage
; in main context do exten => 1000,1,Macro(insternal_extension,1000,SIP/SnomDesk) 
; I use variables defined in the globals section so it becomes 
 
exten => s,1,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=1]?s-NOANSWER,1) ; if flag set call VM
exten => s,n,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=2]?s-BUSY,1)     ; do same but lie and say busy
exten => s,n,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=3]?s-PAGE,1)     ; page the guy, or just dial the interface as per usual
exten => s,n(dial),Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,n,Goto(s-${DIALSTATUS},1) ; Jump based on status 
 
exten => s-BUSY,1,Set(DB(FLAGS/${CALLERID(num)})=0)
exten => s-BUSY,n,Voicemail(b${ARG1}) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,n,Hangup
 
exten => s-NOANSWER,1,Set(DB(FLAGS/${CALLERID(num)})=0)
exten => s-NOANSWER,n,Voicemail(u${ARG1}) ; If unavailable, send to voicemail w/ unavail
exten => s-NOANSWER,n,Hangup
 
exten => s-PAGE,1,Set(DB(FLAGS/${CALLERID(num)})=0)
exten => s-PAGE,n,SIPAddHeader(Call-Info:<sip:domain>\;answer-after=0) ;substitute YOUR hardware's SDP page value
exten => s-PAGE,n,goto(s,dial)
 
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer

[emergency]
exten => 911,1,chanisavail(zap/G1)
exten => 911,2,dial(zap/G1/ww911)
exten => 911,102,wait(2)
exten => 911,103,dial(zap/G1/ww911)
exten => 911,204,dial(${VOIPOUT}/ww19733667111) ; non-emergency is the next best thing
exten => 911,305,goto(emergency,911,1)





