Show
Ignore:
Timestamp:
10/24/10 13:49:06 (3 years ago)
Author:
mbrevda
Message:

re #4603 - no need to connect to asterisk to archive recoded calls

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.8/amp_conf/bin/archive_recordings

    r9750 r10443  
    33 
    44define("AMP_CONF", "/etc/amportal.conf"); 
    5 define("PHP_ASMANAGER", "php-asmanager.php"); 
    65define("MONITOR_DIR", "/var/spool/asterisk/monitor"); 
    76 
     
    4746    'USECATEGORIES' => true, 
    4847    'ASTETCDIR' => '/etc/asterisk', 
    49     'ASTMANAGERPORT' => '5038', 
    5048    'CDRDBNAME' => 'asteriskcdrdb', 
    5149    ); 
     
    242240    $cdrRecord['extension']=substr($cdrRecord['dstchannel'],strpos($cdrRecord['dstchannel'],"/")+1,(strpos($cdrRecord['dstchannel'],"-")-strpos($cdrRecord['dstchannel'],"/")-1)); //cut out the channel number 
    243241    outn("Checking if ".$cdrRecord['extension']." has recordings enabled.."); 
    244     $extrecord = check_recording_option($cdrRecord['extension']); 
    245242    $cdrRecord['direction']="in"; 
    246     if ($extrecord == "ENABLED") { 
    247       out("YES"); 
    248     } else { 
    249       out("NO"); 
    250       unset($cdrRecord['extension']); 
    251     } 
    252243  } else if (strpos($calltype,"queue") === 0) { 
    253244    if($debug) debug("Getting queue destination from dst: ".$cdrRecord['dst']); 
     
    262253  return($cdrRecord); 
    263254} 
    264  
    265  
    266 function check_recording_option($extension) { 
    267   global $amp_conf; 
    268   global $astman; 
    269  
    270   if ($astman) { 
    271     return $astman->database_get("RECORD-IN",$extension); 
    272   } else { 
    273     fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]);   
    274   } 
    275    
    276 } 
    277  
    278255 
    279256// Create list of all files  
     
    412389out("OK"); 
    413390 
    414 // **** Make sure we have php-asmanager.php, and include it 
    415  
    416 outn("Checking for PHP_ASMANAGER.."); 
    417 $myfile = $amp_conf['AMPWEBROOT'] . "/admin/common/" .  PHP_ASMANAGER ; 
    418 if (! @ include( $myfile  ) ) { 
    419   out("FAILED"); 
    420   fatal("Cannot include $myfile"); 
    421 } 
    422 out("OK"); 
    423  
    424 // **** now make the global manager connection 
    425 $astman = new AGI_AsteriskManager(); 
    426 $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"] ); 
    427 if (!$res) { 
    428   fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
    429 } 
    430  
    431  
    432391// **** Connect to database 
    433392outn("Connecting to database..");