Closed SecureCPU closed 2 years ago
Looking at it right now. From first glance though is there any chance you have already tried to make a Twilio integration?
Also can you run this in the terminal and paste the output here
cd /var/www/html/Modules grep 'TwilioServiceProvider' ./* -R
EDIT:
Somehow the Twilio folder got nested in itself on the commit. Try this first and see what happens
sudo rm -rf /var/www/html/Modules/Twilio/Twilio
So I installed the Module and clicked activate. it crashed.
Ran the following command: sudo rm -rf /var/www/html/Modules/Twilio/Twilio
I ran the following command:
cd /var/www/html/Modules grep 'TwilioServiceProvider' ./* -R
I'm going to use a snapshot to restore it, just in case. so I can continue working. but if you have any other Ideas, would love to try.
thanks!!
When you say "Same results as the one above"
What is the actual output of the grep?
Sorry about that. forgot to include it:
grep: ./AutoLogin/Public: Too many levels of symbolic links grep: ./CustomerDataEnrichment/Public: Too many levels of symbolic links grep: ./Inbox/Public: Too many levels of symbolic links grep: ./SentFolder/Public: Too many levels of symbolic links grep: ./SmsNotifications/Public: Too many levels of symbolic links ./Twilio/composer.json: "Modules\Twilio\Providers\TwilioServiceProvider" ./Twilio/module.json: "Modules\Twilio\Providers\TwilioServiceProvider" ./Twilio/module.json: "Twilio": "Modules\Twilio\Providers\TwilioServiceProvider" ./Twilio/Providers/TwilioServiceProvider.php:class TwilioServiceProvider extends ServiceProvider
grep: ./AutoLogin/Public: Too many levels of symbolic links grep: ./CustomerDataEnrichment/Public: Too many levels of symbolic links grep: ./Inbox/Public: Too many levels of symbolic links grep: ./SentFolder/Public: Too many levels of symbolic links grep: ./SmsNotifications/Public: Too many levels of symbolic links ./Twilio/composer.json: "Modules\\Twilio\\Providers\\TwilioServiceProvider" ./Twilio/module.json: "Modules\\Twilio\\Providers\\TwilioServiceProvider" ./Twilio/module.json: "Twilio": "Modules\\Twilio\\Providers\\TwilioServiceProvider" ./Twilio/Providers/TwilioServiceProvider.php:class TwilioServiceProvider extends ServiceProvider
btw, i had originally opened a feature request for a twillio module from freescout. I referenced your module on the request.
Here is the link if you want to see it.
https://feedback.userreport.com/25a3cb5f-e4bd-4470-b6f3-79fcfaa8e90f/#idea/392193 https://github.com/freescout-helpdesk/freescout/issues/2291#issuecomment-1332311424
Okay lets go ahead and do this
Refresh the current code
cd ~
sudo rm -rf /var/www/html/Modules/Twilio
git clone https://github.com/calebbaker194/Freescout-Twilio.git
sudo mkdir /var/www/html/Modules/Twilio
sudo cp ./Freescout-Twilio/* /var/www/html/Modules/Twilio/ -r
sudo chown www-data /var/www/html/Modules/Twilio -R
sudo chgrp www-data /var/www/html/Modules/Twilio -R
sudo chmod 755 /var/www/html/Modules/Twilio -R
And then can I see the result of this command
find /var/www/html/Modules/Twilio -not \( -path "/var/www/html/Modules/Twilio/vendor" -prune \)
/var/www/html/Modules/Twilio /var/www/html/Modules/Twilio/Entities /var/www/html/Modules/Twilio/Entities/.gitkeep /var/www/html/Modules/Twilio/composer.json /var/www/html/Modules/Twilio/module.json /var/www/html/Modules/Twilio/Config /var/www/html/Modules/Twilio/Config/config.php /var/www/html/Modules/Twilio/Config/.gitkeep /var/www/html/Modules/Twilio/Tests /var/www/html/Modules/Twilio/Tests/.gitkeep /var/www/html/Modules/Twilio/Console /var/www/html/Modules/Twilio/Console/.gitkeep /var/www/html/Modules/Twilio/Providers /var/www/html/Modules/Twilio/Providers/.gitkeep /var/www/html/Modules/Twilio/Providers/TwilioServiceProvider.php /var/www/html/Modules/Twilio/LICENSE /var/www/html/Modules/Twilio/Http /var/www/html/Modules/Twilio/Http/Middleware /var/www/html/Modules/Twilio/Http/Middleware/.gitkeep /var/www/html/Modules/Twilio/Http/Requests /var/www/html/Modules/Twilio/Http/Requests/.gitkeep /var/www/html/Modules/Twilio/Http/Controllers /var/www/html/Modules/Twilio/Http/Controllers/.gitkeep /var/www/html/Modules/Twilio/Http/Controllers/TwilioController.php /var/www/html/Modules/Twilio/Http/routes.php /var/www/html/Modules/Twilio/composer.lock /var/www/html/Modules/Twilio/README.md /var/www/html/Modules/Twilio/Resources /var/www/html/Modules/Twilio/Resources/lang /var/www/html/Modules/Twilio/Resources/lang/.gitkeep /var/www/html/Modules/Twilio/Resources/views /var/www/html/Modules/Twilio/Resources/views/partials /var/www/html/Modules/Twilio/Resources/views/partials/settings_menu.blade.php /var/www/html/Modules/Twilio/Resources/views/.gitkeep /var/www/html/Modules/Twilio/Resources/views/index.blade.php /var/www/html/Modules/Twilio/Resources/views/layouts /var/www/html/Modules/Twilio/Resources/views/layouts/master.blade.php /var/www/html/Modules/Twilio/Resources/views/settings.blade.php /var/www/html/Modules/Twilio/Resources/assets /var/www/html/Modules/Twilio/Resources/assets/.gitkeep /var/www/html/Modules/Twilio/start.php /var/www/html/Modules/Twilio/Database /var/www/html/Modules/Twilio/Database/Seeders /var/www/html/Modules/Twilio/Database/Seeders/.gitkeep /var/www/html/Modules/Twilio/Database/Seeders/TwilioDatabaseSeeder.php /var/www/html/Modules/Twilio/Database/factories /var/www/html/Modules/Twilio/Database/factories/.gitkeep /var/www/html/Modules/Twilio/Database/Migrations /var/www/html/Modules/Twilio/Database/Migrations/.gitkeep
Any errors after a cache clear now? Your structure is the same as mine And I am receiving and sending texts
So if i click activate, it crashes.
If I run the command sudo php artisan freescout:clear-cache
then I can see freescout again, but the twillio module is inactive.
thats the webserver log
anytime i try to activate the module this happens:
what does the laravel log say? Should be in
/var/ww/html/storage/logs/lravel-2022-12-01.log
`[2022-12-01 12:29:41] production.ERROR: Cannot declare class Modules\Twilio\Providers\TwilioServiceProvider, because the name is already in use {"exception":"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 64): Cannot declare class Modules\Twilio\Providers\TwilioServiceProvider, because the name is already in use at /var/www/html/Modules/Twilio/Providers/TwilioServiceProvider.php:0) [stacktrace]
"}`
[2022-12-01 12:29:41] production.ERROR: The Twilio Integeration module has been deactivated due to an error: require_once(/var/www/html/Modules/Twilio/Providers/../vendor/autoload.php): Failed to open stream: No such file or directory
Okay I believe this was just an oversight on my part on how composer worked. if you email me directly we can go through some of that more in detail.
but this should do the trick
Check to make sure you have composer
composer -V
Navigate to Module
cd /var/www/html/Modules/Twilio
Install Dependencies
composer install
No, i don't have composer. Is it for the docker-based freescout?
this is the error i got when I tried to install the dependencies:
`In Factory.php line 334:
"./composer.json" does not match the expected JSON schema:
install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [
Remove new version of composer and install the old version
sudo apt purge compser
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer --1
EDIT You will need to close this terminal and open another before the next part
Switch to user www-data and composer install
sudo su www-data --shell /bin/bash
cd /var/www/html/Modules/Twilio
composer install
Ok. I'll try it this evening.
Just servicing tickets now. So I'll try it after hours and let u know what happens.
Honestly I'm really excited to have twillio.
Well thanks for going through the process with me. I got it to work on my own But I never tested the install in this manor. If we cant get composer to work though I can still send you the files that you will need. I do have it working on my own. I did notice on your request something about mobile notifications. None of that is include in this integration. This is only for allowing customers to open tickets with a mobile number and responding to them via texts
@netspear Freescout Posted there own module. Its probably my stolen code but its polished a little better and Freescout supported. Its probably better just to convert on over to that one. I also see a couple places that I hard coded that they fixed.
I added the vendor code to the repository and Removed the hard code for the phone number.
cd ~
sudo rm -rf /var/www/html/Modules/Twilio
git clone https://github.com/calebbaker194/Freescout-Twilio.git
sudo mkdir /var/www/html/Modules/Twilio
sudo cp ./Freescout-Twilio/* /var/www/html/Modules/Twilio/ -r
sudo chown www-data /var/www/html/Modules/Twilio -R
sudo chgrp www-data /var/www/html/Modules/Twilio -R
sudo chmod 755 /var/www/html/Modules/Twilio -R
This will prevent the need to use composer.
@netspear Freescout Posted there own module. Its probably my stolen code but its polished a little better and Freescout supported. Its probably better just to convert on over to that one. I also see a couple places that I hard coded that they fixed.
Ok. I'll definitely check it. Thank you so much for you help and work.
I think ur code def pushed them to do it.
Hey, I installed your Twilio Module on my Freescout instance.
But when I activated it freescout crashed. I have a snapshot and can undo the change.
But wanted to know if you have any idea why it crashed?
I found this error in the Storage Logs for web-server
2022/11/30 15:14:01 [error] 61036#61036: *256680 FastCGI sent in stderr: "PHP message: PHP Fatal error: Cannot declare class Modules\Twilio\Providers\TwilioServiceProvider, because the name is already in use in /var/www/html/Modules/Twilio/Providers/TwilioServiceProvider.php on line 0" while reading response header from upstream, client: 192.168.1.244, server: desk.example.com, request: "POST /polycast/receive HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "desk.example.com", referrer: "https://desk.example.com/mailbox/connection-settings/1/incoming"
Running on Ubuntu 20.04 PHP 8.1
Really really appreciate it.
Thanks!