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

Revision 5069, 1.8 kB (checked in by p_lindheimer, 1 year ago)

#1767 add weather to contributed module repository

  • Property svn:executable set to *
Line 
1 <?php
2
3 function weather_get_config($engine) {
4         $modulename = 'weather';
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 weather_weather($c) {
32         global $ext;
33
34         $id = "app-weather"; // 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_macro('user-callerid'));
39         $ext->add($id, $c, '', new ext_answer('')); // $cmd,1,Answer
40         $ext->add($id, $c, '', new ext_wait('1'));
41         $ext->add($id, $c, '', new ext_DigitTimeout('7'));
42         $ext->add($id, $c, '', new ext_ResponseTimeout('10'));
43         $ext->add($id, $c, '', new ext_Flite("At the beep enter the five digit zip code for the weather report you wish to retrieve."));
44         $ext->add($id, $c, '', new ext_Read('ZIPCODE,beep,5'));
45         $ext->add($id, $c, '', new ext_Flite("Please hold a moment while we contact the National Weather Service for your report."));                   
46         $ext->add($id, $c, '', new ext_AGI('nv-weather-zip.php|${ZIPCODE}'));
47         $ext->add($id, $c, '', new ext_NoOp('Wave file: ${TMPWAVE}'));
48         $ext->add($id, $c, '', new ext_Playback('${TMPWAVE}'));
49         $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid)
50 }
51
52 ?>
Note: See TracBrowser for help on using the browser.