Skip to content

Commit

Permalink
🚀 v0.6.1 (#23)
Browse files Browse the repository at this point in the history
⬆️ Update dependencies
  • Loading branch information
cdosoftei authored Dec 10, 2023
1 parent 28dd903 commit ec8875a
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 44 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
- ubuntu-20.04
php:
- 8.1
- 8.2
- 8.3
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
- run: curl -OL https://clue.engineering/phar-composer-latest.phar
- run: chmod +x phar-composer-latest.phar
- run: composer install --no-dev
Expand All @@ -37,7 +37,7 @@ jobs:
file: etc/Dockerfile
push: true
tags: rtckit/eqivo:${{ github.ref_name }}-full
- run: curl -OL https://downloads.dockerslim.com/releases/1.37.6/dist_linux.tar.gz
- run: curl -OL https://downloads.dockerslim.com/releases/1.40.6/dist_linux.tar.gz
- run: tar zfvx dist_linux.tar.gz
- run: ./dist_linux/docker-slim build --http-probe-off --continue-after 1 --include-cert-all --include-exe=/usr/local/bin/eqivo --include-exe=/usr/local/bin/php --target rtckit/eqivo:${{ github.ref_name }}-full --tag rtckit/eqivo:${{ github.ref_name }}
- run: docker push rtckit/eqivo:${{ github.ref_name }}
22 changes: 11 additions & 11 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.0",
"version": "0.6.1",
"keywords": [
"telecommunications",
"voip",
Expand Down Expand Up @@ -32,21 +32,21 @@
"ext-libxml": "*",
"ext-pcre": "*",
"ext-simplexml": "*",
"monolog/monolog": "^3.2",
"monolog/monolog": "^3.5",
"nikic/fast-route": "^1.3",
"ramsey/uuid": "^4.4",
"react/event-loop": "^1.3",
"react/http": "^1.7",
"react/promise": "^2.9",
"ramsey/uuid": "^4.7",
"react/event-loop": "^1.5",
"react/http": "^1.9",
"react/promise": "^3.1",
"rtckit/esl": "^0.8",
"rtckit/ficore": "0.0.2",
"rtckit/ficore": "v0.0.3",
"rtckit/sip": "^0.7",
"symfony/yaml": "^6.1",
"wikimedia/ip-set": "^3.1"
"symfony/yaml": "^6.3",
"wikimedia/ip-set": "^4.0"
},
"require-dev": {
"phpstan/phpstan": "^1.9",
"vimeo/psalm": "^5.6"
"phpstan/phpstan": "^1.10",
"vimeo/psalm": "^5.16"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion etc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1.14-cli-bullseye
FROM php:8.3.0-cli-bookworm

RUN docker-php-ext-install pcntl

Expand Down
2 changes: 1 addition & 1 deletion etc/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1.14-cli-bullseye
FROM php:8.3.0-cli-bookworm

RUN docker-php-ext-install pcntl

Expand Down
11 changes: 6 additions & 5 deletions etc/Dockerfile.freeswitch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM rtckit/slimswitch-builder:v1.10.8
FROM rtckit/slimswitch-builder:v1.10.10

# Build with:
#
# docker build -f ./etc/Dockerfile.freeswitch -t rtckit/eqivo-freeswitch-builder:v1.10.8 .
# docker build -f ./etc/Dockerfile.freeswitch -t rtckit/eqivo-freeswitch-builder:v1.10.10 .
#
# Minify with rtckit/slimswitch:
#
Expand Down Expand Up @@ -31,7 +31,8 @@ RUN cd /usr/src/freeswitch* && \
wget https://codeload.github.com/rtckit/mod_amd/tar.gz/d49f81f -O amd.tar.gz && \
tar zfvx amd.tar.gz -C ./src/mod/applications && \
mv ./src/mod/applications/mod_amd-d49f81f ./src/mod/applications/mod_amd && \
sed -i 's#src/mod/applications/mod_mariadb/Makefile#src/mod/applications/mod_mariadb/Makefile\n\t\tsrc/mod/applications/mod_amd/Makefile#' configure.ac && \
./bootstrap.sh -j && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-debug && \
sed -i 's#src/mod/applications/mod_dptools/Makefile#src/mod/applications/mod_dptools/Makefile\n\t\tsrc/mod/applications/mod_amd/Makefile#' configure.ac && \
./bootstrap.sh -j && ./configure --with-python3 --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-debug && \
echo applications/mod_amd >> ./modules.conf && \
make -j mod_amd && make mod_amd-install
make -j mod_amd && \
make mod_amd-install
3 changes: 2 additions & 1 deletion etc/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includes:
- ../vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- '#Call to an undefined method React\\Promise\\PromiseInterface::otherwise\(\)#'
- '#Parameter \#1 \$onFulfilled of method React\\Promise\\PromiseInterface<mixed>::then\(\) expects \(callable\(mixed\):#'
2 changes: 1 addition & 1 deletion src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class App extends AbstractApp
{
public const VERSION = '0.6.0';
public const VERSION = '0.6.1';

public HttpClientInterface $httpClient;

Expand Down
8 changes: 4 additions & 4 deletions src/Command/Conference/Query/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function execute(RequestInterface $request): PromiseInterface
$response = new Response();
$response->successful = true;

if ($request->action !== ActionEnum::Members) {
if (isset($request->action)) {
$response->successful = false;

return resolve($response);
Expand All @@ -53,7 +53,7 @@ public function execute(RequestInterface $request): PromiseInterface

$response->successful = false;

return resolve();
return resolve(null);
}

$xml = simplexml_load_string($body);
Expand All @@ -63,13 +63,13 @@ public function execute(RequestInterface $request): PromiseInterface

$response->successful = false;

return resolve();
return resolve(null);
}

$response->rooms = array_merge($response->rooms, $this->parseXmlList($core, $xml, $request->members, $request->channels, $request->muted, $request->deaf));
$this->app->commandConsumer->logger->debug('Conference List Done for ' . $core->uuid);

return resolve();
return resolve(null);
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/Plan/Dial/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function execute(Channel $channel, AbstractElement $element): PromiseInte
if (empty($element->numbers)) {
$this->app->planConsumer->logger->error('Dial Aborted, No Number to dial!');

return resolve();
return resolve(null);
}

if ($element->timeout > 0) {
Expand Down Expand Up @@ -299,7 +299,7 @@ public function execute(Channel $channel, AbstractElement $element): PromiseInte
}
}

return resolve();
return resolve(null);
});
}

