root/contributed_modules/modules/silentmonitor/functions.inc.php

Revision 5397, 5.1 kB (checked in by p_lindheimer, 1 year ago)

add silentmonitor to contributed modules directory. I'll consider adding this to the released product once I get some testers to confirm that it works properly. In addition, it should be changed to add/remove the 1.4+ only feature codes during retrieve_conf upon detecting a change in asterisk version in addition to at install/uninstall time - or shoudl just have dependencies added to make it 1.4 only

Line 
1 <?php
2
3 function silentmonitor_get_config($engine) {
4         $modulename = 'silentmonitor';
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('supervisors', 'debug', '', new ext_noop($modulename.": No func $fname"));
23                                                 var_dump($item);
24                                         }
25                                 }
26                         }
27                         break;
28         }
29 }
30 function silentmonitor_in($c,$mode) {
31         global $ext;
32         $id = "app-silentmonitor"; // The context to be included
33
34         $ext->add('supervisors', 'h', '', new ext_hangup());
35         $ext->addInclude('supervisors', 'from-internal');
36         $ext->addInclude('supervisors', $id); // Add the include from from-internal
37
38         $ext->add($id, $c, '', new ext_answer());
39         $ext->add($id, $c, 'st', new ext_playback('please-enter-the&&extension')); // $cmd,1,Answer
40        
41         $ext->add($id, $c, '', new ext_read('extn', 'then-press-pound')); // $cmd,n,Wait(1)
42         $ext->add($id, $c, '', new ext_setvar('usr', '${DB(AMPUSER/${extn}/device)}'));
43         $ext->add($id, $c, '', new ext_setvar('devicedial', '${DB(DEVICE/${usr}/dial)}'));
44         $ext->add($id, $c, '', new ext_gotoif('$["${devicedial}" = "NONE"]', 'nousr'));
45         $ext->add($id, $c, '', new ext_playback('monitored'));
46         $ext->add($id, $c, '', new ext_chanspy('${devicedial}', 'q'.$mode));
47         $ext->add($id, $c, 'nousr', new ext_playback('spy-agent&&T-is-not-available'));
48         $ext->add($id, $c, '', new ext_goto('st'));
49        
50         $c = "_$c.";
51         $ext->add($id, $c, '', new ext_answer());
52         $ext->add($id, $c, 'st', new ext_setvar('extn', '${EXTEN:3}'));
53         $ext->add($id, $c, '', new ext_setvar('usr', '${DB(AMPUSER/${extn}/device)}'));
54         $ext->add($id, $c, '', new ext_setvar('devicedial', '${DB(DEVICE/${usr}/dial)}'));
55         $ext->add($id, $c, '', new ext_gotoif('$["${devicedial}" = "NONE"]', 'nousr'));
56         $ext->add($id, $c, '', new ext_playback('monitored'));
57         $ext->add($id, $c, '', new ext_chanspy('${devicedial}', 'q'.$mode));
58         $ext->add($id, $c, 'nousr', new ext_playback('spy-agent&&T-is-not-available'));
59         $ext->add($id, $c, '', new ext_goto('st'));
60
61        
62  }
63 function silentmonitor_whisper($c) {
64         global $ext;
65
66         $id = "app-silentmonitor"; // The context to be included
67
68         $ext->add($id, $c, '', new ext_answer());
69         $ext->add($id, $c, 'st', new ext_playback('please-enter-the&&extension')); // $cmd,1,Answer
70         $ext->add($id, $c, '', new ext_read('extn', 'then-press-pound')); // $cmd,n,Wait(1)
71         $ext->add($id, $c, '', new ext_setvar('usr', '${DB(AMPUSER/${extn}/device)}'));
72         $ext->add($id, $c, '', new ext_setvar('devicedial', '${DB(DEVICE/${usr}/dial)}'));
73         $ext->add($id, $c, '', new ext_gotoif('$["${devicedial}" = "NONE"]', 'nousr'));
74         $ext->add($id, $c, '', new ext_playback('monitored'));
75         $ext->add($id, $c, '', new ext_chanspy('${devicedial}', 'qw'));
76         $ext->add($id, $c, 'nousr', new ext_playback('spy-agent&&T-is-not-available'));
77         $ext->add($id, $c, '', new ext_goto('st'));
78        
79         $c = "_$c.";
80         $ext->add($id, $c, '', new ext_answer());
81         $ext->add($id, $c, 'st', new ext_setvar('extn', '${EXTEN:3}'));
82         $ext->add($id, $c, '', new ext_setvar('usr', '${DB(AMPUSER/${extn}/device)}'));
83         $ext->add($id, $c, '', new ext_setvar('devicedial', '${DB(DEVICE/${usr}/dial)}'));
84         $ext->add($id, $c, '', new ext_gotoif('$["${devicedial}" = "NONE"]', 'nousr'));
85         $ext->add($id, $c, '', new ext_playback('monitored'));
86         $ext->add($id, $c, '', new ext_chanspy('${devicedial}', 'qw'));
87         $ext->add($id, $c, 'nousr', new ext_playback('spy-agent&&T-is-not-available'));
88         $ext->add($id, $c, '', new ext_goto('st'));
89  }
90
91 function silentmonitor_whisperpv($c) {
92         global $ext;
93
94         $id = "app-silentmonitor";
95         $ext->add($id, $c, '', new ext_answer());
96         $ext->add($id, $c, 'st', new ext_playback('please-enter-the&&extension')); // $cmd,1,Answer
97         $ext->add($id, $c, '', new ext_read('extn', 'then-press-pound')); // $cmd,n,Wait(1)
98         $ext->add($id, $c, '', new ext_setvar('usr', '${DB(AMPUSER/${extn}/device)}'));
99         $ext->add($id, $c, '', new ext_setvar('devicedial', '${DB(DEVICE/${usr}/dial)}'));
100         $ext->add($id, $c, '', new ext_gotoif('$["${devicedial}" = "NONE"]', 'nousr'));
101         $ext->add($id, $c, '', new ext_playback('monitored'));
102         $ext->add($id, $c, '', new ext_chanspy('${devicedial}', 'qW'));
103         $ext->add($id, $c, 'nousr', new ext_playback('spy-agent&&T-is-not-available'));
104         $ext->add($id, $c, '', new ext_goto('st'));
105
106         $c = "_$c.";
107         $ext->add($id, $c, '', new ext_answer());
108         $ext->add($id, $c, 'st', new ext_setvar('extn', '${EXTEN:3}'));
109         $ext->add($id, $c, '', new ext_setvar('usr', '${DB(AMPUSER/${extn}/device)}'));
110         $ext->add($id, $c, '', new ext_setvar('devicedial', '${DB(DEVICE/${usr}/dial)}'));
111         $ext->add($id, $c, '', new ext_gotoif('$["${devicedial}" = "NONE"]', 'nousr'));
112         $ext->add($id, $c, '', new ext_playback('monitored'));
113         $ext->add($id, $c, '', new ext_chanspy('${devicedial}', 'qW'));
114         $ext->add($id, $c, 'nousr', new ext_playback('spy-agent&&T-is-not-available'));
115         $ext->add($id, $c, '', new ext_goto('st'));
116  }
117 ?>
Note: See TracBrowser for help on using the browser.