; NATIONAL
exten => _0[1-9]XXX.,1,SetVar(ENUMEXTEN=49${EXTEN:1}) ; I only use german numbers
;exten => _0[1-9]XXX.,2,SetVar(ENUMTELPREFIX=SIP/) ; I want to use my SIP-Provider for dialing tel entries
exten => _0[1-9]XXX.,2,SetVar(ENUMTELPREFIX=) ; I want to use my SIP-Provider for dialing tel entries
exten => _0[1-9]XXX.,3,agi,enumlookup.agi
exten => _0[1-9]XXX.,4,SetVar(EINTRAG=0)
exten => _0[1-9]XXX.,5,GotoIf($[${ENUMENTRIES}]?10:31) ; Look if there are entries
exten => _0[1-9]XXX.,10,SetVar(EINTRAG=$[${EINTRAG} + 1])
exten => _0[1-9]XXX.,11,GotoIf($[$[${ENUMENTRY${EINTRAG}:0:3} = IAX] | $[${ENUMENTRY${EINTRAG}:0:3} = SIP]]?12:21)
exten => _0[1-9]XXX.,12,Dial(${ENUMENTRY${EINTRAG}},30,Ttr)
exten => _0[1-9]XXX.,13,GotoIf($[${EINTRAG} < ${ENUMENTRIES}]?10:31)
; What to do with mailto entries:
exten => _0[1-9]XXX.,21,GotoIf($[${ENUMENTRY${EINTRAG}:0:6} = mailto]?22:30)
exten => _0[1-9]XXX.,22,Playback(vm-nobodyavail)
exten => _0[1-9]XXX.,23,Playback(vm-intro)
exten => _0[1-9]XXX.,24,Playback(beep)
exten => _0[1-9]XXX.,25,Monitor(wav,/tmp/nachricht)
exten => _0[1-9]XXX.,26,MeetMe(20,pqs)
exten => _0[1-9]XXX.,27,System(nail -a /tmp/nachricht-in.wav -s Voicemail ${ENUMENTRY${EINTRAG}:7} < /dev/null)
exten => _0[1-9]XXX.,28,Hangup
exten => _0[1-9]XXX.,30,GotoIf($[${EINTRAG} < ${ENUMENTRIES}]?10:31
exten => _0[1-9]XXX.,31,GotoIf($[${ENUMTELENTRIES}]?32:51)
; What to do with tel entries (is only used if all the other entries fail):
exten => _0[1-9]XXX.,32,SetVar(EINTRAG=0)
exten => _0[1-9]XXX.,33,SetVar((EINTRAG=$[${EINTRAG} + 1])
exten => _0[1-9]XXX.,34,Playback(beep) ; Playing beep means that this call isn't for free
exten => _0[1-9]XXX.,35,Macro(user${CALLERIDNUM})
exten => _0[1-9]XXX.,36,SetCIDNum(${CALLERIDNUM})
exten => _0[1-9]XXX.,37,SetCIDName(${CALLERIDNAME})
exten => _0[1-9]XXX.,38,SetCallerID(${CALLERID})
exten => _0[1-9]XXX.,39,Dial(${MNET}/${MYMSN}:b${ENUMTELENTRY${EINTRAG}},60,Ttr)
;exten => _0[1-9]XXX.,39,Dial(${ENUMTELENTRY${EINTRAG}},30,Ttr)
exten => _0[1-9]XXX.,20,GotoIf($[${EINTRAG} < ${ENUMTELENTRIES}]?33:51)
; If there are no enum entries or if all of them fail:
exten => _0[1-9]XXX.,51,Playback(beep)
exten => _0[1-9]XXX.,52,Macro(call-mnet)
exten => _0[1-9]XXX.,53,Hangup