Expand Down
6 changes: 5 additions & 1 deletion src/Plan/Parser/Conference.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public function parse(RestXmlElement $xmlElement, Channel $channel): PromiseInte
}

$attributes = $xmlElement->attributes();
$element->fqrn = "{$element->room}@{$this->app->config->appPrefix}";
$element->fqrn = $element->room;

if (strpos($element->fqrn, '@') === false) {
$element->fqrn = "{$element->room}@{$this->app->config->appPrefix}";
}

$mohSound = (isset($attributes->waitSound) && !empty((string)$attributes->waitSound))
? $this->app->restServer->config->defaultHttpMethod . ':' . (string)$attributes->waitSound
Expand Down
5 changes: 3 additions & 2 deletions src/Plan/Parser/Dial.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ public function parse(RestXmlElement $xmlElement, Channel $channel): PromiseInte

if (isset($entry->sendDigits[0])) {
if ($entry->sendOnPreanswer) {
$optionSendDigits = "api_on_media='uuid_recv_dtmf \${uuid} ${$entry->sendDigits}'";
$optionSendDigits = "api_on_media='uuid_recv_dtmf \${uuid} {$entry->sendDigits}'";
} else {
$optionSendDigits = "api_on_answer_2='uuid_recv_dtmf \${uuid} ${$entry->sendDigits}'";
$optionSendDigits = "api_on_answer_2='uuid_recv_dtmf \${uuid} {$entry->sendDigits}'";
}
}

