root/modules/branches/2.5/voicemail/install.php

Revision 4654, 1.1 kB (checked in by p_lindheimer, 6 years ago)

changed install script to return false on astman not there and removed inproper use of checkAstMan

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
Line 
1 <?php
2 global $astman;
3 global $amp_conf;
4
5 // Register FeatureCode - Activate
6 $fcc = new featurecode('voicemail', 'myvoicemail');
7 $fcc->setDescription('My Voicemail');
8 $fcc->setDefault('*97');
9 $fcc->update();
10 unset($fcc);
11
12 // Register FeatureCode - Deactivate
13 $fcc = new featurecode('voicemail', 'dialvoicemail');
14 $fcc->setDescription('Dial Voicemail');
15 $fcc->setDefault('*98');
16 $fcc->update();
17 unset($fcc);
18
19 //1.6.2
20 $modinfo = module_getinfo('voicemail');
21 if (is_array($modinfo)) {
22   $ver = $modinfo['voicemail']['dbversion'];
23   if (version_compare($ver,'1.6.2','lt')) { //we have to fix existing users with wrong values for vm ticket #1697
24     if ($astman) {
25       $sql = "select * from users where voicemail='disabled' or voicemail='';";
26       $users = sql($sql,"getAll",DB_FETCHMODE_ASSOC);
27       foreach($users as $user) {
28         $astman->database_put("AMPUSER",$user['extension']."/voicemail","\"novm\"");
29       }
30     } else {
31       echo _("Cannot connect to Asterisk Manager with ").$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"];
32       return false;
33     }
34     sql("update users set voicemail='novm' where voicemail='disabled' or voicemail='';");
35   }
36 }
37
38 ?>
Note: See TracBrowser for help on using the browser.