jefflinwood / cordova-plugin-twiliovoicesdk

PhoneGap/Cordova Plugin for Twilio Programmable Voice SDK
MIT License
20 stars 51 forks source link

Ionic Incoming Call Not Receiving or Device is not Register with FCM #63

Open ronieporwal06 opened 5 years ago

ronieporwal06 commented 5 years ago

Hi @jefflinwood ,

I'm Using your plugin in Ionic 4 Application and i have done all the things and device is ready and calls are made but not receiving while i have tried to get notification from firebase and notification are receiving on device but not call.

Screenshot 2019-08-14 at 10 50 12 AM Screenshot 2019-08-14 at 10 50 45 AM Above are my ionic configurations.

it'll be great if you can look and help me out.

jayzam commented 4 years ago

I was having the same issue with incoming calls not working on ios. (It works on Android) I found this from Twilio and it helped me to resolve the problem.

https://github.com/twilio/twilio-voice-ios/blob/Releases/iOS-13-Migration-Guide.md

Based on this I made a change to TwilioVoicePlugin.m in this function.

pragma mark PKPushRegistryDelegate methods

(void)pushRegistry:(PKPushRegistry )registry didUpdatePushCredentials:(PKPushCredentials )credentials forType:(PKPushType)type { if ([type isEqualToString:PKPushTypeVoIP]) {

const unsigned *tokenBytes = [credentials.token bytes]; self.pushDeviceToken = [NSString stringWithFormat:@"<%08x %08x %08x %08x %08x %08x %08x %08x>", ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]), ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]), ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];

//self.pushDeviceToken = [credentials.token description]; NSLog(@"Updating push device token for VOIP: %@",self.pushDeviceToken); //[TwilioVoice registerWithAccessToken:accessToken deviceToken:self.deviceTokenString completion:^(NSError error) { }]; [TwilioVoice registerWithAccessToken:self.accessToken deviceToken:self.pushDeviceToken completion:^(NSError _Nullable error) { if (error) { NSLog(@"Error registering Voice Client for VOIP Push: %@", [error localizedDescription]); } else { NSLog(@"Registered Voice Client for VOIP Push"); } }]; } }

I also had to change 2 lines to get the plugin to compile with the Twilio version.

Changed this: [TwilioVoice handleNotification:payload.dictionaryPayload delegate:self]; to: [TwilioVoice handleNotification:payload.dictionaryPayload delegate:self delegateQueue:NULL];

I'm not sure the delegateQueue should be NULL but so far my testing is working.

ghost commented 4 years ago

Hello @jayzam

I am trying to integrate this plugin in my ionic 4 app. Could you please provide steps you have followed to get started with this plugin. Since there are is no official documentation provided for this plugin. Any help would be much appreciated.

Thanks

jayzam commented 4 years ago

Sorry, but I did not really document it fully. It took a bit to get it going so my notes are pretty random.

I started by getting the twilio quickstarts up and running so that I had all my twilio setup working. If you haven't already, you can do that.

https://github.com/twilio/voice-quickstart-objc#quickstart https://github.com/twilio/voice-quickstart-android

I'm happy to try to help but I don't have a lot of time to devote to it.

Jay