Guest User

Untitled

a guest
Jan 7th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.67 KB | None | 0 0
  1. # TP VIP 2018
  2. ### Id campus booster : 217019
  3.  
  4. ## Templates (2 points)
  5.  
  6. ### Global template
  7. With the give requirements we get the following generic template:
  8.  
  9. `users.conf`
  10. ```
  11. [Global_2019298_tpl](!)
  12. hassip=yes
  13. type=friend
  14.  
  15. ; Codecs disallowed
  16. disallow=all
  17.  
  18. ; Codecs allowed
  19. allow=alaw
  20. allow=g711
  21.  
  22. allow=ulaw
  23. allow=g711
  24.  
  25. nat=no ; Behind NAT
  26. qualify=no ; Monitoring
  27. host=dynamic ; Any clients
  28. ```
  29.  
  30. ### Department templates
  31. Each department template is based on the global template and define the department context:
  32.  
  33. `users.conf`
  34. ```
  35. [sales_3003_tpl](!,Global_2019298_tpl)
  36. context=sales_3003
  37.  
  38. [support_4582_tpl](!,Global_2019298_tpl)
  39. context=support_4582
  40.  
  41. [randd_5024_tpl](!,Global_2019298_tpl)
  42. context=randd_5024
  43.  
  44. [testing_9377_tpl](!,Global_2019298_tpl)
  45. context=testing_9377
  46. ```
  47.  
  48. ## Users creation (1 points)
  49.  
  50. Each user is create based on the template of the deparment it belongs to. The secret is also defined here.
  51.  
  52. `users.conf`
  53. ```
  54. [12546](sales_3003_tpl)
  55. secret=5624
  56. username=BillyTheKid
  57.  
  58. [12547](sales_3003_tpl)
  59. secret=6481
  60. username=DavyCrockett
  61.  
  62. [21499](support_4582_tpl)
  63. secret=3688
  64. username=JesseJames
  65.  
  66. [21500](support_4582_tpl)
  67. secret=3052
  68. username=ButchCassidy
  69.  
  70. [40000](randd_5024_tpl)
  71. secret=8472
  72. username=BuffaloBill
  73.  
  74. [90000](testing_9377_tpl)
  75. secret=1234
  76. username=TestTest
  77. ```
  78.  
  79. ## Voicemail creation (1 points)
  80.  
  81. Voicemail is defined for each user with the same secret of `users.conf` file:
  82.  
  83. `voicemail.conf`
  84. ```
  85. [Voicemail_4783]
  86. 12546 => 5624,12546,BillyTheKid@cpsc.lan
  87. 12547 => 6481,12547,DavyCrockett@cpsc.lan
  88. 21499 => 3688,21499,JesseJames@cpsc.lan
  89. 21500 => 3052,21500,ButchCassidy@cpsc.lan
  90. 40000 => 8472,40000,BuffaloBill@cpsc.lan
  91. 90000 => 1234,90000,TestTest@cpsc.lan
  92. ```
  93.  
  94. ## Dialplan Configuration - Dialplan Setup (3 points)
  95.  
  96. ### Voicemail configuration
  97.  
  98. `extensions.conf`
  99. ```
  100. [General_context_2118]
  101.  
  102. exten => 0000,1,Answer() ; When calling 0000, answer
  103. same => n,VoiceMailMain(${CALLERID(num)}@Voicemail_4783) ; And consult voicemail based on caller id number
  104. ```
  105.  
  106. ### Internal department configuration
  107.  
  108. Below is just an part of the configuration of the analytic department
  109. because it is the same pattern for every department with a different range.
  110. Some adaptations were made to handle a different timeout for inter department.
  111. The last number of the department range is reserved for ring groups.
  112.  
  113. `extensions.conf`
  114. ```
  115. [sales_3003]
  116. include => General_context_2118
  117. include => support_4582_dep
  118. include => randd_5024_dep
  119. include => testing_9377_dep
  120.  
  121. exten => _1254[6-9],1,Set(_Timeout=37)
  122. same => n,Dial(SIP/${EXTEN},${Timeout})
  123. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  124.  
  125. exten => _125[5-9]X,1,Set(_Timeout=37)
  126. same => n,Dial(SIP/${EXTEN},${Timeout})
  127. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  128.  
  129. exten => _1[3-9]XXX,1,Set(_Timeout=37)
  130. same => n,Dial(SIP/${EXTEN},${Timeout})
  131. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  132.  
  133. exten => _20XXX,1,Set(_Timeout=37)
  134. same => n,Dial(SIP/${EXTEN},${Timeout})
  135. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  136.  
  137. exten => _21[0-3]XX,1,Set(_Timeout=37)
  138. same => n,Dial(SIP/${EXTEN},${Timeout})
  139. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  140.  
  141. exten => _214[0-1]X,1,Set(_Timeout=37)
  142. same => n,Dial(SIP/${EXTEN},${Timeout})
  143. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  144.  
  145. [support_4582]
  146.  
  147. include => General_context_2118
  148. include => sales_3003_dep
  149. include => randd_5024_dep
  150. include => testing_9377_dep
  151.  
  152. exten => 21499,1,Set(_Timeout=37)
  153. same => n,Dial(SIP/${EXTEN},${Timeout})
  154. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  155.  
  156. exten => _21[5-9]XX,1,Set(_Timeout=37)
  157. same => n,Dial(SIP/${EXTEN},${Timeout})
  158. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  159.  
  160. exten => _2[2-9]XXX,1,Set(_Timeout=37)
  161. same => n,Dial(SIP/${EXTEN},${Timeout})
  162. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  163.  
  164. exten => _3[0-4]XXX,1,Set(_Timeout=37)
  165. same => n,Dial(SIP/${EXTEN},${Timeout})
  166. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  167.  
  168. exten => _35[0-5]XX,1,Set(_Timeout=37)
  169. same => n,Dial(SIP/${EXTEN},${Timeout})
  170. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  171.  
  172. exten => _356[0-2]X,1,Set(_Timeout=37)
  173. same => n,Dial(SIP/${EXTEN},${Timeout})
  174. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  175.  
  176. exten => _3563[0-3],1,Set(_Timeout=37)
  177. same => n,Dial(SIP/${EXTEN},${Timeout})
  178. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  179.  
  180. [randd_5024]
  181. include => General_context_2118
  182. include => sales_3003_dep
  183. include => sales_3003_dep
  184. include => testing_9377_dep
  185.  
  186. exten => _4XXXX,1,Set(_Timeout=37)
  187. same => n,Dial(SIP/${EXTEN},${Timeout})
  188. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  189.  
  190. [testing_9377]
  191.  
  192. include => General_context_2118
  193. include => sales_3003_dep
  194. include => randd_5024_dep
  195. include => support_4582_dep
  196.  
  197. exten => _9XXXX,1,Set(_Timeout=37)
  198. same => n,Dial(SIP/${EXTEN},${Timeout})
  199. same => n,Voicemail(${EXTEN}@Voicemail_4783)
  200. ```
  201.  
  202. ## Dialplan Configuration - Inter- Departments Communication (3 points)
  203.  
  204. ### New contexts - creation
  205. New contexts are created for each department.
  206.  
  207. ### New contexts - usage
  208. The new inter department contexts are included inside each internal department context except the for current department It means inside sales_3003 , sales_3003_dep is not included because it is already defined.
  209.  
  210. `extensions.conf`
  211. ```
  212. [sales_3003_dep]
  213.  
  214. exten => _1254[6-9],1,Set(_Timeout=65)
  215. same => n,Goto(sales_3003,${EXTEN},2)
  216.  
  217. exten => _125[5-9]X,1,Set(_Timeout=65)
  218. same => n,Goto(sales_3003,${EXTEN},2)
  219.  
  220. exten => _1[3-9]XXX,1,Set(_Timeout=65)
  221. same => n,Goto(sales_3003,${EXTEN},2)
  222.  
  223. exten => _20XXX,1,Set(_Timeout=65)
  224. same => n,Goto(sales_3003,${EXTEN},2)
  225.  
  226. exten => _21[0-3]99,1,Set(_Timeout=65)
  227. same => n,Goto(sales_3003,${EXTEN},2)
  228.  
  229. exten => _214[0-1]X,1,Set(_Timeout=65)
  230. same => n,Goto(sales_3003,${EXTEN},2)
  231.  
  232. [support_4582_dep]
  233.  
  234. exten => 21499,1,Set(_Timeout=65)
  235. same => n,Goto(support_4582,${EXTEN},2)
  236.  
  237. exten => _21[5-9]XX,1,Set(_Timeout=65)
  238. same => n,Goto(support_4582,${EXTEN},2)
  239.  
  240. exten => _2[2-9]XXX,1,Set(_Timeout=65)
  241. same => n,Goto(support_4582,${EXTEN},2)
  242.  
  243. exten => _3[0-4]XXX,1,Set(_Timeout=65)
  244. same => n,Goto(support_4582,${EXTEN},2)
  245.  
  246. exten => _35[0-5]XX,1,Set(_Timeout=65)
  247. same => n,Goto(support_4582,${EXTEN},2)
  248.  
  249. exten => _356[0-2]X,1,Set(_Timeout=65)
  250. same => n,Goto(support_4582,${EXTEN},2)
  251.  
  252. exten => _3563[0-3],1,Set(_Timeout=65)
  253. same => n,Goto(support_4582,${EXTEN},2)
  254.  
  255. [randd_5024_dep]
  256.  
  257. exten => _4XXXX,1,Set(_Timeout=65)
  258. same => n,Goto(randd_5024,${EXTEN},2)
  259.  
  260. [testing_9377_dep]
  261.  
  262. exten => _9XXXX,1,Set(_Timeout=65)
  263. same => n,Goto(testing_9657,${EXTEN},2)
  264. ```
  265.  
  266. ## Dialplan Configuration - Ring Groups (2 points)
  267.  
  268. Ring groups are defined inside the General_context_2118 context because they need to be included inside each department.
  269.  
  270. `extensions.conf`
  271. ```
  272. ; Ring Groups
  273.  
  274. exten => 21419,1,Set(_Timeout=24)
  275. same => n,Dial(SIP/12546,${Timeout})
  276. same => n,Dial(SIP/12547,${Timeout})
  277. same => n,Dial(SIP/12548,${Timeout})
  278. same => n,Dial(SIP/12549,${Timeout})
  279. same => n,Goto(General_context_2118,21419,1)
  280.  
  281. exten => 35633,1,Set(_Timeout=31)
  282. same => n,Dial(SIP/21499,${Timeout})
  283. same => n,Dial(SIP/21500,${Timeout})
  284. same => n,Dial(SIP/21501,${Timeout})
  285. same => n,Dial(SIP/21502,${Timeout})
  286. same => n,Goto(General_context_2118,35633,1)
  287.  
  288. exten => 49999,1,Dial(SIP/40000&SIP/40001&SIP/40002&SIP/400003,29)
  289. same => n,Voicemail(40000@Voicemail_4783)
  290.  
  291. exten => 99999,1,Dial(SIP/90000&SIP/90001&SIP/90002&SIP/90003,38)
  292. same => n,Voicemail(90000@Voicemail_4783)
  293. ```
  294.  
  295. ## Call Features - IVR (3 points)
  296.  
  297. `extensions.conf`
  298. ```
  299. [IVR_2019263]
  300. exten => s,1,Answer()
  301. same => n,Set(TIMEOUT(response)=13)
  302. same => n,agi(googletts.agi,"Clay Pigeon Shooting Corporation welcome")
  303. same => n,agi(googletts.agi,"To contact the Sales department, press 1",en,1)
  304. same => n,agi(googletts.agi,"To contact the Support department, press 2",en,2)
  305. same => n,agi(googletts.agi,"To contact the Research and Development department, press 3",en,3)
  306. same => n,WaitExten()
  307. exten => 1,1,Goto(General_context_2118,21419,1)
  308. exten => 2,1,Goto(General_context_2118,35633,1)
  309. exten => 3,1,Goto(General_context_2118,49999,1)
  310. exten => _[04-9#*],1,Goto(IVR_2019263,s,3)
  311. exten => t,1,Goto(IVR_2019263,s,3)
  312. ```
  313.  
  314. `extensions.conf` for testing
  315. ```
  316. exten => 01234,1,Goto(IVR_2019263,s,1) ; Go to the first step of the IVR context
  317. ```
  318.  
  319. ## Call Features - SIP Trunk (1 points)
  320.  
  321. ```
  322.  
  323. ```
  324.  
  325. ## Inter-Connection - IAX (2 points)
  326.  
  327. `iax.conf`
  328. ```
  329. [IAX_French_97724]
  330. ; Disallow all codecs except G.711
  331. disallow=all
  332. allow=alaw
  333. allow=g711
  334. trunk=yes
  335. type=friend
  336. username=IAX_French_97724
  337. secret=itMustBeHardToConnectInHere
  338. context=IAX_trunk_1135
  339. host=104.27.24.50 ; remote iax peer ip
  340. qualify=yes
  341. ```
  342.  
  343. `extension.conf`
  344. ```
  345. ; IAX
  346. [IAX_trunk_1135]
  347. exten => _5XXXX,1,Dial(IAX2/IAX_French_97724/${EXTEN})
  348. ```
  349.  
  350. ## Fail2Ban (2 points)
  351.  
  352. `jail.conf`
  353. ```
  354. [asterisk]
  355. enabled=true
  356. filter=asterisk
  357. action=iptables-allports[name=ASTERISK, protocol=all] # block ip
  358. logpath=/var/log/asterisk/security # security file
  359. bantime=32953 # ban time
  360. maxretry=13 # number of authentication failures
  361. findtime=70 # time frame
  362. ```
Add Comment
Please, Sign In to add comment