- 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.
112 lines
3.6 KiB
PHP
112 lines
3.6 KiB
PHP
<?php
|
|
|
|
use Workflow\VTTemplate;
|
|
|
|
require_once(realpath(dirname(__FILE__).'/../autoload_wf.php'));
|
|
|
|
|
|
class WfTaskCommunicateSMS extends \Workflow\Task
|
|
{
|
|
public function handleTask(&$context) {
|
|
if($this->get('provider') == -1) {
|
|
throw new \Exception('Please configure SMS Provider!');
|
|
}
|
|
|
|
/**
|
|
* @var $obj \Workflow\Plugins\ConnectionProvider\Communicate
|
|
*/
|
|
$obj = \Workflow\ConnectionProvider::getConnection($this->get('provider'));
|
|
|
|
// If continued, check if SMS was received!
|
|
if($this->isContinued()) {
|
|
$continued = intval($context->getEnvironment('_continued_'.$this->getBlockId()));
|
|
|
|
$data = $context->getEnvironment('_smsdata_'.$this->getBlockId());
|
|
|
|
$return = $obj->SMS_check($data);
|
|
|
|
if($return === false) {
|
|
switch ($continued) {
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
$time = 10;
|
|
break;
|
|
case 4:
|
|
case 5:
|
|
$time = 60;
|
|
break;
|
|
case 6:
|
|
case 7:
|
|
// 12h
|
|
$time = 720;
|
|
break;
|
|
default:
|
|
// After 6 retry, cancel check
|
|
\Workflow\ExecutionLogger::getCurrentInstance()->log('SMS Deliverycheck failed. Stop further checks.');
|
|
return false;
|
|
break;
|
|
}
|
|
$context->setEnvironment('_continued_'.$this->getBlockId(), $continued + 1);
|
|
$this->addQueue($context, time() + (60 * $time), true);
|
|
}
|
|
|
|
// STOP Workflow after this task to not reexecute something
|
|
return false;
|
|
}
|
|
|
|
$objTemplate = new VTTemplate($context);
|
|
$data = $objTemplate->render($this->get('data'));
|
|
|
|
\Workflow\ExecutionLogger::getCurrentInstance()->log('Send SMS');
|
|
\Workflow\ExecutionLogger::getCurrentInstance()->log($data);
|
|
|
|
$return = $obj->SMS($data);
|
|
|
|
if(!empty($return)) {
|
|
$context->setEnvironment('_smsdata_'.$this->getBlockId(), $return);
|
|
$context->setEnvironment('_continued_'.$this->getBlockId(), 1);
|
|
|
|
\Workflow\ExecutionLogger::getCurrentInstance()->log('Response from SMS Gateway');
|
|
\Workflow\ExecutionLogger::getCurrentInstance()->log($return);
|
|
|
|
$this->addQueue($context, time() + 600, true);
|
|
}
|
|
|
|
|
|
return "yes";
|
|
}
|
|
|
|
public function beforeGetTaskform($viewer) {
|
|
$AvailableProvider = \Workflow\ConnectionProvider::getAvailableConfigurations('communicate');
|
|
|
|
$supportedProvider = array();
|
|
foreach($AvailableProvider as $id => $provider) {
|
|
/**
|
|
* @var $obj Workflow\CommunicationPlugin
|
|
*/
|
|
$obj = \Workflow\ConnectionProvider::getConnection($id);
|
|
|
|
if($obj->isSupported('SMS')) {
|
|
$supportedProvider[$id] = $provider;
|
|
}
|
|
}
|
|
|
|
$viewer->assign('provider', $supportedProvider);
|
|
|
|
if($this->get('provider') != -1) {
|
|
$obj = \Workflow\ConnectionProvider::getConnection($this->get('provider'));
|
|
$dataFields = $obj->getDataFields('SMS');
|
|
|
|
foreach($dataFields as $name => $data) {
|
|
$dataFields[$name]['name'] = 'task[data]['.$name.']';
|
|
}
|
|
|
|
$viewer->assign('dataFields', $dataFields);
|
|
}
|
|
|
|
/* Insert here source code to create custom configurations pages */
|
|
}
|
|
|
|
}
|