Skip to content

Commit

Permalink
Merge pull request #25 from rtckit/v0.6.2
Browse files Browse the repository at this point in the history
v0.6.2
  • Loading branch information
cdosoftei authored May 24, 2024
2 parents ec8875a + 5d92b66 commit 2aeedc1
Show file tree
Hide file tree
Showing 36 changed files with 721 additions and 36 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ jobs:
- run: chmod +x phar-composer-latest.phar
- run: composer install --no-dev
- run: ./phar-composer-latest.phar build .
- run: echo "${{ secrets.SIGNING_GPG_PRIVATE_KEY }}" | gpg --import --no-tty --batch --yes
- run: echo "${{ secrets.SIGNING_GPG_PASSPHRASE }}" | gpg --command-fd 0 --passphrase-fd 0 --pinentry-mode loopback -u 8636CB4D9CC1CD41EFC1EDC315ECDC2092AA50C1 --batch --detach-sign --armor --output eqivo.phar.asc eqivo.phar
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: eqivo.phar
asset_name: eqivo.phar
file_glob: true
file: eqivo.phar*
tag: ${{ github.ref }}
prerelease: true
overwrite: true
Expand Down
2 changes: 2 additions & 0 deletions bin/eqivo
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ $eqivo->setRestServer(
->setRouteController('POST', '/v0.1/CancelScheduledPlay/', new Eqivo\Rest\Controller\V0_1\CancelScheduledPlay)
->setRouteController('POST', '/v0.1/ConferenceDeaf/', new Eqivo\Rest\Controller\V0_1\ConferenceDeaf)
->setRouteController('POST', '/v0.1/ConferenceHangup/', new Eqivo\Rest\Controller\V0_1\ConferenceHangup)
->setRouteController('POST', '/v0.1/ConferenceHold/', new Eqivo\Rest\Controller\V0_1\ConferenceHold)
->setRouteController('POST', '/v0.1/ConferenceKick/', new Eqivo\Rest\Controller\V0_1\ConferenceKick)
->setRouteController('POST', '/v0.1/ConferenceList/', new Eqivo\Rest\Controller\V0_1\ConferenceList)
->setRouteController('POST', '/v0.1/ConferenceListMembers/', new Eqivo\Rest\Controller\V0_1\ConferenceListMembers)
Expand All @@ -153,6 +154,7 @@ $eqivo->setRestServer(
->setRouteController('POST', '/v0.1/ConferenceRecordStop/', new Eqivo\Rest\Controller\V0_1\ConferenceRecordStop)
->setRouteController('POST', '/v0.1/ConferenceSpeak/', new Eqivo\Rest\Controller\V0_1\ConferenceSpeak)
->setRouteController('POST', '/v0.1/ConferenceUndeaf/', new Eqivo\Rest\Controller\V0_1\ConferenceUndeaf)
->setRouteController('POST', '/v0.1/ConferenceUnhold/', new Eqivo\Rest\Controller\V0_1\ConferenceUnhold)
->setRouteController('POST', '/v0.1/ConferenceUnmute/', new Eqivo\Rest\Controller\V0_1\ConferenceUnmute)
->setRouteController('POST', '/v0.1/GroupCall/', new Eqivo\Rest\Controller\V0_1\GroupCall)
->setRouteController('POST', '/v0.1/HangupAllCalls/', new Eqivo\Rest\Controller\V0_1\HangupAllCalls)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rtckit/eqivo",
"description": "Telephony API Platform",
"version": "0.6.1",
"version": "0.6.2",
"keywords": [
"telecommunications",
"voip",
Expand Down Expand Up @@ -39,7 +39,7 @@
"react/http": "^1.9",
"react/promise": "^3.1",
"rtckit/esl": "^0.8",
"rtckit/ficore": "v0.0.3",
"rtckit/ficore": "0.0.4",
"rtckit/sip": "^0.7",
"symfony/yaml": "^6.3",
"wikimedia/ip-set": "^4.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
includes:
- ../vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- identifier: missingType.generics
- '#Parameter \#1 \$onFulfilled of method React\\Promise\\PromiseInterface<mixed>::then\(\) expects \(callable\(mixed\):#'
2 changes: 2 additions & 0 deletions etc/psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<issueHandlers>
<PropertyNotSetInConstructor errorLevel="suppress" />
<TypeDoesNotContainType errorLevel="suppress" />
<InternalMethod errorLevel="suppress" />
<MissingClassConstType errorLevel="suppress" />

<!-- https://github.com/vimeo/psalm/issues/4823 -->
<RedundantPropertyInitializationCheck errorLevel="suppress" />
Expand Down
131 changes: 131 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,28 @@ paths:
security:
-
basicAuth: []
/v0.1/ConferenceHold/:
post:
tags:
- Conference
summary: /v0.1/ConferenceHold/
description: 'Put one or more conference members on hold'
requestBody:
description: 'POST parameters'
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/ConferenceHoldParameters'
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/ConferenceHoldResponse'
security:
-
basicAuth: []
/v0.1/ConferenceKick/:
post:
tags:
Expand Down Expand Up @@ -334,6 +356,28 @@ paths:
security:
-
basicAuth: []
/v0.1/ConferenceUnhold/:
post:
tags:
- Conference
summary: /v0.1/ConferenceUnhold/
description: 'Resume one or more members in the conference context'
requestBody:
description: 'POST parameters'
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/ConferenceUnholdParameters'
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/ConferenceUnholdResponse'
security:
-
basicAuth: []
/v0.1/ConferenceUnmute/:
post:
tags:
Expand Down Expand Up @@ -901,6 +945,25 @@ components:
type: string
example: '13,42'
type: object
ConferenceHoldParameters:
required:
- ConferenceName
- FilePath
- MemberID
properties:
ConferenceName:
description: 'Name of the conference in question'
type: string
example: Room402
FilePath:
description: 'Path/URI of the media file to be played as music-on-hold'
type: string
example: /var/local/media/sample.wav
MemberID:
description: 'List of comma separated member IDs to be affected; `all` shorthand is available however it is not capable of playing back the music-on-hold (i.e. use specific member IDs when MOH is necessary)'
type: string
example: '13,42'
type: object
ConferenceKickParameters:
required:
- ConferenceName
Expand Down Expand Up @@ -1070,6 +1133,20 @@ components:
type: string
example: '13,42'
type: object
ConferenceUnholdParameters:
required:
- ConferenceName
- MemberID
properties:
ConferenceName:
description: 'Name of the conference in question'
type: string
example: Room402
MemberID:
description: 'List of comma separated member IDs to be affected; `all` shorthand is available too but it is not capable of stopping the music-oh-hold.'
type: string
example: '13,42'
type: object
ConferenceUnmuteParameters:
required:
- ConferenceName
Expand Down Expand Up @@ -1606,6 +1683,33 @@ components:
type: boolean
example: true
type: object
ConferenceHoldResponse:
required:
- Message
- Success
properties:
Message:
description: 'Response message'
type: string
enum:
- 'Conference Hold Executed'
- 'ConferenceName Parameter must be present'
- 'MemberID Parameter must be present'
- 'Conference Hold Failed -- Conference not found'
example: 'Conference Hold Executed'
Members:
description: 'List of affected members'
type: array
items:
type: string
example:
- '13'
- '42'
Success:
description: 'Whether the request was successful or not'
type: boolean
example: true
type: object
ConferenceKickResponse:
required:
- Message
Expand Down Expand Up @@ -1864,6 +1968,33 @@ components:
type: boolean
example: true
type: object
ConferenceUnholdResponse:
required:
- Message
- Success
properties:
Message:
description: 'Response message'
type: string
enum:
- 'Conference Unhold Executed'
- 'ConferenceName Parameter must be present'
- 'MemberID Parameter must be present'
- 'Conference Unhold Failed -- Conference not found'
example: 'Conference Unhold Executed'
Members:
description: 'List of affected members'
type: array
items:
type: string
example:
- '13'
- '42'
Success:
description: 'Whether the request was successful or not'
type: boolean
example: true
type: object
ConferenceUnmuteResponse:
required:
- Message
Expand Down
3 changes: 2 additions & 1 deletion src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

class App extends AbstractApp
{
public const VERSION = '0.6.1';
/** @var string */
public const VERSION = '0.6.2';

public HttpClientInterface $httpClient;

Expand Down
10 changes: 5 additions & 5 deletions src/Config/CliArguments.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function resolve(AbstractSet $config): void
$configFile = $args['c'];
}

if ($configFile) {
if (is_string($configFile)) {
switch (pathinfo($configFile, PATHINFO_EXTENSION)) {
case 'json':
case 'yml':
Expand Down Expand Up @@ -168,7 +168,7 @@ function (string $value): bool {
if (isset($args['rest-bind-address']) && is_string($args['rest-bind-address'])) {
$err = Set::parseSocketAddr($args['rest-bind-address'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed --rest-bind-address argument: ip:port required' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand Down Expand Up @@ -245,7 +245,7 @@ function (string $value): bool {
if (isset($args['outbound-bind-address']) && is_string($args['outbound-bind-address'])) {
$err = Set::parseSocketAddr($args['outbound-bind-address'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed --outbound-bind-address argument: ip:port required' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand All @@ -263,7 +263,7 @@ function (string $value): bool {
} else {
$err = Set::parseSocketAddr($args['outbound-advertised-address'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed --outbound-advertised-address argument: ip:port or `inbound_socket_address` required' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand Down Expand Up @@ -313,7 +313,7 @@ function (string $value): bool {

protected function help(): never
{
$cmd = !isset($_SERVER['argv']) || !is_array($_SERVER['argv']) || empty($_SERVER['argv'][0])
$cmd = !isset($_SERVER['argv']) || !is_array($_SERVER['argv']) || !is_string($_SERVER['argv'][0]) || !strlen($_SERVER['argv'][0])
? './bin/ficore'
: $_SERVER['argv'][0];

Expand Down
7 changes: 4 additions & 3 deletions src/Config/EnvironmentVars.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

class EnvironmentVars implements ResolverInterface
{
/** @var string */
public const PREFIX = 'EQIVO_';

public function resolve(AbstractSet $config): void
Expand Down Expand Up @@ -96,7 +97,7 @@ function (string $value): bool {
if (isset($env[self::PREFIX . 'REST_BIND_ADDRESS'])) {
$err = Set::parseSocketAddr($env[self::PREFIX . 'REST_BIND_ADDRESS'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed ' . self::PREFIX . 'REST_BIND_ADDRESS environment variable' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand Down Expand Up @@ -173,7 +174,7 @@ function (string $value): bool {
if (isset($env[self::PREFIX . 'OUTBOUND_BIND_ADDRESS'])) {
$err = Set::parseSocketAddr($env[self::PREFIX . 'OUTBOUND_BIND_ADDRESS'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed ' . self::PREFIX . 'OUTBOUND_BIND_ADDRESS environment variable' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand All @@ -191,7 +192,7 @@ function (string $value): bool {
} else {
$err = Set::parseSocketAddr($env[self::PREFIX . 'OUTBOUND_ADVERTISED_ADDRESS'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed ' . self::PREFIX . 'OUTBOUND_ADVERTISED_ADDRESS environment variable' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/Config/LegacyConfigFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function (string $value): bool {
if (isset($legacy['rest_server']['HTTP_ADDRESS']) && is_string($legacy['rest_server']['HTTP_ADDRESS'])) {
$err = Set::parseSocketAddr($legacy['rest_server']['HTTP_ADDRESS'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed HTTP_ADDRESS (rest_server) line in legacy configuration file' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand All @@ -117,7 +117,7 @@ function (string $value): bool {
if (isset($legacy['rest_server']['FS_INBOUND_ADDRESS']) && is_string($legacy['rest_server']['FS_INBOUND_ADDRESS'])) {
$err = Set::parseHostPort($legacy['rest_server']['FS_INBOUND_ADDRESS'], $host, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed FS_INBOUND_ADDRESS (rest_server) line in legacy configuration file' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand Down Expand Up @@ -182,7 +182,7 @@ function (string $value): bool {
if (isset($legacy['outbound_server']['FS_OUTBOUND_ADDRESS']) && is_string($legacy['outbound_server']['FS_OUTBOUND_ADDRESS'])) {
$err = Set::parseSocketAddr($legacy['outbound_server']['FS_OUTBOUND_ADDRESS'], $ip, $port);

if ($err) {
if (is_string($err)) {
fwrite(STDERR, 'Malformed FS_OUTBOUND_ADDRESS (outbound_server) line in legacy configuration file' . PHP_EOL);
fwrite(STDERR, $err . PHP_EOL);
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class HttpClient implements HttpClientInterface

protected string $signatureHeader;

/** @var int */
public const TIMEOUT = 60;

public function setApp(App $app): static
Expand Down Expand Up @@ -63,7 +64,7 @@ public function makeRequest(string $url, string $method = 'POST', array $params
throw new HttpClientException("Cannot send {$url}, cannot parse url");
}

if (!empty($parsed['query'])) {
if (isset($parsed['query']) && strlen($parsed['query'])) {
parse_str($parsed['query'], $extra);
$params = array_merge($params, $extra);
}
Expand Down
1 change: 1 addition & 0 deletions src/Plan/Dial/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Handler implements HandlerInterface
{
use HandlerTrait;

/** @var int */
public const EVENT_TIMEOUT = 30;

public function execute(Channel $channel, AbstractElement $element): PromiseInterface
Expand Down
4 changes: 4 additions & 0 deletions src/Plan/Parser/Conference.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ class Conference implements ParserInterface
/** @var string */
public const ELEMENT_TYPE = 'Conference';

/** @var int */
public const DEFAULT_TIMELIMIT = 0;

/** @var int */
public const DEFAULT_MAXMEMBERS = 200;

/** @var list<string> */
public const RECORD_FILE_FORMATS = ['wav', 'mp3'];

/** @var list<string> */
public const ALLOWED_METHODS = ['GET', 'POST'];

public function parse(RestXmlElement $xmlElement, Channel $channel): PromiseInterface
Expand Down
Loading

0 comments on commit 2aeedc1

Please sign in to comment.