twilio / cocoapod-specs

https://www.twilio.com/
10 stars 15 forks source link

Call ends with Code=31000 #24

Closed schobsi closed 7 years ago

schobsi commented 8 years ago

We are using Twilio for making phone calls, everything worked fine for months, however for about 2 weeks we have been receiving the same error code when trying to make a phone call. The token returned is valid, when starting the phone call the phone-style ViewController appears, after a few seconds the ViewController disappears and we receive the error Code 31000 in the console printed in connection(connection:, didFailWithError:).

Error Domain=TwilioServicesErrorDomain Code=31000 \"Twilio Services Error\" UserInfo={NSLocalizedDescription=Twilio Services Error}

We have investigated everything, however we don't know what else to do, since this error is not very helpful. We have upgraded the TwilioSDK to the latest version 1.2.11, without any results.

bobiechen-twilio commented 8 years ago

Hi @chriseman, Bobie here from the Twilio SDK team. We are sorry to hear that your app is experiencing the error, and it could be because of various reasons such as bad network condition or invalid TwiML response and etc. There is a method in TwilioClient to enable the SDK logging:

[[TwilioClient sharedInstance] setLogLevel:TC_LOG_VERBOSE];

It'd be great if you could try to reproduce the issue with verbose log level so that we can see more insights why the calls are failing. Another way you could also try is to go to your Twilio account portal and you will see more details of your calls.

Thanks.

homanp commented 8 years ago

Hi @bchen-twilio,

Stumbled upon the same issue.

I've attached the log here. - (1).txt

homanp commented 8 years ago

@chriseman do you still have this problem?

bobiechen-twilio commented 8 years ago

Hi @homanp From the log that you provided, your mobile client is getting 403 responses from the Twilio service and this is most likely caused due to token expiration. Could you please also try go to your account portal and see if you can see any error being logged with detailed information. We are sorry for your inconvenience. Btw, have you heard about the new Twilio Programmable Voice iOS SDK (beta)? Now the iOS Voice SDK is leveraging Apple's PushKit and sending reliable push notifications to mobile clients whenever there is an incoming call, and of course all the awesome features from the 1.2 Client SDK. It'd be great if you could give it a try and let us know you have any feedback or suggestion. Here is the Getting Started guide. Have fun!

bobie

homanp commented 8 years ago

Hi @bchen-twilio!

Thanks! I think this is a server side issue as you pointed out. Thanks again!

Yep I'm using the Programmable Voice SDK for iOS. Really great work! I've integrated CallKit to it as well!

bobiechen-twilio commented 8 years ago

Hey @homanp, It's super awesome that you've tried the CallKit integration. We are working on couple of new methods for SDK users to configure/start/stop audio session at proper timing for CallKit integration, and should be available soon in the next beta release. Stay tuned!

bobie

homanp commented 8 years ago

Great!

@bchen-twilio will you integrate CallKit fully as well? Like out-of-the-box?

bobiechen-twilio commented 8 years ago

Hi @homanp, Currently the plan from our side is to provide audio session related methods and leave the CallKit flow integration to the application, since so far  is still improving their CallKit framework and we don't want to keep asking developers to update every time we update because  updates. Plus it gives more flexibility for the application to handle state-callbacks from CallKit and reflect on the UI. Thanks for the feedback 👍

homanp commented 8 years ago

Yeah, sounds like the way to go.

homanp commented 8 years ago

Updating the Voice Quickstart Server did it for me. The access token I received was wrong which caused this error.

bobiechen-twilio commented 7 years ago

Hi @homanp, How are things? While we are still working on pushing the next beta release, we've added a couple of improvements to the Voice SDK so it would be great if you could give it a try. https://drive.google.com/file/d/0B0jCXbOI9plrcmYzNFhRVF8tc0E/view?usp=sharing Also this patch contains a bitcode fix to address an issue that the apps will fail to export for store submission, if bitcode is enabled.

Thanks.

bobiechen-twilio commented 7 years ago

Hi @chriseman, Haven't heard from you for a while so I am assuming that it's okay that I close this issue. You are welcome to report new issues in the future.

jjviscomi commented 6 years ago

This may or may not be the issue, we have encountered 31000 errors two times in our development and both were a result of generating the JWT on our server api. To be clear the error was a 31000 on the client, but the reason for this was in the construction of the JWT, and the params we wanted twilio to send back to our application.

When passing in an object to allow_client_outgoing or allow_client_incoming the twilio sdk concats this all in their scope attribute in their JWT. It added it to the scope:client:outgoing?appSid= which looks like a query string. That means it has a size limit of 2048. So exceeding this length generates a 31000 error.

In addition adding the objects doesn't seem to always implicitly serialize the object correctly, it introduces characters that can generate errors in their corresponding mobile sdks (but not their web sdk ... weird) so we took care of this by explicitly serializing objects to JSON before they are inserted into the JWT.

I hope both of these examples help you track down the issue.

bobiechen-twilio commented 6 years ago

Hi @jjviscomi

Thanks for the great debug info. We are actually sunsetting the Twilio Client SDK and are focusing our efforts on the Programmable Voice SDK, which adopts the new Twilio Access Token format.

jjviscomi commented 6 years ago

@bchen-twilio yea we are in the process of converting, however the documentation on the website is horribly incorrect, which obviously makes the process much more painful. Is there a specific sunset date ?

bobiechen-twilio commented 6 years ago

Hi @jjviscomi

We are really sorry about the inconvenience. Can you tell us which documentations are giving you hard time to follow?

The sunset date of the Twilio Client (mobile) SDK is not decided yet but unless there is any major backward-compatibility issue (for example platform updates that require developers to upgrade) otherwise we'll keep the updates to the latest Voice SDK.

By the way if you run into problems using the Programmable Voice SDK, please create issues in the Voice Objc Quickstart or Voice Swift Quickstart repos. Thanks!

jjviscomi commented 6 years ago

Docs on capability-tokens for 5.x https://www.twilio.com/docs/guides/client/capability-tokens#creating-tokens https://www.twilio.com/docs/guides/client/capability-tokens#creating-tokens

On Feb 20, 2018, at 1:12 PM, bchen-twilio notifications@github.com wrote:

Hi @jjviscomi https://github.com/jjviscomi We are really sorry about the inconvenience. Can you tell us which documentations are giving you hard time to follow?

The sunset date of the Twilio Client (mobile) SDK is not decided yet but unless there is any major backward-compatibility issue (for example platform updates that require developers to upgrade) otherwise we'll keep the updates to the latest Voice SDK.

By the way if you run into problems using the Programmable Voice SDK, please create issues in the Voice Objc Quickstart https://github.com/twilio/voice-quickstart-objc or Voice Swift Quickstart https://github.com/twilio/voice-quickstart-swift repos. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twilio/cocoapod-specs/issues/24#issuecomment-367085777, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYhSh38EeJIU5kXxdmMujOuhOA36Ebrks5tWxkKgaJpZM4J88yj.