; This is the extensions.conf file. It should be placed in the /etc/asterisk directory.
; THIS CONFIGURATION PROVIDES SIP AND IAX2 CONNECTIVITY TO LEGACY
; OR COLLECTIBLE TELEPHONE SYSTEMS.
;
; THIS EXAMPLE FILE ASSUMES A CERTAIN CONFIGURATION, BUT CAN EASILY BE
; MODIFIED TO PROVIDE FOR DIFFERENCES WITH INDIVIDUAL PHONE SWITCHES.
;
; THIS SAMPLE SYSTEM IS CONFIGURED AS FOLLOWS:
; + THE CNET NETWORK HAS NO AREA CODE.
; + THIS TANDEM HAS THE ASSIGNED OFFICE CODE OF 734.
; + 4-DIGIT DIALING TOWARDS ELECTROMECHANICAL PHONE SYSTEM
; + 8-DIGIT DIALING RECEIVED FROM ANALOG SWITCH FOR CNET
; CALL DESTINATIONS IN NORTH AMERICA.
; + COUNTRY CODE + CITY CODE + NUMBER RECEIVED FROM ANALOG
; SWITCH FOR INTERNATIONAL CALL DESTINATIONS ON CNET
;
; ===================================================================
;
; The [general] category is for certain variables.
;
[general]
;
; You can include other config files, use the #include command (without the ';')
; Note that this is different from the include command that includes contexts within
; other contexts. The #include command works in all asterisk configuration files.
; A good use for #include would be to load a file that has your username and
; passwords. That way, you can share your files with others without letting them have
; your account information. Obviously, if you just use your Asterisk to connect
; to others on the private network, you won't even need usernames and passwords.
;
;
;#include "filename.conf"
;
;
; The "Globals" category contains global variables that can be referenced
; in the dialplan with ${VARIABLE} or ${ENV(VARIABLE)} for Environmental variable
; ${${VARIABLE}} or ${text${VARIABLE}} or any hybrid
;
;
[globals]
CNETANI=17340100
CONSOLE=Console/dsp ; Console interface for demo.
MYNAME=Sean Caron ; for CallerID.
;
;
; Any category other than "General" and "Globals" represent
; extension CONTEXTs, which are collections of extensions
; dialing plans, and permissions.
;
; Extension names may be numbers, letters, or combinations
; thereof. If an extension name is prefixed by a '_'
; character, it is interpreted as a pattern rather than a
; literal. In patterns, some characters have special meanings:
;
; X - any digit from 0-9
; Z - any digit from 1-9
; N - any digit from 2-9
; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
; . - wildcard, matches anything remaining (e.g. _9011. matches
; anything starting with 9011 excluding 9011 itself)
;
;
; Macros can be called from other contexts. What they do is perform a certain
; function, and then return to the originating context.
;
[macro-dialswitch]
;
exten => s,1,Dial(SIP/${ARG1}@ypsi-1-core-1)
exten => s,2,Congestion ; If trunk is busy, send fast busy.
;
;
;
[macro-dialcnet] ;version bjc1.01 - asterisk 1.4 and asterisk 1.2
exten => s,1,Set(NUMBER=${ARG1}) ;Store number to be called
exten => s,2,GotoIf($[ ${ARG1:0:1} = "+"]?search) ;Is number prefixed with '+'?
exten => s,3,Set(ARG1=+${ARG1}) ;Prefix number with '+'
exten => s,4(search),Set(ENUM=${ENUMLOOKUP(${ARG1},ALL,,1,std.ckts.info)})
exten => s,5,GotoIf($[${LEN(${ENUM})}=0]?no_uri) ;Is ENUM record found?
exten => s,6,Gotoif(${DB_EXISTS(ELBD/${NUMBER})}?cdata) ;Does backup entry exist?
exten => s,7,Set(DB(ELBD/${NUMBER})=${ENUM}) ;No existing backup so store backup ENUM data
exten => s,8(test),GotoIf($[${ENUM:0:3} = iax ]?iaxuri) ;Yes-IAX2 protocol
exten => s,9,GotoIf($[${ENUM:0:3} = sip ]?sipuri) ;Yes-SIP protocol
exten => s,10,GotoIf($[${ENUM:0:3} = h32 ]?h323uri) ;Yes-H323 protocol
exten => s,11(no_uri),Gotoif(${DB_EXISTS(ELBD/${NUMBER})}?seek) ;ENUM="", is there a backup entry?
exten => s,12,Macro(invalid-office-code,${NUMBER}) ;No valid ENUM and no backup entry
exten => s,13,Wait(5) ;Pause
exten => s,14,Hangup ;Done - failed to make call - Goodbye
exten => s,15(seek),Set(ENUM=${DB_RESULT}) ;Set ENUM to backup base entry
exten => s,16,GotoIf(${REGEX("iax2,sip,h323"${ENUM})}?test) ;If it's a single backup proceed to dial out
exten => s,17,Set(NE=${CUT(ENUM,":",1)}) ;Get backup entry field 1
exten => s,18,Set(LU=${CUT(ENUM,":",2)}) ;Get backup entry field 2
exten => s,19,GotoIf($[${NE}>${LU}]?grec) ;Was last used the last entry in list?
exten => s,20(frec),Set(LU=0) ;Reset entry pointer
exten => s,21(grec),Set(LU=$[${LU}+1]) ;Increment last used pointer
exten => s,22,Set(ENUM=${DB(ELBD/${NUMBER}/${LU})}) ;Read ENUM backup entry
exten => s,23,Set(DB(ELBD/${NUMBER})=${NE}:${LU}) ;Update last used record
exten => s,24,Goto(test) ;Proceed to dial out
exten => s,25(iaxuri),Set(DIALSTR=IAX2/${ENUM:5}) ;IAX2
exten => s,26,Goto(dodial) ;Make call
exten => s,27(sipuri),Set(DIALSTR=SIP/${ENUM:4}) ;SIP
exten => s,28,Goto(dodial) ;Make call
exten => s,29(h323uri),Set(DIALSTR=H323/${ENUM:5}) ;H323
exten => s,30,Macro(invalid,${NUMBER}) ;Make Call
exten => s,31(dodial),NoOp(Outbound Caller ID is ${CALLERID(all)})
exten => s,32,Set(CALLERID(all)=${CNETANI}) ;Set CLID to the defined value
exten => s,33,Dial(${DIALSTR}) ;Dial Out
exten => s,34,Hangup ;Done -call attempted - Goodbye
exten => s,35(cdata),Gotoif($["${DB_RESULT}"="${ENUM}"]?test) ;Does entry have a single backup?
exten => s,36,Set(SR=${DB_RESULT}) ;Backup does not match current
exten => s,37,GotoIf(${REGEX("iax2,sip,h323"${SR})}?shuffle) ;Is more than one backup entry stored?
exten => s,38,Set(NE=${CUT(SR,":",1)}) ;Get backup entry field 1
exten => s,39,Set(LU=${CUT(SR,":",2)}) ;Get backup entry field 2
exten => s,40,Gosub(rent) ;Check multiple backup entries
exten => s,41,Set(DB(ELBD/${NUMBER})=${NE}:${MR}) ;Store no. of entries and match as entry last used
exten => s,42,GotoIf($[${MR}>0]?test) ;If backup exists proceed to dial out
exten => s,43,Set(NE=$[${NE}+1]) ;Increment entries pointer
exten => s,44,Set(DB(ELBD/${NUMBER})=${NE}:${NE}) ;Update entry count and usage
exten => s,45,Set(DB(ELBD/${NUMBER}/${NE})=${ENUM}) ;Store nth backup entry
exten => s,46,Goto(test) ;Nth entry stored - proceed to dial out
exten => s,47(shuffle),Set(DB(ELBD/${NUMBER}/1)=${SR}) ;Move stored entry to backup entry /1
exten => s,48,Set(DB(ELBD/${NUMBER}/2)=${ENUM}) ;Create second backup entry /2
exten => s,49,Set(DB(ELBD/${NUMBER})=2:2) ;Store no. of backup entries & last called
exten => s,50,Goto(test) ;Alternative backup entry stored - proceed to dial out
exten => s,51(rent),Set(i=0) ;Load test counter
exten => s,52,Set(MR=0) ;Load match store
exten => s,53,While($[${i}<${NE}]) ;Check multiple entries for a NUMBER looking for a match
exten => s,54,GotoIf($["${DB(ELBD/${NUMBER}/$[${i}+1])}"="${ENUM}"]?mark) ;Mark entry matching ENUM result
exten => s,55,Set(i=$[${i}+1]) ;Increment counter
exten => s,56,EndWhile ;Look at next entry if one exists
exten => s,57,Return ;Done searching for ENUM result backup record
exten => s,58(mark),Set(MR=$[${i}+1]) ;ENUM result already backed up
exten => s,59,Set(i=${NE}) ;Load counter with no. of last entry
exten => s,60,ContinueWhile ;Stop searching
;
[macro-invalid-office-code]
exten => s,1,Congestion
exten => s,2,Hangup
;
[macro-invalid]
exten => s,1,Congestion
exten => s,2,Hangup
;
[cnet-out]
exten => _1NXXXXXX,1,Macro(dialcnet,${EXTEN})
exten => _1NXXXXXX,2,Congestion
;
exten => _X.,1,Macro(dialcnet,${EXTEN})
exten => _X.,2,Congestion
;
[outbound]
;
include => cnet-out
;
exten => i,1,Macro(invalid)
;
[inbound]
;
; This is where the calls that come in
; from CNET are translated into the
; internal Asterisk extensions that are
; then routed to your electromechanical switch.
;
exten => 17340000,1,Goto(internal,s,1)
; Meridian extensions
exten => 17340100,1,Goto(internal,0100,1)
exten => 17340101,1,Goto(internal,0101,1)
exten => 17340102,1,Goto(internal,0102,1)
; Definity extensions
exten => 17341100,1,Goto(internal,1100,1)
exten => 17341101,1,Goto(internal,1101,1)
exten => 17341102,1,Goto(internal,1102,1)
exten => 17341103,1,Goto(internal,1103,1)
exten => 17341104,1,Goto(internal,1104,1)
exten => _1734XXXX,1,Macro(invalid)
[internal]
exten => s,1,Macro(dialswitch,0100,1)
exten => s,2,Hangup
; 0100 = Meridian frame analog
; 0101 = Meridian frame digital
; 0102 = Meridian milliwatt
exten => 0100,1,Macro(dialswitch,8000)
exten => 0101,1,Macro(dialswitch,7000)
exten => 0102,1,Macro(dialswitch,5000)
; 1100 = Definity frame analog
; 1101 = Definity frame digital
; 1102 = Definity milliwatt + silent term
; 1103 = Definity constant milliwatt
; 1104 = Definity three-tone test
exten => 1100,1,Macro(dialswitch,4000)
exten => 1101,1,Macro(dialswitch,3000)
exten => 1102,1,Macro(dialswitch,5501)
exten => 1103,1,Macro(dialswitch,5502)
exten => 1104,1,Macro(dialswitch,5503)
exten => i,1,Macro(invalid)
exten => h,1,Hangup
exten => t,1,congestion
[c3725]
include => inbound
include => outbound
|