twiliodeved / clicktocall-php Goto Github PK
View Code? Open in Web Editor NEWClick to Call with Twilio and Vanilla PHP
Home Page: https://www.twilio.com/docs/voice/sdks/javascript/get-started
License: MIT License
Click to Call with Twilio and Vanilla PHP
Home Page: https://www.twilio.com/docs/voice/sdks/javascript/get-started
License: MIT License
The purpose of this checklist is to assess the state of this repository, and bring it to an acceptable level for long-term support by completing the tasks listed below.
Please check every part of this checklist for us to process your request. You can do this by marking them with [x] instead of [ ].
Twilio LICENSE exists in repository
Code of Conduct exists in repository
CONTRIBUTING exists in repository
No broken links in README.md
Build status exists at top of README.md
Set up steps are complete and accurate
CodeExchange repository is linked in README.md
Dependabot set up
Dependabot automerge set up
Uses GitHub Actions (required for Twilio sample) or other CI
Packages/dependencies are up to date
Code compiles against latest packages/dependencies
Matches CodeExchange Guidelines to the best of ability
Functionality tests have been created
All tests pass
Confirmed sample behaves as expected (after dependencies have been updated)
This file has been copied into a wiki entry for the respective repository or added as a GitHub issue
I've read and followed the contribution guidelines
I've read and implemented my template according to the respective coding guidelines for my project
I agree and adhere to the Code of Conduct
The template has been authored by me / or my organization and will be kept up-to-date. If the template will not longer be maintained, I'll notify this project.
Version of PHP:
> php --version
PHP 8.0.10 (cli) (built: Aug 26 2021 15:36:17) ( NTS )
Composer.json modification (I've added PHP ^8.0 as a supported version)
"require": {
"php": "^7.2.5|^8.0",
"twilio/sdk": "^6.1.0",
Expectation: A call will go through from your Twilio number to the provided phone number.
Actual behavior: An exception is thrown.
[Wed Sep 15 13:43:03 2021] PHP Fatal error: Uncaught Twilio\Exceptions\ConfigurationException: Credentials are required to create a Client in /Users/mmenschig/Projects/dev/php/clicktocall-php/vendor/twilio/sdk/src/Twilio/Rest/Client.php:170
Stack trace:
#0 /Users/mmenschig/Projects/dev/php/clicktocall-php/src/call.php(36): Twilio\Rest\Client->__construct('', '')
#1 {main}
thrown in /Users/mmenschig/Projects/dev/php/clicktocall-php/vendor/twilio/sdk/src/Twilio/Rest/Client.php on line 170
[Wed Sep 15 13:43:03 2021] [::1]:60740 [200]: POST /call.php - Uncaught Twilio\Exceptions\ConfigurationException: Credentials are required to create a Client in /Users/mmenschig/Projects/dev/php/clicktocall-php/vendor/twilio/sdk/src/Twilio/Rest/Client.php:170
Stack trace:
#0 /Users/mmenschig/Projects/dev/php/clicktocall-php/src/call.php(36): Twilio\Rest\Client->__construct('', '')
#1 {main}
thrown in /Users/mmenschig/Projects/dev/php/clicktocall-php/vendor/twilio/sdk/src/Twilio/Rest/Client.php on line 170
[Wed Sep 15 13:43:03 2021] [::1]:60740 Closing
The issue appears to stem from the following lines in call.php:
Link:
Lines 30 to 33 in 15d16f2
Note that both getenv()
and putenv()
are not thread safe and their usage is strongly discouraged: https://github.com/vlucas/phpdotenv#putenv-and-getenv
One workaround is to access the $_ENV
object instead:
$client = new Client(
$_ENV["TWILIO_ACCOUNT_SID"],
$_ENV["TWILIO_AUTH_TOKEN"]
);
NB: The same workaround needs to be applied to retrieving the $TWILIO_NUMBER as well:
$TWILIO_NUMBER = $_ENV['TWILIO_NUMBER'];
Once these changes are applied the application works as expected.
I'm getting this error after submitting the form:
[Thu Dec 2 12:07:34 2021] [::1]:50021 [200]: POST /outbound.php?sales_phone=%2B1+xxxxxxxxx - Uncaught Error: Call to a member function dial() on null in /Users/gigo6000/Sites/clicktocall-php/src/outbound.php:19
Stack trace:
#0 {main}
thrown in /Users/gigo6000/Sites/clicktocall-php/src/outbound.php on line 19
The $response
variable is inside the generate_twiml_response()
so is not in the global scope.
PR: #13
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.