Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;--------------------------------------------------------------------------------;
- ; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
- ; this file must be done via the web gui. There are alternative files to make ;
- ; custom modifications. ;
- ;--------------------------------------------------------------------------------;
- ;*******************************************************************************
- ; AUTO-GENERATED AND CUSTOM USER DIALPLAN INCLUDED HERE *
- ;*******************************************************************************
- ;--------------------------------------------------------------------------------;
- ; Customizations to this dialplan should be made in extensions_custom.conf
- ; See extensions_custom.conf.sample for an example.
- ;
- ; If you need to use [macro-dialout-trunk-predial-hook], [ext-did-custom], or
- ; [from-internal-custom] for example, place these in this file or they will get overwritten.
- ;
- ; WARNING ABOUT: #include extensions_override_freepbx.conf
- ;
- ; This include file is put first to allow the auto-generated dialplan in FreePBX
- ; to be overwritten if necessary. Overriding auto-generated dialplan should be done
- ; with extreme caution. In almost all cases any custom dialplan SHOULD be put in
- ; extensions_custom.conf which will not hurt a FreePBX generated dialplan. In some
- ; very rare and custom situations users may have a need to override what FreePBX
- ; automatically generates. If so anything in this file will do that. If you come up
- ; with situations where you need to modify the existing dialplan or macros, put it
- ; here.
- ;
- #include extensions_override_freepbx.conf
- #include extensions_additional.conf
- #include extensions_custom.conf
- ;--------------------------------------------------------------------------------;
- ;*******************************************************************************
- ; DIALPLAN OPEN TO THE PUBLIC, USING INBOUND DIDS AND SIMILAR *
- ;*******************************************************************************
- ;
- ;-------------------------------------------------------------------------------
- ; from-digital:
- ;
- ; Context to set for PRI's and equivalent
- ;
- [from-digital]
- include => from-pstn
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-analog:
- ;
- ; Context to set for analog DAHDi cards and equivalent
- ;
- [from-analog]
- include => from-dahdi
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-trunk:
- ;
- ; Context is really just an alias of from-pstn
- ;
- [from-trunk]
- include => from-pstn
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-pstn:
- ;
- ; Entry context for calls from the outside world to hit FreePBX
- [from-pstn]
- include => from-pstn-custom ; this context include remains for legacy reasons, but should not be used.
- include => ext-did
- include => ext-did-post-custom
- include => from-did-direct
- include => ext-did-catchall ; THIS MUST COME AFTER ext-did
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-pstn-e164-us:
- ;
- ; The context is designed for providers who send calls in e164 format and is
- ; biased towards NPA calls, callerid and dialing rules. It will do the following:
- ;
- ; DIDs in an NPA e164 format of +1NXXNXXXXXX will be converted to 10 digit DIDs
- ;
- ; DIDs in any other format will be delivered as they are, including e164 non NPA
- ; DIDs which means they will need the full format including the + in the inbound
- ; route.
- ;
- ; CallerID(number) presented in e164 NPA format will be trimmed to a 10 digit CID
- ;
- ; CallerID(number) presented in e164 non-NPA (country code other than 1) will be
- ; reformated from: +<CountryCode><Number> to 011<CountryCode><Number>
- ;
- [from-pstn-e164-us]
- exten => _+1NXXNXXXXXX/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
- exten => _+1NXXNXXXXXX/_NXXNXXXXXX,2,Goto(from-pstn,${EXTEN:2},1)
- exten => _+1NXXNXXXXXX/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
- exten => _+1NXXNXXXXXX/_011NX.,n,Goto(from-pstn,${EXTEN:2},1)
- exten => _+1NXXNXXXXXX,1,Goto(from-pstn,${EXTEN:2},1)
- exten => _[0-9+]./_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
- exten => _[0-9+]./_1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):1})
- exten => _[0-9+]./_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
- exten => _[0-9+]./_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
- exten => _[0-9+]./_011NX.,n,Goto(from-pstn,${EXTEN},1)
- exten => _[0-9+].,1,Goto(from-pstn,${EXTEN},1)
- exten => s/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
- exten => s/_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
- exten => s/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
- exten => s/_011NX.,n,Goto(from-pstn,${EXTEN},1)
- exten => s,1,Goto(from-pstn,${EXTEN},1)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-pstn-toheader
- ;
- ; The context is designed for providers who send the DID in the TO: SIP header
- ; only. The format of this header is:
- ;
- ; To: <sip:2125551212@172.31.74.25>
- ;
- ; So the DID must be extracted between the sip: and the @, which this does
- ;
- [from-pstn-toheader]
- exten => _.,1,NoOp(Attempting to extract DID from SIP To header)
- exten => _.,n,gotoif($["${CHANNEL(channeltype)}"="SIP"]?SIP)
- exten => _.,n,gotoif($["${CHANNEL(channeltype)}"="PJSIP"]?PJSIP)
- exten => _.,n,NoOp(Unable to determine SIP channel type)
- exten => _.,n,goto(from-pstn,${EXTEN},1))
- exten => _.,n(SIP),Goto(from-pstn,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
- exten => _.,n(PJSIP),Goto(from-pstn,${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)},1)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; trust-pai-as-cid:
- ;
- ; Calling this function will set Asterisks CallerID for this call to be what
- ; was provided in the P-Asserted-Identity header.
- ;
- [trust-pai-as-cid]
- exten => s,1,Set(CHANTYPE=${CHANNEL(channeltype)})
- exten => s,n,GotoIf($[ "${CHANTYPE}" = "SIP" ]?chansip,1)
- exten => s,n,GotoIf($[ "${CHANTYPE}" = "PJSIP" ]?pjsip,1)
- ; We can only handle SIP and PJSIP
- exten => s,n,Return()
- exten => chansip,1,Set(PAI=${SIP_HEADER(P-Asserted-Identity)})
- exten => chansip,n,Goto(setcid,1)
- exten => pjsip,1,Set(PAI=${PJSIP_HEADER(read,P-Asserted-Identity)})
- exten => pjsip,n,Goto(setcid,1)
- exten => setcid,1,ExecIf($[ ${LEN(${PAI})} = 0 ]?Return())
- exten => setcid,n,Set(NAME=${CUT(PAI,<,1))})
- exten => setcid,n,Set(CALLERID(name)=${STRREPLACE(NAME,\")})
- exten => setcid,n,NoOp(${NAME})
- exten => setcid,n,Set(SIPURI=${CUT(PAI,<,2-)})
- exten => setcid,n,Set(TYPE=${CUT(SIPURI,\@,1)})
- exten => setcid,n,Set(CALLERID(num)=${CUT(TYPE,:,2-)})
- exten => setcid,n,Return()
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-trunk-pai:
- ;
- ; This is a replacement for from-trunk that sets the incoming Caller ID
- ; to be that provided in the P-Asserted-Identity header.
- ;
- [from-trunk-pai]
- exten => _.,1,NoOp(Attempting to extract Caller ID from PAI Header)
- exten => _.,n,Gosub(trust-pai-as-cid,s,1)
- exten => _.,n,Goto(from-trunk,${EXTEN},1)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-sip-external
- ;
- ; This context is the default SIP context unless otherwise changed in the SIP
- ; Settings module or other sip configuration locations. This context is hit by
- ; either anonymous SIP calls or mis-configured SIP trunks when the incoming call
- ; can not be matched with a SIP section.
- ;
- [from-sip-external]
- exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
- exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
- exten => _.,n,Goto(s,1)
- exten => s,1,GotoIf($["${SIPLANG}"!=""]?setlanguage:checkanon)
- exten => s,n(setlanguage),Set(CHANNEL(language)=${SIPLANG})
- exten => s,n(checkanon),GotoIf($["${ALLOW_SIP_ANON}"!="yes"]?noanonymous)
- exten => s,n,Goto(from-trunk,${DID},1)
- exten => s,n(noanonymous),Set(TIMEOUT(absolute)=15)
- exten => s,n,Set(receveip=${IF($["${CUT(CHANNEL,/,1)}" != "PJSIP"]?recvip:pjsip,remote_addr)})
- exten => s,n,Log(WARNING,"Rejecting unknown SIP connection from ${CHANNEL(${receveip})}")
- exten => s,n,Answer
- exten => s,n,Wait(2)
- exten => s,n,Playback(ss-noservice)
- exten => s,n,Playtones(congestion)
- exten => s,n,Congestion(5)
- exten => h,1,Hangup
- exten => i,1,Hangup
- exten => t,1,Hangup
- ;-------------------------------------------------------------------------------
- ;*******************************************************************************
- ; INTERNAL DIALPLAN, NOT OPEN TO THE PUBLIC WORLD *
- ;*******************************************************************************
- ;
- ;-------------------------------------------------------------------------------
- ; from-internal:
- ;
- ; Internal dialplan that most internal phones have access to
- ;
- [from-internal]
- include => from-internal-noxfer
- include => from-internal-xfer
- include => bad-number ; auto-generated
- exten => h,1,Macro(hangupcall)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-internal-noxfer:
- ;
- ; Place to put internal dialplan that should not be accessible during a blind
- ; transfer, this context will not be visible during such.
- ;
- [from-internal-noxfer]
- include => from-internal-noxfer-custom
- include => from-internal-noxfer-additional ; auto-generated
- exten => h,1,Macro(hangupcall)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; from-internal-xfer:
- ;
- ; Place to put most internal dialplan, will be visible during normal calls and
- ; blind transfers.
- ;
- [from-internal-xfer]
- include => from-internal-custom
- include => from-internal-additional ; auto-generated
- exten => h,1,Macro(hangupcall)
- ;-------------------------------------------------------------------------------
- ;*******************************************************************************
- ; INTERNAL MACROS & SPECIAL CONTEXTS *
- ;*******************************************************************************
- ;
- ;-------------------------------------------------------------------------------
- ; from-did-direct:
- ;
- ; forces ext-findmefollow to take precedence over ext-local. Also exposed to
- ; the public side to allow an extension number to be used as an external DID
- ; without requiring inbound routes to be created, common in many PRI installations
- ; where the last 4 digits are used as the extnension and DIDs are delivered in
- ; 4 digit formats.
- ;
- [from-did-direct]
- include => ext-findmefollow
- include => ext-local
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-dial has been converted into a function.
- ; see core/functions.inc/macro-dial.php
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-get-vmcontext:
- ;
- ; returns the user's voicemail context
- ;
- [macro-get-vmcontext]
- exten => s,1,Set(VMCONTEXT=${DB(AMPUSER/${ARG1}/voicemail)})
- exten => s,2,GotoIf($["foo${VMCONTEXT}" = "foo"]?200:300)
- exten => s,200,Set(VMCONTEXT=default)
- exten => s,300,NoOp()
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-outisbusy:
- ;
- ; Moved to extensions_additional
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-dialout-trunk-predial-hook:
- ;
- ; this macro intentionally left blank so it may be safely overwritten for any custom
- ; requirements that an installation may have.
- ;
- ; the macro is called by macro-dialout-trunk just prior to making a Dial() attempt
- ; to a trunk.
- ;
- ; MACRO RETURN CODE: ${PREDIAL_HOOK_RET}
- ; if set to "BYPASS" then this trunk will be skipped
- ;
- ;
- [macro-dialout-trunk-predial-hook]
- exten => s,1,MacroExit()
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-dialout-one-predial-hook
- ;
- ; this macro intentionally left blank so it may be safely overwritten for any custom
- ; requirements that an installation may have.
- ;
- ; the macro is called by macro-dialout-trunk just prior to making a Dial() attempt
- ; to an individual extension.
- ;
- [macro-dialout-one-predial-hook]
- exten => s,1,MacroExit()
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-dial-hunt-predial-hook
- ;
- ; this macro intentionally left blank so it may be safely overwritten for any custom
- ; requirements that an installation may have.
- ;
- ; the macro is called by macro-dial just prior to making a Dial() attempt
- ; to an individual extension.
- ;
- [macro-dial-hunt-predial-hook]
- exten => s,1,MacroExit()
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-dial-ringall-predial-hook
- ;
- ; this macro intentionally left blank so it may be safely overwritten for any custom
- ; requirements that an installation may have.
- ;
- ; the macro is called by macro-dial just prior to making a Dial() attempt
- ; to a dial string full of extensions.
- ;
- [macro-dial-ringall-predial-hook]
- exten => s,1,MacroExit()
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-dialout-dundi-predial-hook:
- ;
- ; this macro intentionally left blank so it may be safely overwritten for any custom
- ; requirements that an installation may have.
- ;
- ; the macro is called by macro-dialout-dundi just prior to making a Dial() attempt
- ; to a trunk.
- ;
- ; MACRO RETURN CODE: ${PREDIAL_HOOK_RET}
- ; if set to "BYPASS" then this trunk will be skipped
- ;
- ;
- [macro-dialout-dundi-predial-hook]
- exten => s,1,MacroExit()
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; default
- ;
- ; FreePBX does not use the default context. This context is used by asterisk when
- ; it has no other information provided and needs to deliver a call. Hitting this means
- ; there has been some sort of configuration error, or a potential bug somehwere.
- ; This context can be reached from either internal or external sources.
- ;
- [default]
- exten => _.,1,Playback(vm-goodbye)
- exten => _.,n,Noop(ERROR: FreePBX Does not use the [default] context, confguration error)
- exten => _.,n,Macro(hangupcall)
- ;-------------------------------------------------------------------------------
- ;*******************************************************************************
- ; DEPRECATED DIALPLAN - THESE WILL BE REMOVED, NOT USED BY FREEPBX *
- ;*******************************************************************************
- ;
- ;-------------------------------------------------------------------------------
- ; macro-fixcid: [DEPRECATED]
- ;
- ; For some reason, if I don't run setCIDname, CALLERID(name) will be blank in my AGI
- ;
- [macro-fixcid]
- exten => s,1,Set(CALLERID(name)=${CALLERID(name)})
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-sayXXXX: [DEPRECATED]
- ;
- ; Text-To-Speech related macros
- ; These all follow common actions. First try to playback a file "tts/custom-md5"
- ; where "md5" is the md5() of whatever is going to be played. If that doesn't exist,
- ; try to playback using macro-tts-sayXXXXX (where XXXXX is text/digits/etc, same as
- ; the macro below). If that macro exits with MACRO_OFFSET=100, then it's done,
- ; otherwise, fallback to the default asterisk method.
- ;
- ;-------------------------------------------------------------------------------
- ; macro-saytext: [DEPRECATED]
- ;
- ; say text is purely for text-to-speech, there is no fallback
- ;
- [macro-saytext]
- exten => s,1,Noop(Trying custom SayText playback for "${ARG1}")
- exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
- exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
- ; call tts-saytext. This should set MACRO_OFFSET=101 if it was successful
- exten => s,n(tts),Macro(tts-saytext,${ARG1},${ARG2},${ARG3})
- exten => s,n,Noop(No text-to-speech handler for SayText, cannot say "${ARG1}")
- exten => s,n,Goto(done)
- exten => s,tts+101,Noop(tts handled saytext)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-sayname: [DEPRECATED]
- ;
- ; say name is for saying names typically, but fallsback to using SayAlpha
- ; (saying the word letter-by-letter)
- ;
- [macro-sayname]
- exten => s,1,Noop(Trying custom SayName playback for "${ARG1}")
- exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
- exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
- ; call tts-sayalpha. This should set MACRO_OFFSET=101 if it was successful
- exten => s,n(tts),Macro(tts-sayalpha,${ARG1},${ARG2},${ARG3})
- exten => s,n,SayAlpha(${ARG1})
- exten => s,n,Goto(done)
- exten => s,tts+101,Noop(tts handled sayname)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-saynumber: [DEPRECATED]
- ;
- ; Say number is for saying numbers (eg "one thousand forty six")
- ;
- [macro-saynumber]
- exten => s,1,Noop(Trying custom SayNumber playback for "${ARG1}")
- exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
- exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
- ; call tts-saynumber. This should set MACRO_OFFSET=101 if it was successful
- exten => s,n(tts),Macro(tts-saynumber,${ARG1},${ARG2},${ARG3})
- exten => s,n,SayNumber(${ARG1})
- exten => s,n,Goto(done)
- exten => s,tts+101,Noop(tts handled saynumber)
- ;-------------------------------------------------------------------------------
- ;-------------------------------------------------------------------------------
- ; macro-saydigits: [DEPRECATED]
- ;
- ; Say digits is for saying digits one-by-one (eg, "one zero four six")
- ;
- [macro-saydigits]
- exten => s,1,Noop(Trying custom SayDigits playback for "${ARG1}")
- exten => s,n,Playback(tts/custom-${MD5(${ARG1})})
- exten => s,n,GotoIf($["${PLAYBACKSTATUS}"="SUCCESS"]?done)
- ; call tts-saydigits. This should set MACRO_OFFSET=101 if it was successful
- exten => s,n(tts),Macro(tts-saydigits,${ARG1},${ARG2},${ARG3})
- exten => s,n,SayDigits(${ARG1})
- exten => s,n,Goto(done)
- ;-------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement