root/modules/branches/2.2/callwaiting/functions.inc.php

Revision 1399, 2.0 kB (checked in by mheydon1973, 7 years ago)

FeatureCodes should be all now working. New module for admin'ing them as well

  • 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 callwaiting_get_config($engine) {
4   $modulename = 'callwaiting';
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 callwaiting_cwon($c) {
32   global $ext;
33
34   $id = "app-callwaiting-cwon"; // 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(CW/${CALLERID(number)})', 'ENABLED'));
42   $ext->add($id, $c, '', new ext_playback('call-waiting&activated')); // $cmd,n,Playback(...)
43   $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid)
44 }
45
46
47 function callwaiting_cwoff($c) {
48   global $ext;
49
50   $id = "app-callwaiting-cwoff"; // The context to be included
51
52   $ext->addInclude('from-internal-additional', $id); // Add the include from from-internal
53
54   $ext->add($id, $c, '', new ext_answer('')); // $cmd,1,Answer
55   $ext->add($id, $c, '', new ext_wait('1')); // $cmd,n,Wait(1)
56   $ext->add($id, $c, '', new ext_macro('user-callerid')); // $cmd,n,Macro(user-callerid)
57   $ext->add($id, $c, '', new ext_dbdel('CW/${CALLERID(number)}'));
58   $ext->add($id, $c, '', new ext_playback('call-waiting&de-activated')); // $cmd,n,Playback(...)
59   $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid)
60 }
61 ?>
Note: See TracBrowser for help on using the browser.