extensions.ael 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Helpdesk Queue
  3. context hd-queue {
  4. s => {
  5. NoOp(Add a background sound to tell the user their options);
  6. Queue(helpdesk|t);
  7. NoOp(Put in options to apologize and send user to voicemail);
  8. };
  9. 0 => goto default|0|1;
  10. 1 => {
  11. Dial(u41950@svm1.shsu.edu);
  12. Congestion(10);
  13. Hangup;
  14. };
  15. };
  16. context l903-calling {
  17. _9903NXXXXXX => {
  18. Realtime(l903_ext|exchange|${EXTEN:4:3}|l903_);
  19. if ("${l903_exchange}foo" = "foo") {
  20. Playback(num-outside-area);
  21. SayDigits(1);
  22. Playback(and-area-code);
  23. Playback(before-the-number);
  24. Hangup;
  25. };
  26. &dialout(${EXTEN});
  27. Congestion(10);
  28. Hangup;
  29. };
  30. };
  31. ///////////////////////////////////////////////////////////////////////////////
  32. // Extensions pulled from houston.conf
  33. // Converted the extension list to the database
  34. context houston-calling {
  35. _9713NXXXXXX => {
  36. Realtime(hou_713_ext|exchange|${EXTEN:4:3}|hou_713_);
  37. if ("${hou_713_exchange}foo" = "foo") {
  38. Playback(num-outside-area);
  39. SayDigits(1);
  40. Playback(and-area-code);
  41. Playback(before-the-number);
  42. Hangup;
  43. };
  44. &dialout(${EXTEN});
  45. Congestion(10);
  46. Hangup;
  47. };
  48. _9281NXXXXXX => {
  49. Realtime(hou_281_ext|exchange|${EXTEN:4:3}|hou_281_);
  50. if ("${hou_281_exchange}foo" = "foo") {
  51. Playback(num-outside-area);
  52. SayDigits(1);
  53. Playback(and-area-code);
  54. Playback(before-the-number);
  55. Hangup;
  56. };
  57. &dialout(${EXTEN});
  58. Congestion(10);
  59. Hangup;
  60. };
  61. _9832NXXXXXX => {
  62. Realtime(hou_832_ext|exchange|${EXTEN:4:3}|hou_832_);
  63. if ("${hou_832_exchange}foo" = "foo") {
  64. Playback(num-outside-area);
  65. SayDigits(1);
  66. Playback(and-area-code);
  67. Playback(before-the-number);
  68. Hangup;
  69. };
  70. &dialout(${EXTEN});
  71. Congestion(10);
  72. Hangup;
  73. };
  74. };
  75. ///////////////////////////////////////////////////////////////////////////////
  76. // Extensions pulled from huntsville.conf
  77. // Converted the extension list to the database
  78. context huntsville-calling {
  79. _9NXXXXXX => {
  80. Realtime(hv_ext|exchange|${EXTEN:1:3}|hv_);
  81. if ("${hv_exchange}foo" = "foo") {
  82. Playback(num-outside-area);
  83. SayDigits(1);
  84. Playback(and-area-code);
  85. Playback(before-the-number);
  86. Hangup;
  87. };
  88. &dialout(${EXTEN});
  89. Congestion(10);
  90. Hangup;
  91. };
  92. _NXXXXXX => {
  93. NoOp(Stripping last four to see what extension we're dialing);
  94. Set(LAST4=${EXTEN:3});
  95. StripLSD(4);
  96. };
  97. i => Playback(pbx-invalid);
  98. h => Hangup;
  99. };
  100. ///////////////////////////////////////////////////////////////////////////////
  101. // Extensions pulled from macros.conf
  102. macro dialout( number ) {
  103. Realtime(call_info|exten|${CALLERIDNUM:5}|mon_);
  104. if ("${mon_monitor}" = "YES") {
  105. Dial(SIP/${number}@sgw1.shsu.edu,,wW);
  106. Dial(SIP/${number}@sgw2.shsu.edu,,wW);
  107. } else {
  108. Dial(SIP/${number}@sgw1.shsu.edu);
  109. Dial(SIP/${number}@sgw2.shsu.edu);
  110. };
  111. };
  112. // Standard extension macro:
  113. // ${ext} - Extension
  114. macro stdexten( ext ) {
  115. Realtime(sipusers|name|${ext}|sip_user_);
  116. Realtime(call_info|exten|${ext}|info_);
  117. if ("${sip_user_name}foo" = "foo") {
  118. Wait(1);
  119. &dialout(${ext});
  120. Congestion(10);
  121. Hangup;
  122. };
  123. NoOp(${CALLERIDNUM});
  124. RealtimeUpdate(call_info|exten|${ext}|calltrace|${CALLERIDNUM});
  125. System(/usr/local/bin/db_update.sh call_info calltrace ${CALLERIDNUM} exten ${ext} &);
  126. &checkdnd(${ext});
  127. &checkcf(${ext});
  128. Realtime(call_info|exten|${CALLERIDNUM:5}|mon_);
  129. if ("${mon_monitor}" = "YES") {
  130. Dial(SIP/${info_forwardto},25,wW);
  131. } else {
  132. Dial(SIP/${info_forwardto},25);
  133. };
  134. switch ("${DIALSTATUS}") {
  135. case "BUSY":
  136. &checkcfb(${ext});
  137. break;
  138. case "CHANUNAVAIL":
  139. Dial(IAX2/asterisk:password@scm2.shsu.edu/${info_forwardto},25,wW);
  140. MailboxExists(${ext});
  141. // if ("${VMBOXEXISTSSTATUS}" = "FAILED") {
  142. // Congestion(10);
  143. // Hangup;
  144. // };
  145. &uvm(${ext});
  146. Hangup;
  147. break;
  148. case "CONGESTION":
  149. MailboxExists(${ext});
  150. if ("$(VMBOXEXISTSSTATUS}" = "FAILED") {
  151. Congestion(10);
  152. Hangup;
  153. };
  154. &bvm(${ext});
  155. Hangup;
  156. break;
  157. default:
  158. MailboxExists(${ext});
  159. if ("$(VMBOXEXISTSSTATUS}" = "FAILED") {
  160. Congestion(10);
  161. Hangup;
  162. };
  163. &uvm(${ext});
  164. Hangup;
  165. };
  166. Hangup;
  167. };
  168. macro uvm( ext ) {
  169. Dial(SIP/u${ext}@svm1.shsu.edu);
  170. Playback(im-sorry);
  171. Playback(voice-mail-system);
  172. Playback(down);
  173. Congestion(10);
  174. Hangup;
  175. };
  176. macro bvm( ext ) {
  177. Dial(SIP/b${ext}@svm1.shsu.edu);
  178. Playback(im-sorry);
  179. Playback(voice-mail-system);
  180. Playback(down);
  181. Congestion(10);
  182. Hangup;
  183. };
  184. macro checkdnd( ext ) {
  185. if ("${info_donotdisturb}foo" = "foo") {
  186. NoOp(Do Not Disturb is not active);
  187. } else
  188. &uvm(${ext});
  189. };
  190. macro checkcf( ext ) {
  191. if ("${info_forwardto}foo" = "foo")
  192. if ("${ext}" = "43974") {
  193. Set(info_forwardto=${ext}&SCCP/${ext});
  194. } else {
  195. Set(info_forwardto=${ext}&SIP/${ext}w);
  196. };
  197. };
  198. macro checkcfb( ext ) {
  199. if ("${info_forwardbusy}foo" = "foo") {
  200. Wait(1);
  201. MailboxExists(${ext});
  202. if ("$(VMBOXEXISTSSTATUS}" = "FAILED") {
  203. &dialout(${ext});
  204. Hangup;
  205. };
  206. &bvm(${ext});
  207. Hangup;
  208. };
  209. &stdexten(${info_forwardbusy});
  210. };
  211. ///////////////////////////////////////////////////////////////////////////////
  212. // Extensions pulled from test.conf
  213. context test-include {
  214. includes {
  215. test-digium;
  216. test-sounds;
  217. test-phinfo;
  218. };
  219. };
  220. context test-digium {
  221. *500 => {
  222. Dial(IAX2/guest@misery.digium.com/s@default);
  223. Playback(demo-nogo);
  224. Hangup;
  225. };
  226. };
  227. context test-sounds {
  228. *501 => {
  229. Answer;
  230. Musiconhold;
  231. Wait(1);
  232. Hangup;
  233. };
  234. };
  235. context test-phinfo {
  236. *505 => {
  237. Answer;
  238. NoOp(${CALLERIDNUM:5});
  239. SayDigits(${CALLERIDNUM:5});
  240. Hangup;
  241. };
  242. };
  243. ///////////////////////////////////////////////////////////////////////////////
  244. // Extensions pulled from external.conf
  245. context long-distance {
  246. includes {
  247. local1;
  248. };
  249. _91XXXXXXXXXX => &dialout(${EXTEN});
  250. _9011. => &dialout(${EXTEN});
  251. };
  252. context local1 {
  253. includes {
  254. default;
  255. };
  256. 911 => &dialout(911);
  257. 9911 => &dialout(9911);
  258. _9NXXXXXX => goto huntsville-calling|${EXTEN}|1;
  259. _936NXXXXXX => {
  260. Goto 9${EXTEN:3}|1;
  261. Congestion(10);
  262. Hangup;
  263. };
  264. _832NXXXXXX => {
  265. goto 9${EXTEN}|1;
  266. Congestion(10);
  267. Hangup;
  268. };
  269. _713NXXXXXX => {
  270. goto 9${EXTEN}|1 ;
  271. Congestion(10);
  272. Hangup;
  273. };
  274. _281NXXXXXX => {
  275. goto 9${EXTEN}|1;
  276. Congestion(10);
  277. Hangup;
  278. };
  279. _NXXNXXXXXX => {
  280. goto 9${EXTEN}|1;
  281. goto 91${EXTEN}|1;
  282. Congestion(10);
  283. Hangup;
  284. };
  285. _91800NXXXXXX => &dialout(${EXTEN});
  286. _91866NXXXXXX => &dialout(${EXTEN});
  287. _91877NXXXXXX => &dialout(${EXTEN});
  288. _91888NXXXXXX => &dialout(${EXTEN});
  289. _91900NXXXXXX => &dialout(${EXTEN});
  290. _91976NXXXXXX => &dialout(${EXTEN});
  291. _9713NXXXXXX => goto houston-calling|${EXTEN}|1;
  292. _9281NXXXXXX => goto houston-calling|${EXTEN}|1;
  293. _9832NXXXXXX => goto houston-calling|${EXTEN}|1;
  294. _9903NXXXXXX => goto l903-calling|${EXTEN}|1;
  295. _31NXXNXXXXXX => &dialout(${EXTEN});
  296. h => Hangup;
  297. };
  298. ///////////////////////////////////////////////////////////////////////////////
  299. // Extensions pulled from internal.conf
  300. context from-scm2 {
  301. _4XXXX => {
  302. NoOp(DIALING SIP EXTENSION ${EXTEN} - FROM ${CALLERIDNUM});
  303. Dial(SIP/${EXTEN},20,wW);
  304. Hangup;
  305. };
  306. _6XXXX => {
  307. NoOp(DIALING SIP EXTENSION ${EXTEN} - FROM ${CALLERIDNUM});
  308. Dial(SIP/${EXTEN},20,wW);
  309. Hangup;
  310. };
  311. };
  312. ///////////////////////////////////////////////////////////
  313. // All internal extensions work through the default context
  314. // Phones that can only make internal calls should be in
  315. // this context.
  316. ///////////////////////////////////////////////////////////
  317. context default {
  318. // Include the contexts in the files that allow us to make these phone calls
  319. includes {
  320. vm-include;
  321. apps-include;
  322. test-include;
  323. };
  324. // ALWAYS have an 'h' extension
  325. h => {
  326. NoOp(Hangup cause was: ${HANGUPCAUSE});
  327. Hangup;
  328. };
  329. // We like to hear that we dialed an invalid extension
  330. i => Playback(pbx-invalid);
  331. // Dial the operator
  332. 0 => &dialout(0);
  333. // Send voicemail calls to the vm-* contexts to be handled
  334. voicemail => goto vm-direct|s|1;
  335. 5555 => goto vm-direct|s|1;
  336. 62100 => goto vm-extension|s|1;
  337. // These are our campus extensions, send them to the macro
  338. _6XXXX => &stdexten(${EXTEN});
  339. _4XXXX => &stdexten(${EXTEN});
  340. // These are campus extensions as well, might need to take this out though.
  341. _9294XXXX => goto _4XXXX|1;
  342. _9496XXXX => goto _6XXXX|1;
  343. // These allows us to dial from the directory in our phone without worrying about dialing 9
  344. _936294XXXX => {
  345. goto ${EXTEN:5}|1;
  346. goto 9${EXTEN:3}|1;
  347. Congestion(10);
  348. Hangup;
  349. };
  350. _936496XXXX => {
  351. goto ${EXTEN:5}|1;
  352. goto 9${EXTEN:3}|1;
  353. Congestion(10);
  354. Hangup;
  355. };
  356. };
  357. ///////////////////////////////////////////////////////////////////////////////
  358. // Extensions pulled from apps.conf
  359. context apps-include {
  360. includes {
  361. app-agents;
  362. app-dnd;
  363. app-callforward;
  364. app-calltrace;
  365. app-conferences;
  366. app-ssd;
  367. app-psd;
  368. app-idblock;
  369. app-helpdesk;
  370. app-dictate;
  371. app-set-monitor;
  372. };
  373. };
  374. context app-agents {
  375. *54 => {
  376. Answer;
  377. Wait(1);
  378. Read(agent_no|agent-user);
  379. AgentCallbackLogin(${agent_no}|s${CALLERIDNUM:5});
  380. Playback(agent-loginok);
  381. Hangup;
  382. };
  383. *55 => {
  384. Answer;
  385. Wait(1);
  386. AgentCallbackLogin(${agent_no});
  387. Hangup;
  388. };
  389. };
  390. context app-calltrace {
  391. // caller dials this to find out the last call missed and possibly call back
  392. *69 => goto app-calltrace-perform|s|1;
  393. };
  394. context app-calltrace-perform {
  395. s => {
  396. Answer;
  397. Wait(1);
  398. Background(info-about-last-call);
  399. Background(telephone-number);
  400. RealTime(call_info|exten|${CALLERIDNUM:5}|ct_);
  401. if ("${ct_calltrace}foo" = "foo") {
  402. Playback(loligo/from-unknown-caller);
  403. Hangup;
  404. } else {
  405. SayDigits("${ct_calltrace}");
  406. Set(TIMEOUT(digit)=3);
  407. Set(TIMEOUT(response)=7);
  408. Background(loligo/to-call-this-number);
  409. Background(press-1);
  410. Background(loligo/silence/5);
  411. };
  412. };
  413. 1 => goto local1|${ct_calltrace}|1;
  414. i => {
  415. Playback(vm-goodbye);
  416. Hangup;
  417. };
  418. t => {
  419. Playback(vm-goodbye);
  420. Hangup;
  421. };
  422. };
  423. context app-set-monitor {
  424. *50 => {
  425. Realtime(call_info|exten|${CALLERIDNUM:5}|mon_set_);
  426. if ("${mon_set_monitor}" = "YES") {
  427. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|monitor|);
  428. System(/usr/local/bin/db_update.sh call_info monitor '' exten ${CALLERIDNUM:5} &);
  429. } else {
  430. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|monitor|YES);
  431. System(/usr/local/bin/db_update.sh call_info monitor YES exten ${CALLERIDNUM:5} &);
  432. };
  433. NoOp(${mon_set_monitor});
  434. Hangup;
  435. };
  436. };
  437. context app-dnd {
  438. *78 => {
  439. Answer;
  440. Wait(1);
  441. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|donotdisturb|YES);
  442. System(/usr/local/bin/db_update.sh call_info donotdisturb YES exten ${CALLERIDNUM:5} &);
  443. Playback(do-not-disturb);
  444. Playback(loligo/activated);
  445. Hangup;
  446. };
  447. *79 => {
  448. Answer;
  449. Wait(1);
  450. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|donotdisturb|);
  451. System(/usr/local/bin/db_update.sh call_info donotdisturb '' exten ${CALLERIDNUM:5} &);
  452. Playback(do-not-disturb);
  453. Playback(loligo/de-activated);
  454. Hangup;
  455. };
  456. };
  457. context app-callforward {
  458. // forwards calling extension to input number *72{EXTEN}
  459. _*72. => {
  460. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|forwardto|${EXTEN:3});
  461. System(/usr/local/bin/db_update.sh call_info forwardto ${EXTEN:3} exten ${CALLERIDNUM:5} &);
  462. Answer;
  463. Wait(1);
  464. Playback(loligo/call-fwd-unconditional);
  465. Playback(loligo/for);
  466. Playback(loligo/extension);
  467. SayDigits(${CALLERIDNUM:5});
  468. Playback(loligo/is-set-to);
  469. SayDigits(${EXTEN:3});
  470. Hangup;
  471. };
  472. // prompts for extension to forward to
  473. *72 => {
  474. Answer;
  475. Wait(1);
  476. Playback(please-enter-your);
  477. Playback(extension);
  478. Background(then-press-pound);
  479. VMAuthenticate(|s);
  480. Background(loligo/ent-target-attendant);
  481. Read(toext,loligo/then-press-pound);
  482. Wait(1);
  483. RealtimeUpdate(call_info|exten|${AUTH_MAILBOX}|forwardto|${toext});
  484. System(/usr/local/bin/db_update.sh call_info forwardto ${toext} exten ${AUTH_MAILBOX} &);
  485. Playback(loligo/call-fwd-unconditional);
  486. Playback(loligo/for);
  487. Playback(loligo/extension);
  488. SayDigits(${AUTH_MAILBOX});
  489. Playback(loligo/is-set-to);
  490. SayDigits(${toext});
  491. Hangup;
  492. };
  493. // cancels dialed extension call forward
  494. _*73. => {
  495. Realtime(voicemail|mailbox|${EXTEN:3}|auth_);
  496. Answer;
  497. Wait(1);
  498. Authenticate(${auth_password});
  499. RealtimeUpdate(call_info|exten|${EXTEN:3}|forwardto|);
  500. System(/usr/local/bin/db_update.sh call_info forwardto '' exten ${EXTEN:3} &);
  501. Wait(1);
  502. SayDigits(${EXTEN:3});
  503. Playback(loligo/call-fwd-cancelled);
  504. Hangup;
  505. };
  506. // cancels call forward for calling extension
  507. *73 => {
  508. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|forwardto|);
  509. System(/usr/local/bin/db_update.sh call_info forwardto '' exten ${CALLERIDNUM:5} &);
  510. Answer;
  511. Wait(1);
  512. Playback(loligo/call-fwd-cancelled);
  513. Hangup;
  514. };
  515. // dialed call forward on busy
  516. _*90. => {
  517. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|forwardbusy|${EXTEN:3});
  518. System(/usr/local/bin/db_update.sh call_info forwardbusy ${EXTEN:3} exten ${CALLERIDNUM:5} &);
  519. Answer;
  520. Wait(1);
  521. Playback(loligo/call-fwd-on-busy);
  522. Playback(loligo/for);
  523. Playback(loligo/extension);
  524. SayDigits(${CALLERIDNUM:5});
  525. Playback(loligo/is-set-to);
  526. SayDigits(${EXTEN:3});
  527. Hangup;
  528. };
  529. // cancels call forward on busy for calling extension
  530. *91 => {
  531. RealtimeUpdate(call_info|exten|${CALLERIDNUM:5}|forwardbusy|);
  532. System(/usr/local/bin/db_update.sh call_info forwardbusy '' exten ${CALLERIDNUM:5} &);
  533. Answer;
  534. Wait(1);
  535. Playback(loligo/call-fwd-on-busy);
  536. Playback(loligo/de-activated);
  537. Hangup;
  538. };
  539. h => Hangup;
  540. };
  541. context app-idblock {
  542. _*67. => {
  543. Set(CALLERID(name)=Anonymous);
  544. &stdexten(${EXTEN:3});
  545. };
  546. };
  547. context app-dictate {
  548. *1 => {
  549. Dictate();
  550. Hangup;
  551. };
  552. };
  553. context app-ssd {
  554. // *59 <xx> <y.> - Set system speed dial <xx> to digits <y.>
  555. // *59 <xx> 0 - Delete system speed dial <xx>
  556. // *59 <xx> - Review system speed dial <xx>
  557. // *1xx - Dial speed dial <xx>
  558. _*59XXX. => {
  559. Answer;
  560. RealtimeUpdate(ssd|sd|${EXTEN:3:2}|extension|${EXTEN:5});
  561. System(/usr/local/bin/db_update.sh systemsd extension ${EXTEN:5} sd ${EXTEN:3:2} &);
  562. Wait(1);
  563. Playback(loligo/speed-dial);
  564. SayDigits(${EXTEN:3:2});
  565. Playback(loligo/has-been-set-to);
  566. SayDigits(${EXTEN:5});
  567. Hangup;
  568. };
  569. _*59XX0 => {
  570. Answer;
  571. RealtimeUpdate(ssd|sd|${EXTEN:3:2}|extension|);
  572. System(/usr/local/bin/db_update.sh systemsd extension '' sd ${EXTEN:3:2} &);
  573. Wait(1);
  574. Playback(loligo/speed-dial);
  575. SayDigits(${EXTEN:3:2});
  576. Playback(loligo/has-been-cleared);
  577. Hangup;
  578. };
  579. _*59XX => {
  580. Answer;
  581. Realtime(ssd|sd|${EXTEN:3}|ssd_);
  582. if ("${ssd_extension}foo" = "foo") {
  583. Playback(loligo/speed-dial);
  584. SayDigits(${EXTEN:3:2});
  585. Playback(loligo/is-not-set);
  586. Hangup;
  587. };
  588. Wait(1);
  589. Playback(loligo/speed-dial);
  590. SayDigits(${EXTEN:3:2});
  591. Playback(loligo/is-set-to);
  592. SayDigits(${ssd_extension});
  593. Hangup;
  594. };
  595. // NTC = number to call
  596. _*1XX => {
  597. Realtime(ssd|sd|${EXTEN:2}|ssd_);
  598. if ("${ssd_extension}foo" = "foo") {
  599. Answer;
  600. Wait(1);
  601. Playback(loligo/speed-dial);
  602. SayDigits(${EXTEN:2});
  603. Playback(loligo/is-not-set);
  604. Hangup;
  605. };
  606. &stdexten(${ssd_extension});
  607. Congestion(10);
  608. Hangup;
  609. };
  610. };
  611. macro check-psd-exists ( ext ) {
  612. Realtime(psd|extension|${ext}|psd_);
  613. if ("${psd_extension}foo" = "foo") {
  614. System(/usr/local/bin/create_psd.sh ${ext});
  615. } else
  616. NoOp(PSD set for ${ext});
  617. };
  618. context app-psd {
  619. // *89 <xx> <y.> - Set personal speed dial <xx> to digits <y.>
  620. // *89 <xx> 0 - Delete personal speed dial <xx>
  621. // *89 <xx> - Review personal speed dial <xx>
  622. // *2xx - Dial personal speed dial <xx>
  623. _*89XXX. => {
  624. &check-psd-exists(${CALLERIDNUM:5});
  625. Answer;
  626. RealtimeUpdate(psd|extension|${CALLERIDNUM:5}|s${EXTEN:3:2}|${EXTEN:5});
  627. System(/usr/local/bin/db_update.sh personalsd s${EXTEN:3:2} ${EXTEN:5} extension ${CALLERIDNUM:5} &);
  628. Wait(1);
  629. Playback(loligo/speed-dial);
  630. SayDigits(${EXTEN:3:2});
  631. Playback(loligo/has-been-set-to);
  632. SayDigits(${EXTEN:5});
  633. Hangup;
  634. };
  635. _*89XX0 => {
  636. &check-psd-exists(${CALLERIDNUM:5});
  637. Answer;
  638. RealtimeUpdate(psd|extension|${CALLERIDNUM:5}|s${EXTEN:3:2}|);
  639. System(/usr/local/bin/db_update.sh personalsd s${EXTEN:3:2} '' extension ${CALLERIDNUM:5} &);
  640. Wait(1);
  641. Playback(loligo/speed-dial);
  642. SayDigits(${EXTEN:3:2});
  643. Playback(loligo/has-been-cleared);
  644. Hangup;
  645. };
  646. _*89XX => {
  647. &check-psd-exists(${CALLERIDNUM:5});
  648. Answer;
  649. Realtime(psd|extension|${CALLERIDNUM:5}|psd_);
  650. Wait(1);
  651. if ("${psd_s${EXTEN:3:2}}foo" = "foo") {
  652. Playback(loligo/speed-dial);
  653. SayDigits(${EXTEN:3:2});
  654. Playback(loligo/is-not-set);
  655. Hangup;
  656. };
  657. Playback(loligo/speed-dial);
  658. SayDigits(${EXTEN:3:2});
  659. Playback(loligo/is-set-to);
  660. SayDigits(${psd_s${EXTEN:3:2}});
  661. Hangup;
  662. };
  663. // NTC = number to call
  664. _*2XX => {
  665. &check-psd-exists(${CALLERIDNUM:5});
  666. Realtime(psd|extension|${CALLERIDNUM:5}|psd_);
  667. if ("${psd_s${EXTEN:2}}foo" = "foo") {
  668. Answer;
  669. Wait(1);
  670. Playback(loligo/speed-dial);
  671. SayDigits(${EXTEN:2});
  672. Playback(loligo/is-not-set);
  673. Hangup;
  674. };
  675. &stdexten(${psd_s${EXTEN:2}});
  676. Congestion(10);
  677. Hangup;
  678. };
  679. };
  680. context app-helpdesk {
  681. *4357 => {
  682. &stdexten(41950);
  683. Congestion;
  684. };
  685. };
  686. context app-conferences {
  687. // waiting for room number announcement
  688. *86 => goto app-conf-hidden|s|1;
  689. };
  690. context app-conf-hidden {
  691. s => {
  692. Wait(1);
  693. Playback(loligo/please-enter-the);
  694. Playback(loligo/extension);
  695. read(roomtoenter,loligo/then-press-pound);
  696. Meetme(${roomtoenter});
  697. Waitexten(8);
  698. Hangup;
  699. };
  700. _1. => Meetme(${EXTEN});
  701. };
  702. ///////////////////////////////////////////////////////////////////////////////
  703. // Extensions pulled from vm.conf:
  704. context vm-include {
  705. includes {
  706. vm-direct;
  707. vm-extension;
  708. vm-directory;
  709. };
  710. };
  711. context vm-direct {
  712. s => {
  713. Dial(SIP/5555@svm1.shsu.edu,20);
  714. Playback(im-sorry);
  715. Playback(voice-mail-system);
  716. Playback(down);
  717. Playback(extra/pls-try-call-later);
  718. Congestion(10);
  719. Hangup;
  720. };
  721. };
  722. context vm-extension {
  723. s => {
  724. Dial(SIP/62100@svm1.shsu.edu,20);
  725. Playback(im-sorry);
  726. Playback(voice-mail-system);
  727. Playback(down);
  728. Playback(extra/pls-try-call-later);
  729. Congestion(10);
  730. Hangup;
  731. };
  732. };
  733. context vm-directory {
  734. 5556 => {
  735. Dial(SIP/5556@svm1.shsu.edu);
  736. Playback(im-sorry);
  737. Playback(voice-mail-system);
  738. Playback(down);
  739. Playback(extra/pls-try-call-later);
  740. Congestion(10);
  741. Hangup;
  742. };
  743. };