Expand Down Expand Up @@ -227,6 +227,7 @@ public function parse(RestXmlElement $xmlElement, Channel $channel): PromiseInte
return all($promises)
->then(function (array $playbackArray) use ($element) {
if (!empty($playbackArray['confirmSounds'])) {
/** @phpstan-ignore-next-line */
$element->confirmSounds = $playbackArray['confirmSounds'];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Plan/PreAnswer/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function execute(Channel $channel, AbstractElement $element): PromiseInte

$this->app->planConsumer->logger->info('PreAnswer Completed');

return resolve();
return resolve(null);
});
}
}
2 changes: 1 addition & 1 deletion src/Plan/Producer.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function produce(Channel $channel, string $sequence, ?AbstractSignal $sig

return $this->parseElements($restXml, $channel);
})
->otherwise(function (\Throwable $t) {
->catch(function (\Throwable $t) {
$t = $t->getPrevious() ?: $t;

$this->logger->error('Processing RESTXML failure: ' . $t->getMessage(), [
Expand Down
9 changes: 6 additions & 3 deletions src/Rest/Controller/AuthenticatedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function doExecute(ServerRequestInterface $request, AbstractResponse $
return $this->view->execute($response);
});
})
->otherwise($this->exceptionHandler(...));
->catch($this->exceptionHandler(...));
}

/**
Expand All @@ -72,7 +72,10 @@ protected function doExecute(ServerRequestInterface $request, AbstractResponse $
*/
public function validate(AbstractInquiry $inquiry, AbstractResponse $response): void
{
/** @phpstan-ignore-next-line */
assert($inquiry instanceof AbstractInquiry);

/** @phpstan-ignore-next-line */
assert($response instanceof AbstractResponse);
}

Expand Down Expand Up @@ -118,7 +121,7 @@ protected function validateCredentials(string $id, string $token): PromiseInterf
($id === $this->app->restServer->config->restAuthId) &&
($token === $this->app->restServer->config->restAuthToken)
) {
return resolve();
return resolve(null);
} else {
return reject(new AuthException('Invalid credentials'));
}
Expand All @@ -130,7 +133,7 @@ protected function validateIpAddress(string $ip): PromiseInterface
return reject(new AuthException('IP Auth Failed'));
}

return resolve();
return resolve(null);
}

protected function exceptionHandler(Throwable $t): PromiseInterface
Expand Down
4 changes: 2 additions & 2 deletions src/Rest/Controller/V0_1/GroupCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function execute(ServerRequestInterface $request): PromiseInterface
$response = new GroupCallResponse();
$inquiry = GroupCallInquiry::factory($request);

$promise = resolve();
$promise = resolve(null);

if (isset($inquiry->ConfirmSound) && filter_var($inquiry->ConfirmSound, FILTER_VALIDATE_URL)) {
/* Owning to the legacy's framework model, we're instantiating a pseudo Channel to fetch the ConfirmSound RestXML */
Expand Down Expand Up @@ -118,7 +118,7 @@ public function execute(ServerRequestInterface $request): PromiseInterface

$inquiry->confirmMedia = $soundFiles;

return resolve();
return resolve(null);
});
}

Expand Down
1 change: 1 addition & 0 deletions src/Rest/Controller/V0_1/HangupCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function validate(AbstractInquiry $inquiry, AbstractResponse $response):

$inquiry->channel = $channel;
} else {
/** @phpstan-ignore-next-line */
assert(is_string($inquiry->RequestUUID));

$job = $this->app->getOriginateJob($inquiry->RequestUUID);
Expand Down
1 change: 1 addition & 0 deletions src/Rest/Controller/V0_1/ScheduleHangup.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function validate(AbstractInquiry $inquiry, AbstractResponse $response):
return;
}

/** @phpstan-ignore-next-line */
assert(is_string($inquiry->CallUUID));

$channel = $this->app->getChannel($inquiry->CallUUID);
Expand Down
12 changes: 6 additions & 6 deletions src/Signal/Producer.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,20 @@ public function produce(AbstractSignal $signal): PromiseInterface
$payload = $this->export($signal);

if (!isset($payload) || !isset($signal->attn)) {
return resolve();
return resolve(null);
}

$parts = explode(':', $signal->attn, 2);

if (count($parts) !== 2) {
return resolve();
return resolve(null);
}

$method = $parts[0];
$url = $parts[1];

if (empty($method) || empty($url)) {
return resolve();
return resolve(null);
}

if (isset($signal->event)) {
Expand All @@ -115,12 +115,12 @@ public function produce(AbstractSignal $signal): PromiseInterface
->then(function () use ($method, $url, $payload): PromiseInterface {
$this->logger->info("dial {$method} {$url}", $payload);

return resolve();
return resolve(null);
})
->otherwise(function (ResponseException $e) use ($method, $url, $payload) {
->catch(function (ResponseException $e) use ($method, $url, $payload) {
$this->logger->debug("dial {$method} {$url} failed: " . $e->getMessage(), $payload);
})
->otherwise(function (Throwable $t) use ($method, $url, $payload) {
->catch(function (Throwable $t) use ($method, $url, $payload) {
$t = $t->getPrevious() ?: $t;
$data = [
'payload' => $payload,
Expand Down

0 comments on commit ec8875a

Please sign in to comment.