Giter VIP home page Giter VIP logo

clicktocall-php's People

Contributors

bld010 avatar dependabot-preview[bot] avatar dkundel avatar joliveros avatar jonedavis avatar mattc96 avatar maylonpedroso avatar pkamp3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clicktocall-php's Issues

Code Exchange quality checklist

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 [ ].

Documentation

  • 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

GitHub

  • Dependabot set up

  • Dependabot automerge set up

  • Uses GitHub Actions (required for Twilio sample) or other CI

Code

  • Packages/dependencies are up to date

  • Code compiles against latest packages/dependencies

  • Matches CodeExchange Guidelines to the best of ability

Tests

  • Functionality tests have been created

  • All tests pass

App

  • 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

General

  • 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.

Getting "Credentials are required to create a Client" when submitting the form

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:

$client = new Client(
getenv('TWILIO_ACCOUNT_SID'),
getenv('TWILIO_AUTH_TOKEN')
);

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.

Getting "Uncaught Error: Call to a member function dial() on null in..."

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.