twilio / voice-quickstart-server-php

Voice Quickstart Server in PHP
MIT License
8 stars 19 forks source link

makeCall.php returns HTTP ERROR 500 #11

Closed shashi-patel closed 4 years ago

shashi-patel commented 4 years ago

Hello,

We want to integrate Programmable Voice in our Android & iOS Applications.

Downloaded Twilio Voice Quickstart for Android and followed all the steps mentioned in readme. At the server side we are using php and trying to configure server setup by following steps mentioned in voice-quickstart-server-php. After configuring this we are trying to make a call using makeCall.php, it gives HTTP ERROR 500. We did not modify any code in this file. We just modify the requested data such as KEY_SECRET, API_KEY.

bobiechen-twilio commented 4 years ago

Hi @shashi180493

Thanks for reaching out. Is there any more information that came with the HTTP 500 error, such as debugging message that explains what might have caused the 500 response? Did you have a Twilio Call SID when this happened?

shashi-patel commented 4 years ago

Hi @bobiechen-twilio

Thanks for the reply.

Please check following information which i have:

DEBUG EVENT SID : NOb43cac11b10d9b93c1515ca0bb97f3fc CALL SID : CAebbd98ffbead1f0ca6f1fff45d91e4d9

Here is the message that i received "An attempt to retrieve content from https://myurl/makeCall.php returned the HTTP status code 500"

bobiechen-twilio commented 4 years ago

Thanks for the update @shashi180493. As the error message suggested, you might want to check if your app endpoint is reachable and is returning a valid TwiML response.

shashi-patel commented 4 years ago

@bobiechen-twilio

I tried to hit URL directly in browser it is not returning anything, we did not modified code of this file just added callerNumber. Can you please help us to identify the issue. I have emailed you other details please check email and help us to fix this problem. Thank you.

bobiechen-twilio commented 4 years ago

Hi @shashi180493

At this point we don't know what might have caused the problem since Twilio is not able to fetch a valid response from your server endpoint at all. Have you tried to print debugging message in your makeCall.php endpoint and see how far it went and why there was no TwiML returned?

shashi-patel commented 4 years ago

@bobiechen-twilio

Yes we tried to debug it, it returns error at following line.

$response = new Twilio\Twiml();

bobiechen-twilio commented 4 years ago

Hi @shashi180493

I am sure some error message was printed out about the error? Did you follow the README and run the composer install command to download the Twilio PHP helper library?

shashi-patel commented 4 years ago

No I am not getting any error message it is showing HTTP ERROR 500. While debugging i got following error message in console.

"makeCall.php:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)"

Yes, I follow README and excuted composer install command to download helper library.

bobiechen-twilio commented 4 years ago

Hi @shashi180493

How does the PHP app server go when you test it by running locally?

shashi-patel commented 4 years ago

Hi @bobiechen-twilio

We didn't tried this in local, but other files such as accessToken.php & placeCall.php are working fine on our server. But makeCall.php is returning error on $response = new Twilio\Twiml(); this line.

bobiechen-twilio commented 4 years ago

Hi @shashi180493

Have you tried this?

$response = new Twilio\TwiML\VoiceResponse();

My PHP quickstart is using the 5.16.3 of Twilio PHP helper library. Perhaps you are using a newer version of the library in which the APIs are slightly different.

Let us know if this helps.

shashi-patel commented 4 years ago

Hi @bobiechen-twilio

Using $response = new Twilio\TwiML\VoiceResponse(); It is working now, Thank you so much for your support @bobiechen-twilio.