- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
69 lines
2.1 KiB
PHP
69 lines
2.1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
namespace SPVoipIntegration\mcntelecom\notifications;
|
|
|
|
use SPVoipIntegration\mcntelecom\MCNFactory;
|
|
use SPVoipIntegration\loggers\Logger;
|
|
/**
|
|
* Description of MCNOutboundEnd
|
|
*
|
|
* @author nikita
|
|
*/
|
|
class MCNOutboundEnd extends MCNAbstractNotification{
|
|
|
|
protected $fieldsMapping = array(
|
|
'endtime' => 'endtime',
|
|
'billduration' => 'billsec',
|
|
'totalduration' => 'totalduration',
|
|
'callstatus' => 'callstatus',
|
|
'sp_is_recorded' => 'record',
|
|
'recordingurl' => 'recordingurl',
|
|
'sp_is_local_cached' => 'sp_is_local_cached'
|
|
);
|
|
|
|
protected function canCreatePBXRecord() {
|
|
return false;
|
|
}
|
|
|
|
protected function prepareNotificationModel() {
|
|
$totalDuration = $this->pbxManagerModel->get('totalduration');
|
|
$this->set('endtime', date('Y-m-d H:i:s'));
|
|
$this->set('totalduration', $totalDuration + $this->get('billsec'));
|
|
$this->set('callstatus', 'completed');
|
|
if ($this->get('record')) {
|
|
$this->saveRecord();
|
|
}
|
|
}
|
|
|
|
protected function saveRecord() {
|
|
sleep(3);
|
|
try {
|
|
$factory = new MCNFactory();
|
|
$apiManager = $factory->getCallApiManager();
|
|
$callId = $this->get('call_id');
|
|
|
|
$audioContent = $apiManager->getRecord($callId);
|
|
|
|
$filePath = $this->generateSoundFileName();
|
|
$status = file_put_contents($filePath, $audioContent);
|
|
if ($status === false) {
|
|
throw new Exception('Cant save audio file');
|
|
}
|
|
|
|
$this->set('recordingurl', $filePath);
|
|
$this->set('sp_is_local_cached', 1);
|
|
} catch (\Exception $ex) {
|
|
Logger::log('Error on save audiofile', $ex);
|
|
}
|
|
}
|
|
|
|
private function generateSoundFileName() {
|
|
return "storage/{$this->getSourceUUId()}.mp3";
|
|
}
|
|
|
|
} |