| 1 | [globals] |
| 2 | ; General internal dialing options used in context Dial-Users. |
| 3 | ; Only the timeout is defined here. See the Dial app documentation for |
| 4 | ; additional options. |
| 5 | INTERNAL_DIAL_OPT=,30 |
| 6 | |
| 7 | [Hints] |
| 8 | ; Allow dynamic hint creation for every extension. |
| 9 | exten = _11XX,hint,PJSIP/${EXTEN} |
| 10 | |
| 11 | [Features] |
| 12 | ; Extension to check user voicemail. We don't require the user to enter |
| 13 | ; their pincode. |
| 14 | exten = 8000,1,Verbose(1, "User ${CALLERID(num)} dialed the voicemail feature.") |
| 15 | same = n,VoiceMailMain(${CALLERID(num)}@example,s) |
| 16 | same = n,Hangup() |
| 17 | |
| 18 | ; Exten to dial the main IVR internally. |
| 19 | exten = 1100,1,Verbose(1, "User ${CALLERID(num)} dialed the IVR.") |
| 20 | same = n,Goto(Main-IVR,2565551100,1) |
| 21 | |
| 22 | ;Extension to enter a conference intended only for employees |
| 23 | exten = 6000,1,Verbose(1, "User ${CALLERID(num)} dialed the employee conference.") |
| 24 | same = n,Confbridge(employees) |
| 25 | same = n,Hangup() |
| 26 | |
| 27 | ;Extension to enter a conference intended for employees and customers |
| 28 | exten = 6500,1,Verbose(1, "User ${CALLERID(num)} dialed the employee/customer mixed conference.") |
| 29 | same = n,Confbridge(mixed) |
| 30 | same = n,Hangup() |
| 31 | |
| 32 | [External-Features] |
| 33 | ; Extension for users to remotely check voicemail. Here we require the caller to |
| 34 | ; enter their mailbox and pincode. |
| 35 | exten = 2565551234,1,Verbose(1, "User ${CALLERID(num)} dialed into remote voicemail.") |
| 36 | same = n,VoiceMailMain(example) |
| 37 | same = n,Hangup() |
| 38 | |
| 39 | ; Extension to queue for sales. |
| 40 | ; The queue has a 300 second timeout. |
| 41 | exten = 2565551200,1,Verbose(1, "User ${CALLERID(num)} dialed the sales queue.") |
| 42 | same = n,Answer() |
| 43 | same = n,Queue(sales,,,,300) |
| 44 | same = n,Goto(operator,1) |
| 45 | |
| 46 | ; Extension to queue for a customer advocate. |
| 47 | ; The queue has a 1200 second timeout. |
| 48 | exten = 2565551250,1,Verbose(1, "User ${CALLERID(num)} dialed the customer advocate queue.") |
| 49 | same = n,Answer() |
| 50 | same = n,Queue(customer_advocate,,,,1200) |
| 51 | same = n,Goto(operator,1) |
| 52 | |
| 53 | [Dialing-Errors] |
| 54 | ; Handle any extensions dialed internally that don't otherwise exist. |
| 55 | ; Comment out or remove this extension if you would rather have the calls |
| 56 | ; ignored. |
| 57 | exten = _X.,1,Verbose(1, "User ${CALLERID(num)} dialed an invalid number.") |
| 58 | same = n,Playback(pbx-invalid) |
| 59 | same = n,Hangup() |
| 60 | |
| 61 | [Internal-Setup] |
| 62 | ; Here we capture internal calls to do anything we need to do before sending |
| 63 | ; them onto all the possible internal locations. Such as disabling CDR on |
| 64 | ; internal to internal calls. |
| 65 | exten = _X.,1,NoOp() |
| 66 | same = n,Set(CDR_PROP(disable)=1) |
| 67 | same = n,Goto(Internal-Main,${EXTEN},1) |
| 68 | |
| 69 | ; The Internal-Main context provides a way for internal callers to get access to most |
| 70 | ; features and functions configured for them. External callers may be sent |
| 71 | ; directly to some of the contexts you see included here, so the included |
| 72 | ; contexts are not necessarily internal only. |
| 73 | [Internal-Main] |
| 74 | ; The order of includes here is important for matching the right extensions. |
| 75 | include = Hints |
| 76 | include = Features |
| 77 | include = Dial-Users |
| 78 | include = Dialing-Errors |
| 79 | |
| 80 | ; Dial-Users handles calls to internal extensions. |
| 81 | ; Calls coming into this context may be *external* or *internal* in origin. |
| 82 | [Dial-Users] |
| 83 | exten = _11XX,1,Verbose(1, "User ${CALLERID(num)} dialed ${EXTEN}.") |
| 84 | same = n,Set(SAC_DIALED_EXTEN=${EXTEN}) |
| 85 | same = n,Gotoif($[${DEVICE_STATE(PJSIP/${EXTEN})} = BUSY]?dialed-BUSY,1:) |
| 86 | same = n,Dial(PJSIP/${EXTEN}${INTERNAL_DIAL_OPT}) |
| 87 | same = n,Goto(dialed-${DIALSTATUS},1) |
| 88 | |
| 89 | exten = dialed-NOANSWER,1,NoOp() |
| 90 | same = n,Voicemail(${SAC_DIALED_EXTEN}@example,u) |
| 91 | same = n,Hangup() |
| 92 | |
| 93 | exten = dialed-BUSY,1,NoOp() |
| 94 | same = n,Voicemail(${SAC_DIALED_EXTEN}@example,b) |
| 95 | same = n,Hangup() |
| 96 | |
| 97 | exten = dialed-CHANUNAVAIL,1,NoOp() |
| 98 | same = n,Playback(pbx-invalid) |
| 99 | same = n,Hangup() |
| 100 | |
| 101 | exten = _dialed-.,1,Goto(dialed-NOANSWER,1) |
| 102 | |
| 103 | exten = h,1,Hangup() |
| 104 | |
| 105 | ; Callers in the directory may dial 0 which will jump to the |
| 106 | ; 'o' extension. |
| 107 | exten = o,1,Goto(1111) |
| 108 | |
| 109 | ; Outbound-Dial |
| 110 | ; |
| 111 | ; Before we dial, see if the extension matches our restricted number patterns. |
| 112 | ; Note that this is a basic set of numbers which could incur a fee if dialed. |
| 113 | ; The NANP includes many other numbers that you may want to block. If you feel |
| 114 | ; it is necessary to block further number patterns you'll have to add them below |
| 115 | ; or you may consider implementing a blacklist via methods beyond the scope of |
| 116 | ; this example. |
| 117 | [Outbound-Dial] |
| 118 | exten = _011.,1,Hangup() |
| 119 | exten = _900NXXXXXX,1,Hangup() |
| 120 | exten = _1900NXXXXXX,1,Hangup() |
| 121 | exten = _976XXXX,1,Hangup() |
| 122 | exten = _NXX976XXXX,1,Hangup() |
| 123 | exten = _1NXX976XXXX,1,Hangup() |
| 124 | ; Dial outbound through our SIP ITSP. |
| 125 | exten = _X.,1,Verbose(1, "Didn't match any restricted numbers, proceeding with outbound dial.") |
| 126 | same = n,Set(CALLERID(num)=256555${CALLERID(num)}) |
| 127 | same = n,Dial(PJSIP/${EXTEN}@dcs-endpoint) |
| 128 | same = n,Hangup() |
| 129 | |
| 130 | ; Calls from internal endpoints will enter into one of the two following |
| 131 | ; contexts based on their dialing privilege. |
| 132 | [Local] |
| 133 | include = Internal-Setup |
| 134 | |
| 135 | exten = _NXXXXXX,1,Goto(Outbound-Dial,1256${EXTEN},1) |
| 136 | exten = _256NXXXXXX,1,Goto(Outbound-Dial,1${EXTEN},1) |
| 137 | exten = _1256NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1) |
| 138 | |
| 139 | [Long-Distance] |
| 140 | include = Local |
| 141 | |
| 142 | exten = _NXXNXXXXXX,1,Goto(Outbound-Dial,1${EXTEN},1) |
| 143 | exten = _1NXXNXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1) |
| 144 | |
| 145 | ; The DID-Extensions context captures inbound calls from our ITSP that have a |
| 146 | ; DID number where the last four digits matches an internal extension. |
| 147 | [DID-Extensions] |
| 148 | exten = _25655511XX,1,Verbose(1, "External caller dialed inbound to DID ${EXTEN})") |
| 149 | same = n,Goto(Dial-Users,${EXTEN:6},1) |
| 150 | |
| 151 | ; Our main IVR program for receiving inbound callers. |
| 152 | ; The IVR script reads “Thank you for calling Super Awesome Company, Waldo’s |
| 153 | ; premier provider of perfect products. If you know your party’s extension, |
| 154 | ; you may dial it at any time. To establish a sales partnership, press one. To |
| 155 | ; speak with a customer advocate, press two. For accounting and other |
| 156 | ; receivables, press three. For a company directory, press four. For an |
| 157 | ; operator, press zero.” |
| 158 | ; demo-congrats is currently used as a placeholder. |
| 159 | [Main-IVR] |
| 160 | exten = 2565551100,1,Verbose(1, "New caller, ${CALLERID(num)} dialed into the IVR.") |
| 161 | same = n,Answer() |
| 162 | same = n(start),Background(basic-pbx-ivr-main) |
| 163 | same = n,WaitExten(10) |
| 164 | same = n,Background(basic-pbx-ivr-main) |
| 165 | same = n,Hangup() |
| 166 | |
| 167 | exten = 0,1,Verbose(1, "Caller ${CALLERID(num)} dialed the operator.") |
| 168 | same = n,Goto(Dial-Users,1111,1) |
| 169 | exten = 1,1,Verbose(1, "Caller ${CALLERID(num)} dialed the Sales queue.") |
| 170 | same = n,Goto(External-Features,2565551200,1) |
| 171 | exten = 2,1,Verbose(1, "Caller ${CALLERID(num)} dialed the Customer Experience queue.") |
| 172 | same = n,Goto(External-Features,2565551250,1) |
| 173 | exten = 3,1,Verbose(1, "Caller ${CALLERID(num)} dialed Accounting and Receivables.") |
| 174 | same = n,Goto(Dial-Users,1106,1) |
| 175 | exten = 4,1,Verbose(1, "Caller ${CALLERID(num)} dialed the directory.") |
| 176 | same = n,Directory(example,Dial-Users) |
| 177 | |
| 178 | exten = i,1,Playback(option-is-invalid) |
| 179 | same = n,Goto(2565551100,start) |
| 180 | |
| 181 | exten = t,1,Playback(are-you-still-there) |
| 182 | same = n,Goto(2565551100,start) |
| 183 | |
| 184 | ; Calls from our ITSP SIP account arrive in DCS-Incoming. We should be careful |
| 185 | ; to route calls very explicitly so as to avoid any security issues, such as |
| 186 | ; accidentally giving outbound dial access to inbound callers. |
| 187 | ; |
| 188 | ; Each context includes extension pattern matching to match the inbound DID |
| 189 | ; dialed appropriately. |
| 190 | [DCS-Incoming] |
| 191 | include = Main-IVR |
| 192 | include = DID-Extensions |
| 193 | include = External-Features |