From 533ba95e86deecf9223f6255f27668768d0aef8b Mon Sep 17 00:00:00 2001 From: Kaian Date: Wed, 25 Jan 2023 17:54:03 +0100 Subject: [PATCH 1/3] schema: add rtp timeout fields to ast_ps_endpoints table --- .../PsEndpoint.PsEndpointAbstract.orm.xml | 12 ++++++++ .../Version20230125165233.php | 29 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 schema/DoctrineMigrations/Version20230125165233.php diff --git a/library/Ivoz/Ast/Infrastructure/Persistence/Doctrine/Mapping/PsEndpoint.PsEndpointAbstract.orm.xml b/library/Ivoz/Ast/Infrastructure/Persistence/Doctrine/Mapping/PsEndpoint.PsEndpointAbstract.orm.xml index 9f9cd27a97c..d4329833805 100644 --- a/library/Ivoz/Ast/Infrastructure/Persistence/Doctrine/Mapping/PsEndpoint.PsEndpointAbstract.orm.xml +++ b/library/Ivoz/Ast/Infrastructure/Persistence/Doctrine/Mapping/PsEndpoint.PsEndpointAbstract.orm.xml @@ -144,6 +144,18 @@ + + + + + + + + + + diff --git a/schema/DoctrineMigrations/Version20230125165233.php b/schema/DoctrineMigrations/Version20230125165233.php new file mode 100644 index 00000000000..bb97be3747c --- /dev/null +++ b/schema/DoctrineMigrations/Version20230125165233.php @@ -0,0 +1,29 @@ +addSql('ALTER TABLE ast_ps_endpoints ADD rtp_timeout INT DEFAULT 60 NOT NULL, ADD rtp_timeout_hold INT DEFAULT 600 NOT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE ast_ps_endpoints DROP rtp_timeout, DROP rtp_timeout_hold'); + } +} From 2ea807bef1508a436a3a1113ec89cf6b94e25c4e Mon Sep 17 00:00:00 2001 From: Kaian Date: Wed, 25 Jan 2023 17:54:38 +0100 Subject: [PATCH 2/3] core: regenerate entities with latest scheme changes --- .../Model/PsEndpoint/PsEndpointAbstract.php | 60 ++++++++++++++++++- .../PsEndpoint/PsEndpointDtoAbstract.php | 38 ++++++++++++ .../Model/PsEndpoint/PsEndpointInterface.php | 4 ++ 3 files changed, 100 insertions(+), 2 deletions(-) diff --git a/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointAbstract.php b/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointAbstract.php index ff871bfcab5..470431473e8 100644 --- a/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointAbstract.php +++ b/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointAbstract.php @@ -161,6 +161,18 @@ abstract class PsEndpointAbstract */ protected $t38UdptlNat = 'no'; + /** + * @var int + * column: rtp_timeout + */ + protected $rtpTimeout = 60; + + /** + * @var int + * column: rtp_timeout_hold + */ + protected $rtpTimeoutHold = 600; + /** * @var ?TerminalInterface * inversedBy psEndpoint @@ -197,7 +209,9 @@ protected function __construct( string $t38Udptl, string $t38UdptlEc, int $t38UdptlMaxdatagram, - string $t38UdptlNat + string $t38UdptlNat, + int $rtpTimeout, + int $rtpTimeoutHold ) { $this->setSorceryId($sorceryId); $this->setContext($context); @@ -208,6 +222,8 @@ protected function __construct( $this->setT38UdptlEc($t38UdptlEc); $this->setT38UdptlMaxdatagram($t38UdptlMaxdatagram); $this->setT38UdptlNat($t38UdptlNat); + $this->setRtpTimeout($rtpTimeout); + $this->setRtpTimeoutHold($rtpTimeoutHold); } abstract public function getId(): null|string|int; @@ -286,6 +302,10 @@ public static function fromDto( Assertion::notNull($t38UdptlMaxdatagram, 'getT38UdptlMaxdatagram value is null, but non null value was expected.'); $t38UdptlNat = $dto->getT38UdptlNat(); Assertion::notNull($t38UdptlNat, 'getT38UdptlNat value is null, but non null value was expected.'); + $rtpTimeout = $dto->getRtpTimeout(); + Assertion::notNull($rtpTimeout, 'getRtpTimeout value is null, but non null value was expected.'); + $rtpTimeoutHold = $dto->getRtpTimeoutHold(); + Assertion::notNull($rtpTimeoutHold, 'getRtpTimeoutHold value is null, but non null value was expected.'); $self = new static( $sorceryId, @@ -296,7 +316,9 @@ public static function fromDto( $t38Udptl, $t38UdptlEc, $t38UdptlMaxdatagram, - $t38UdptlNat + $t38UdptlNat, + $rtpTimeout, + $rtpTimeoutHold ); $self @@ -351,6 +373,10 @@ public function updateFromDto( Assertion::notNull($t38UdptlMaxdatagram, 'getT38UdptlMaxdatagram value is null, but non null value was expected.'); $t38UdptlNat = $dto->getT38UdptlNat(); Assertion::notNull($t38UdptlNat, 'getT38UdptlNat value is null, but non null value was expected.'); + $rtpTimeout = $dto->getRtpTimeout(); + Assertion::notNull($rtpTimeout, 'getRtpTimeout value is null, but non null value was expected.'); + $rtpTimeoutHold = $dto->getRtpTimeoutHold(); + Assertion::notNull($rtpTimeoutHold, 'getRtpTimeoutHold value is null, but non null value was expected.'); $this ->setSorceryId($sorceryId) @@ -375,6 +401,8 @@ public function updateFromDto( ->setT38UdptlEc($t38UdptlEc) ->setT38UdptlMaxdatagram($t38UdptlMaxdatagram) ->setT38UdptlNat($t38UdptlNat) + ->setRtpTimeout($rtpTimeout) + ->setRtpTimeoutHold($rtpTimeoutHold) ->setTerminal($fkTransformer->transform($dto->getTerminal())) ->setFriend($fkTransformer->transform($dto->getFriend())) ->setResidentialDevice($fkTransformer->transform($dto->getResidentialDevice())) @@ -411,6 +439,8 @@ public function toDto(int $depth = 0): PsEndpointDto ->setT38UdptlEc(self::getT38UdptlEc()) ->setT38UdptlMaxdatagram(self::getT38UdptlMaxdatagram()) ->setT38UdptlNat(self::getT38UdptlNat()) + ->setRtpTimeout(self::getRtpTimeout()) + ->setRtpTimeoutHold(self::getRtpTimeoutHold()) ->setTerminal(Terminal::entityToDto(self::getTerminal(), $depth)) ->setFriend(Friend::entityToDto(self::getFriend(), $depth)) ->setResidentialDevice(ResidentialDevice::entityToDto(self::getResidentialDevice(), $depth)) @@ -445,6 +475,8 @@ protected function __toArray(): array 't38_udptl_ec' => self::getT38UdptlEc(), 't38_udptl_maxdatagram' => self::getT38UdptlMaxdatagram(), 't38_udptl_nat' => self::getT38UdptlNat(), + 'rtp_timeout' => self::getRtpTimeout(), + 'rtp_timeout_hold' => self::getRtpTimeoutHold(), 'terminalId' => self::getTerminal()?->getId(), 'friendId' => self::getFriend()?->getId(), 'residentialDeviceId' => self::getResidentialDevice()?->getId(), @@ -861,6 +893,30 @@ public function getT38UdptlNat(): string return $this->t38UdptlNat; } + protected function setRtpTimeout(int $rtpTimeout): static + { + $this->rtpTimeout = $rtpTimeout; + + return $this; + } + + public function getRtpTimeout(): int + { + return $this->rtpTimeout; + } + + protected function setRtpTimeoutHold(int $rtpTimeoutHold): static + { + $this->rtpTimeoutHold = $rtpTimeoutHold; + + return $this; + } + + public function getRtpTimeoutHold(): int + { + return $this->rtpTimeoutHold; + } + public function setTerminal(?TerminalInterface $terminal = null): static { $this->terminal = $terminal; diff --git a/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointDtoAbstract.php b/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointDtoAbstract.php index cbb1453a29c..0d80f82125b 100644 --- a/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointDtoAbstract.php +++ b/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointDtoAbstract.php @@ -127,6 +127,16 @@ abstract class PsEndpointDtoAbstract implements DataTransferObjectInterface */ private $t38UdptlNat = 'no'; + /** + * @var int|null + */ + private $rtpTimeout = 60; + + /** + * @var int|null + */ + private $rtpTimeoutHold = 600; + /** * @var int|null */ @@ -192,6 +202,8 @@ public static function getPropertyMap(string $context = '', string $role = null) 't38UdptlEc' => 't38UdptlEc', 't38UdptlMaxdatagram' => 't38UdptlMaxdatagram', 't38UdptlNat' => 't38UdptlNat', + 'rtpTimeout' => 'rtpTimeout', + 'rtpTimeoutHold' => 'rtpTimeoutHold', 'id' => 'id', 'terminalId' => 'terminal', 'friendId' => 'friend', @@ -228,6 +240,8 @@ public function toArray(bool $hideSensitiveData = false): array 't38UdptlEc' => $this->getT38UdptlEc(), 't38UdptlMaxdatagram' => $this->getT38UdptlMaxdatagram(), 't38UdptlNat' => $this->getT38UdptlNat(), + 'rtpTimeout' => $this->getRtpTimeout(), + 'rtpTimeoutHold' => $this->getRtpTimeoutHold(), 'id' => $this->getId(), 'terminal' => $this->getTerminal(), 'friend' => $this->getFriend(), @@ -513,6 +527,30 @@ public function getT38UdptlNat(): ?string return $this->t38UdptlNat; } + public function setRtpTimeout(int $rtpTimeout): static + { + $this->rtpTimeout = $rtpTimeout; + + return $this; + } + + public function getRtpTimeout(): ?int + { + return $this->rtpTimeout; + } + + public function setRtpTimeoutHold(int $rtpTimeoutHold): static + { + $this->rtpTimeoutHold = $rtpTimeoutHold; + + return $this; + } + + public function getRtpTimeoutHold(): ?int + { + return $this->rtpTimeoutHold; + } + public function setId($id): static { $this->id = $id; diff --git a/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointInterface.php b/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointInterface.php index dff88e3b4b2..161649d1e20 100644 --- a/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointInterface.php +++ b/library/Ivoz/Ast/Domain/Model/PsEndpoint/PsEndpointInterface.php @@ -135,6 +135,10 @@ public function getT38UdptlMaxdatagram(): int; public function getT38UdptlNat(): string; + public function getRtpTimeout(): int; + + public function getRtpTimeoutHold(): int; + public function setTerminal(?TerminalInterface $terminal = null): static; public function getTerminal(): ?TerminalInterface; From 0520d70f6421d3a58e2cb06fbcd82df0069e534b Mon Sep 17 00:00:00 2001 From: Kaian Date: Wed, 25 Jan 2023 18:01:23 +0100 Subject: [PATCH 3/3] tests: updated ORM tests with new endpoint fields --- .../ResidentialDevice/ResidentialDeviceLifeCycleTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/schema/tests/Provider/ResidentialDevice/ResidentialDeviceLifeCycleTest.php b/schema/tests/Provider/ResidentialDevice/ResidentialDeviceLifeCycleTest.php index 19d30834faf..32707472475 100644 --- a/schema/tests/Provider/ResidentialDevice/ResidentialDeviceLifeCycleTest.php +++ b/schema/tests/Provider/ResidentialDevice/ResidentialDeviceLifeCycleTest.php @@ -147,6 +147,8 @@ protected function it_updates_ps_endpoint() 't38_udptl_ec' => 'redundancy', 't38_udptl_maxdatagram' => 1440, 't38_udptl_nat' => 'no', + 'rtp_timeout' => 60, + 'rtp_timeout_hold' => 600, 'residentialDeviceId' => 2, 'id' => 6 ]