root/modules/branches/2.3/speeddial/functions.inc.php

Revision 3128, 6.2 kB (checked in by gregmac, 6 years ago)

Removed pbdirectory destination from speeddial module

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 <?php
2  /* $Id:$ */
3
4 function speeddial_get_config($engine) {
5         $modulename = 'speeddial';
6
7         // This generates the dialplan
8         global $ext;
9         switch($engine) {
10     case "asterisk":
11       $fcc = new featurecode('speeddial', 'callspeeddial');
12       $callcode = $fcc->getCodeActive();
13       unset($fcc);
14      
15       $fcc = new featurecode('speeddial', 'setspeeddial');
16       $setcode = $fcc->getCodeActive();
17       unset($fcc);
18
19       if (!empty($code)) {
20         $ext->add('app-pbdirectory', $code, '', new ext_answer(''));
21         $ext->add('app-pbdirectory', $code, '', new ext_wait(1));
22         $ext->add('app-pbdirectory', $code, '', new ext_goto(1,'pbdirectory'));
23       }
24
25       // [macro-speeddial-clean]
26       // clean the 0's off of the variable named passed in ARG1
27       $ext->add('macro-speeddial-clean', 's', '', new ext_noop('Cleaing (stripping leading 0s from ${${ARG1}}) in var ${ARG1}'));
28       // while ( substr($$arg1,0,1) = '0') {
29       $ext->add('macro-speeddial-clean', 's', 'start', new ext_gotoif('$[${${ARG1}:0:1}=0]','strip','clean'));
30       //   $$arg1 = substr($$arg1,1);
31       $ext->add('macro-speeddial-clean', 's', 'strip', new ext_set('${ARG1}','${${ARG1}:1}'));
32       // }
33       $ext->add('macro-speeddial-clean', 's', '', new ext_goto('start'));
34       $ext->add('macro-speeddial-clean', 's', 'clean', new ext_noop('${ARG1} cleaned to ${${ARG1}}'));
35      
36      
37       // [macro-speeddial-lookup]
38       // arg1 is speed dial location,  arg2 (optional) is user caller ID
39       $ext->add('macro-speeddial-lookup', 's', '', new ext_gotoif('$["${ARG2}"=""]]','lookupsys'));
40       $ext->add('macro-speeddial-lookup', 's', '', new ext_set('SPEEDDIALNUMBER',''));
41       $ext->add('macro-speeddial-lookup', 's', 'lookupuser', new ext_dbget('SPEEDDIALNUMBER','AMPUSER/${ARG2}/speeddials/${ARG1}'));
42       $ext->add('macro-speeddial-lookup', 's', '', new ext_gotoif('$["${SPEEDDIALNUMBER}"=""]','lookupsys'));
43       $ext->add('macro-speeddial-lookup', 's', '', new ext_noop('Found speeddial ${ARG1} for user ${ARG2}: ${SPEEDDIALNUMBER}'));
44       $ext->add('macro-speeddial-lookup', 's', '', new ext_goto('end'));
45       $ext->add('macro-speeddial-lookup', 's', 'lookupsys', new ext_dbget('SPEEDDIALNUMBER','sysspeeddials/${ARG1}'), 'lookupuser',101);
46       $ext->add('macro-speeddial-lookup', 's', '', new ext_gotoif('$["${SPEEDDIALNUMBER}"=""]','failed'));
47       $ext->add('macro-speeddial-lookup', 's', '', new ext_noop('Found system speeddial ${ARG1}: ${SPEEDDIALNUMBER}'));
48       $ext->add('macro-speeddial-lookup', 's', '', new ext_goto('end'));
49       $ext->add('macro-speeddial-lookup', 's', 'failed', new ext_noop('No system or user speeddial found'), 'lookupsys',101);
50       $ext->add('macro-speeddial-lookup', 's', 'end', new ext_noop('End of Speeddial-lookup'));
51      
52       if (!empty($callcode)) {
53         $ext->add('app-speeddial', '_'.$callcode.'.', '', new ext_macro('user-callerid',''));
54         $ext->add('app-speeddial', '_'.$callcode.'.', '', new ext_set('SPEEDDIALLOCATION','${EXTEN:'.(strlen($callcode)).'}'));
55         $ext->add('app-speeddial', '_'.$callcode.'.', '', new ext_macro('speeddial-clean','SPEEDDIALLOCATION'));
56         $ext->add('app-speeddial', '_'.$callcode.'.', 'lookup', new ext_macro('speeddial-lookup','${SPEEDDIALLOCATION},${CALLERID(num)}'));
57         $ext->add('app-speeddial', '_'.$callcode.'.', '', new ext_gotoif('$["${SPEEDDIALNUMBER}"=""]','failed'));
58         $ext->add('app-speeddial', '_'.$callcode.'.', '', new ext_dial('Local/${SPEEDDIALNUMBER}@from-internal/n','',''));
59        
60         $ext->add('app-speeddial', '_'.$callcode.'.', 'failed', new ext_playback('speed-dial-empty'), 'lookup',101);
61         $ext->add('app-speeddial', '_'.$callcode.'.', '', new ext_congestion(''));
62        
63       }
64      
65       if (!empty($setcode)) {
66         $ext->add('app-speeddial', $setcode, '', new ext_goto(1, 's', 'app-speeddial-set'));
67       }
68      
69      
70      
71       $ext->add('app-speeddial-set', 's', '', new ext_macro('user-callerid',''));
72       // "enter speed dial location number"
73       $ext->add('app-speeddial-set', 's', 'setloc', new ext_read('newlocation','speed-enterlocation'));
74       $ext->add('app-speeddial-set', 's', '', new ext_macro('speeddial-clean','newlocation'));
75       $ext->add('app-speeddial-set', 's', 'lookup', new ext_macro('speeddial-lookup','${newlocation},${CALLERID(num)}'));
76       $ext->add('app-speeddial-set', 's', 'lookup', new ext_gotoif('$["${SPEEDDIALNUMBER}"!=""]', 'conflicts'));
77      
78       // "enter phone number"
79       $ext->add('app-speeddial-set', 's', 'setnum', new ext_read('newnum','speed-enternumber'));
80      
81      
82       $ext->add('app-speeddial-set', 's', 'success', new ext_dbput('AMPUSER/${CALLERID(num)}/speeddials/${newlocation}','${newnum}'));
83       // "speed dial location "
84       $ext->add('app-speeddial-set', 's', '', new ext_playback('speed-dial'));
85       $ext->add('app-speeddial-set', 's', '', new ext_saynumber('${newlocation}'));
86       // "is set to "
87       $ext->add('app-speeddial-set', 's', '', new ext_playback('is-set-to'));
88       $ext->add('app-speeddial-set', 's', '', new ext_saydigits('${newnum}'));
89       $ext->add('app-speeddial-set', 's', '', new ext_hangup(''));
90
91      
92       // conflicts menu
93       // "speed dial location"
94       $ext->add('app-speeddial-set', 's', 'conflicts', new ext_playback('speed-dial'));
95       $ext->add('app-speeddial-set', 's', '', new ext_saynumber('${newlocation}'));
96       // "is already set."
97       $ext->add('app-speeddial-set', 's', '', new ext_playback('is-in-use'));
98       // "Press 1 to hear current phone number, 2 to pick a new location, 3 to set a new phone number"
99       $ext->add('app-speeddial-set', 's', '', new ext_background('press-1&to-listen-to-it&press-2&to-enter-a-diff&location&press-3&to-change&telephone-number'));
100      
101       // "speed dial location"
102       $ext->add('app-speeddial-set', '1', '', new ext_playback('speed-dial'));
103       $ext->add('app-speeddial-set', '1', '', new ext_saynumber('${newlocation}'));
104       // "is set to "
105       $ext->add('app-speeddial-set', '1', '', new ext_playback('is-set-to'));
106       $ext->add('app-speeddial-set', '1', '', new ext_saydigits('${SPEEDDIALNUMBER}'));
107       $ext->add('app-speeddial-set', '1', '', new ext_goto('conflicts','s'));
108      
109       $ext->add('app-speeddial-set', '2', '', new ext_goto('setloc','s'));
110      
111       $ext->add('app-speeddial-set', '3', '', new ext_goto('setnum','s'));
112      
113       $ext->add('app-speeddial-set', 't', '', new ext_congestion(''));
114      
115      
116       $ext->addInclude('from-internal-additional', 'app-speeddial');
117      
118     break;
119         }
120 }
121
122 ?>
Note: See TracBrowser for help on using the browser.