extensions.conf 7.2 KB

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