masashi-sutou / flutter_ios_voip_kit

One-to-one video call using CallKit and PushKit with flutter iOS app.
MIT License
67 stars 45 forks source link

getVoIPToken hangs #7

Closed ghenry closed 4 years ago

ghenry commented 4 years ago

Hi,

I've edited the example via Xcode to use our app identifier and did flutter run after changing the Signing Team. It just sits at getVoIPToken when I go to Your Callee page.

I've generated a VoIP Certificate, so I can test notifications like so:

curl -v \
-d '{"aps":{"alert":{"incoming_caller_id":"01224123456","incoming_caller_name":"Gavin Henry"}}}' \
-H "apns-push-type: voip" \
-H "apns-expiration: 0" \
-H "apns-priority: 0" \
-H "apns-topic: my_valid_identifier.voip" \
--http2 \
--cert ./my_valid_identifier.voip.pem \
https://api.sandbox.push.apple.com/3/device/9727245afdd86fe042950bcaaae5b0ec7762fd2ef6659cd6f01f033303621542

which results in:

* Server certificate:
*  subject: CN=api.development.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
*  start date: Apr 17 17:37:51 2019 GMT
*  expire date: May 16 17:37:51 2021 GMT
*  subjectAltName: host "api.sandbox.push.apple.com" matched cert's "api.sandbox.push.apple.com"
*  issuer: CN=Apple IST CA 2 - G1; OU=Certification Authority; O=Apple Inc.; C=US
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55ad3c2ec460)
> POST /3/device/9727245afdd86fe042950bcaaae5b0ec7762fd2ef6659cd6f01f033303621542 HTTP/2
> Host: api.sandbox.push.apple.com
> User-Agent: curl/7.66.0
> Accept: */*
> apns-push-type: voip
> apns-expiration: 0
> apns-priority: 0
> apns-topic: my_valid_identifier.voip
> Content-Length: 94
> Content-Type: application/x-www-form-urlencoded
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 1000)!
* We are completely uploaded and fine
< HTTP/2 400 
< apns-id: B7168B2F-0353-68ED-76C2-0B26B0E8D90B
< 
* Connection #0 to host api.sandbox.push.apple.com left intact
{"reason":"DeviceTokenNotForTopic"}

Now that is the correct device id for my test iPhone 8 as I ran the example previously before changing the identifier. What have I missed? The cert was created against the correct identifier on https://developer.apple.com/account/resources/certificates/add

Thanks.

ghenry commented 4 years ago

It's the same on 13.5.1, so not iOS related.

ghenry commented 4 years ago

It came through eventually after clicking Caller. Maybe coincidence. Now to test a push! :-)

ghenry commented 4 years ago

So the alerts fail if I don't add rtc_channel_id (which I created via uuidgen on Fedora Linux), but do we need rtc_channel_id? Can't we just call it UUID as per:

https://developer.apple.com/documentation/callkit/cxprovider/1930694-reportnewincomingcallwithuuid?language=objc https://github.com/masashi-sutou/flutter_ios_voip_kit/blob/master/ios/Classes/CallKitCenter.swift#L78

Or is this the wrong plugin I'm using with Flutter as it seems geared toward just one-to-one calling?

Thanks!

masashi-sutou commented 4 years ago

@ghenry

ghenry commented 4 years ago

Nice! For Step 4. you can also do this quicker without a MacBook and KeyChain:

openssl x509 -inform der -in voip_services.cer -out voip_services.pem

Then paste your key in the .pem after the cert Apple gave you. To create your CSR (bundle_id.voip.csr to upload) and Key for upload to Apple Developer Portal do:

openssl genrsa -out bundle_id.voip.key 2048
openssl req -new -key bundle_id.voip.key -out bundle_id.voip.csr

bundle_id is just a naming format I did.

Thanks!