extensions.ael 18 KB

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