; 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 999. ; + TWO-DIGIT DIALING TOWARDS ELECTROMECHANICAL PHONE SYSTEM ; + SEVEN DIGITS RECEIVED FROM ANALOG SWITCH FOR ; CALLS OUTBOUND ON THE PRIVATE NETWORK ; ; =================================================================== ; ; 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=9990000 ; CONSOLE=Console/dsp ; Console interface for demo. MYNAME=DOAKES JOE ; for CallerID. TRUNK=Zap/g1 ; Trunk interface (TK GP 1). TRUNKMSD=1 ; ; ; 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(ZAP/g1/${ARG1},360) ; Dial extension on zaptel trk grp 1. exten => s,2,Macro(fastbusy) ; If trunk is busy, send 'all circuits ; are busy now' message. ; ; [macro-dialcnet] ; ; [macro-dialcnet] ; ; Collectors' Network ; exten => s,1,NoOp(Entering macro-dialcnet context) exten => s,2,NoOp(Beginning ENUM Lookup) exten => s,3,ENUMLOOKUP(${ARG1}) exten => s,4,GotoIf($[$[${ENUM:0:3} = IAX] | $[${ENUM:0:3} = SIP]]?5:6) ; The line above says 'If there are any IAX or SIP entries, ; go to step 5. Otherwise, go to step 6. exten => s,5,Dial(${ENUM}) exten => s,6,System(test "${DIALSTATUS}" = "UNAVAIL") ; After dialing, check to see if the status returned is UNAVAIL exten => s,7,GotoIf($[${DIALSTATUS} = UNAVAIL]?8:10) ; If UNAVAIL is the returned status, go to step 8. ; Otherwise, go to step 10. Both do the same thing here, ; but can be configured differently from each other. ; exten => s,8,Macro(fastbusy) exten => s,9,NoOp(9) exten => s,10,NoOp(10) exten => s,11,Macro(fastbusy) exten => s,54,NoOp(54 ENUM Server not reachable -- giving up) exten => s,55,Macro(fastbusy) exten => s,104,NoOp(104 No ENUM e164 match found -- number does not exist on CNET) exten => s,105,Macro(yccbcad) ; ; [macro-invalid] exten => s,1,Answer exten => s,2,Wait(1) exten => s,3,Playtones(480*20/2000,0/4000) exten => s,4,Wait(8) exten => s,5,Playtones(!950/330,!1400/330,!1800/330,0) exten => s,6,Wait(2) exten => s,7,Playback(discon-or-out-of-service) exten => s,8,Wait(1) exten => s,9,SayDigits(999) exten => s,10,Wait(5) exten => s,11,Hangup ; [macro-Milliwatt] exten => s,1,Answer exten => s,2,Playtones(1004) exten => s,3,Wait(${ARG1}) exten => s,4,Hangup ; [cnet] exten => _NXXXXXX,1,Macro(dialcnet,${EXTEN}) exten => _NXXXXXX,2,Macro(fastbusy) ; [outbound] ; include => cnet ; exten => i,1,Macro(invalid) ; [internal] ; exten => s,1,Dial(ZAP/g1/0,360,tT) ; The 's' in this command means 'switch.' ; It is the default 'extension' in any particular ; context. So, if a call landed here with no ; digits included, it would go to the 'switch' ; extension (or function). ; The '1' means that this is the first ; instruction to carry out. ; 'Dial' means just what it says. ; 'ZAP': Dial out on a zaptel device. ; 'g1': Trunk Group 1 ; '0': The digit(s) to dial ; '360' number of seconds before ditching ; an unanswered call. ; 'tT': both incoming and outgoing ; calls could be transferred elsewhere via either ; hookswitch flash or dialing #. You can leave ; those 'tT's off if the # is used for other things ; in your system. ; We would send a call here if we want ; Asterisk to send the call to extension "0" ; on the electromechanical switch. i.e., the ; cord board or other operator console you may ; have. exten => s,2,Hangup ; In case disconnect supervision fails, the call ; will 'hang up' after the call is done. ; ; First in-use DID is 999-0000, which goes to the operator. ; But it is declared below in the [inbound] context, so we ; don't need it here. ; ; First 'station' DID is 999-0011 ; exten => 11,1,Macro(dialswitch,11) ; exten => 12,1,Macro(dialswitch,12) ; exten => 13,1,Macro(dialswitch,13) ; exten => 14,1,Macro(dialswitch,14) ; exten => 15,1,Macro(dialswitch,15) ; exten => 16,1,Macro(dialswitch,16) ; exten => 17,1,Macro(dialswitch,17) ; exten => 18,1,Macro(dialswitch,18) ; exten => 19,1,Macro(dialswitch,19) ; ; Invalid Extension ; Invalid incoming calls should have been caught before ; this point, but, just incase they weren't... ; exten => i,1,Macro(invalid) ; ; Hangup exten => h,1,Hangup ; ; Timeout exten => t,1,congestion ; ; [inbound] ; ; inbound sip and IAX calls ; New version of asterisk requires that ; acct name be sent to an extension of ; the same name. ; exten => 9990000,1,Goto(internal,s,1) ; ; 999-0001 through 999-0010 do not exist, so we don't ; include them in this list. exten => 9990011,1,Goto(internal,11,1) exten => 9990012,1,Goto(internal,12,1) exten => 9990013,1,Goto(internal,13,1) exten => 9990014,1,Goto(internal,14,1) exten => 9990015,1,Goto(internal,15,1) exten => 9990016,1,Goto(internal,16,1) exten => 9990017,1,Goto(internal,17,1) exten => 9990018,1,Goto(internal,18,1) exten => 9990019,1,Goto(internal,19,1) exten => _999XXXX,1,Macro(invalid) ; for vacant incoming numbers ; This is a catch-all intercept for ; all calls that don't point to a valid ; number. ; ;