root/modules/branches/2.1/donotdisturb/functions.inc.php

Revision 1404, 2.1 kB (checked in by mheydon1973, 7 years ago)

DND module

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1 <?php
2
3 function donotdisturb_get_config($engine) {
4   $modulename = 'donotdisturb';
5  
6   // This generates the dialplan
7   global $ext; 
8   switch($engine) {
9     case "asterisk":
10       if (is_array($featurelist = featurecodes_getModuleFeatures($modulename))) {
11         foreach($featurelist as $item) {
12           $featurename = $item['featurename'];
13           $fname = $modulename.'_'.$featurename;
14           if (function_exists($fname)) {
15             $fcc = new featurecode($modulename, $featurename);
16             $fc = $fcc->getCodeActive();
17             unset($fcc);
18             
19             if ($fc != '')
20               $fname($fc);
21           } else {
22             $ext->add('from-internal-additional', 'debug', '', new ext_noop($modulename.": No func $fname"));
23             var_dump($item);
24           }
25         }
26       }
27     break;
28   }
29 }
30
31 function donotdisturb_dnd_on($c) {
32   global $ext;
33
34   $id = "app-dnd-on"; // The context to be included
35
36   $ext->addInclude('from-internal-additional', $id); // Add the include from from-internal
37
38   $ext->add($id, $c, '', new ext_answer('')); // $cmd,1,Answer
39   $ext->add($id, $c, '', new ext_wait('1')); // $cmd,n,Wait(1)
40   $ext->add($id, $c, '', new ext_macro('user-callerid')); // $cmd,n,Macro(user-callerid)
41   $ext->add($id, $c, '', new ext_setvar('DB(DND/${CALLERID(number)})', 'YES')); // $cmd,n,Set(...=YES)
42   $ext->add($id, $c, '', new ext_playback('do-not-disturb&activated')); // $cmd,n,Playback(...)
43   $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid)
44 }
45     
46 function donotdisturb_dnd_off($c) {
47   global $ext;
48
49   $id = "app-dnd-off"; // The context to be included
50
51   $ext->addInclude('from-internal-additional', $id); // Add the include from from-internal
52
53   $ext->add($id, $c, '', new ext_answer('')); // $cmd,1,Answer
54   $ext->add($id, $c, '', new ext_wait('1')); // $cmd,n,Wait(1)
55   $ext->add($id, $c, '', new ext_macro('user-callerid')); // $cmd,n,Macro(user-callerid)
56   $ext->add($id, $c, '', new ext_dbdel('DND/${CALLERID(number)}')); // $cmd,n,DBdel(..)
57   $ext->add($id, $c, '', new ext_playback('do-not-disturb&de-activated')); // $cmd,n,Playback(...)
58   $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid)
59 }
60
61 ?>
Note: See TracBrowser for help on using the browser.