Show
Ignore:
Timestamp:
02/09/10 20:30:31 (3 years ago)
Author:
p_lindheimer
Message:

fixes #3873 check for astman

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.7/dictate/functions.inc.php

    r7012 r8801  
    164164 
    165165  // Retrieve the dictation configuraiton from this user from ASTDB 
    166   $ena = $astman->database_get("AMPUSER",$xtn."/dictate/enabled"); 
    167   $format = $astman->database_get("AMPUSER",$xtn."/dictate/format"); 
    168   $email = $astman->database_get("AMPUSER",$xtn."/dictate/email"); 
     166  if ($astman) { 
     167    $ena = $astman->database_get("AMPUSER",$xtn."/dictate/enabled"); 
     168    $format = $astman->database_get("AMPUSER",$xtn."/dictate/format"); 
     169    $email = $astman->database_get("AMPUSER",$xtn."/dictate/email"); 
     170  } else { 
     171    fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     172  } 
    169173  // If it's blank, set it to disabled 
    170174  if (!$ena) { $ena = "disabled"; } 
     
    182186  } else { 
    183187    // Update the settings in ASTDB 
    184     $astman->database_put("AMPUSER",$ext."/dictate/enabled",$ena); 
    185     $astman->database_put("AMPUSER",$ext."/dictate/format",$fmt); 
    186     $astman->database_put("AMPUSER",$ext."/dictate/email",$email); 
     188    if ($astman) { 
     189      $astman->database_put("AMPUSER",$ext."/dictate/enabled",$ena); 
     190      $astman->database_put("AMPUSER",$ext."/dictate/format",$fmt); 
     191      $astman->database_put("AMPUSER",$ext."/dictate/email",$email); 
     192    } else { 
     193      fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     194    } 
    187195  } 
    188196} 
     
    192200 
    193201  // Clean up the tree when the user is deleted 
    194   $astman->database_deltree("AMPUSER/$ext/dictate"); 
     202  if ($astman) { 
     203    $astman->database_deltree("AMPUSER/$ext/dictate"); 
     204  } else { 
     205    fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     206  } 
    195207} 
    196208