[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Connect.php
<?php declare(strict_types=1); namespace Vonage\Voice\NCCO\Action; use InvalidArgumentException; use Vonage\Voice\Endpoint\EndpointInterface; use Vonage\Voice\VoiceObjects\AdvancedMachineDetection; use Vonage\Voice\Webhook; class Connect implements ActionInterface { public const EVENT_TYPE_SYNCHRONOUS = 'synchronous'; public const MACHINE_CONTINUE = 'continue'; public const MACHINE_HANGUP = 'hangup'; protected ?string $from = ''; protected ?string $eventType = ''; protected int $timeout = 0; protected int $limit = 0; protected $machineDetection = ''; protected ?Webhook $eventWebhook = null; protected ?string $ringbackTone = ''; protected ?AdvancedMachineDetection $advancedMachineDetection = null; public function __construct(protected EndpointInterface $endpoint) { } public static function factory(EndpointInterface $endpoint): Connect { return new Connect($endpoint); } /** * @return array|mixed */ #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->toNCCOArray(); } public function toNCCOArray(): array { $data = [ 'action' => 'connect', 'endpoint' => [$this->endpoint->toArray()], ]; if ($this->getTimeout()) { $data['timeout'] = $this->getTimeout(); } if ($this->getLimit()) { $data['limit'] = $this->getLimit(); } if ($this->getMachineDetection()) { $data['machineDetection'] = $this->getMachineDetection(); } if ($this->getAdvancedMachineDetection()) { $data['advancedMachineDetection'] = $this->getAdvancedMachineDetection()->toArray(); } $from = $this->getFrom(); if ($from) { $data['from'] = $from; } $eventType = $this->getEventType(); if ($eventType) { $data['eventType'] = $eventType; } $eventWebhook = $this->getEventWebhook(); if ($eventWebhook) { $data['eventUrl'] = [$eventWebhook->getUrl()]; $data['eventMethod'] = $eventWebhook->getMethod(); } $ringbackTone = $this->getRingbackTone(); if ($ringbackTone) { $data['ringbackTone'] = $ringbackTone; } return $data; } public function getFrom(): ?string { return $this->from; } /** * @return $this */ public function setFrom(string $from): self { $this->from = $from; return $this; } public function getEventType(): ?string { return $this->eventType; } /** * @return $this */ public function setEventType(string $eventType): self { if ($eventType !== self::EVENT_TYPE_SYNCHRONOUS) { throw new InvalidArgumentException('Unknown event type for Connection action'); } $this->eventType = $eventType; return $this; } public function getTimeout(): ?int { return $this->timeout; } /** * @return $this */ public function setTimeout(int $timeout): self { $this->timeout = $timeout; return $this; } public function getLimit(): ?int { return $this->limit; } /** * @return $this */ public function setLimit(int $limit): self { $this->limit = $limit; return $this; } public function getMachineDetection(): ?string { return $this->machineDetection; } /** * @return $this */ public function setMachineDetection(string $machineDetection): self { if ( $machineDetection !== self::MACHINE_CONTINUE && $machineDetection !== self::MACHINE_HANGUP ) { throw new InvalidArgumentException('Unknown machine detection type'); } $this->machineDetection = $machineDetection; return $this; } public function getEventWebhook(): ?Webhook { return $this->eventWebhook; } /** * @return $this */ public function setEventWebhook(Webhook $eventWebhook): self { $this->eventWebhook = $eventWebhook; return $this; } public function getRingbackTone(): ?string { return $this->ringbackTone; } /** * @return $this */ public function setRingbackTone(string $ringbackTone): self { $this->ringbackTone = $ringbackTone; return $this; } public function getAdvancedMachineDetection(): ?AdvancedMachineDetection { return $this->advancedMachineDetection; } public function setAdvancedMachineDetection(AdvancedMachineDetection $advancedMachineDetection): static { $this->advancedMachineDetection = $advancedMachineDetection; return $this; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.42 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002