1

I've configured the Pusher Kazoo's application to wake up an iOS device before forward a voip call. I followed the official documentation here.

To send a push with APNS, Pusher use this library that works pretty well if I try it passing the parameters that Pusher should to.

Anyway, looking at Kazoo log, when Pusher try to send the push, an error is thrown during the connection with apns.

16:31:55.765 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|pm_apple:190(<0.5496.33>) error loading apns exit / {noproc,{gen_server,call,[apns_sup,{start_child,[#{apple_host => "api.push.apple.com",apple_port => 443,certdata => <<48,130,6,68,48,130,5,44,160,3,2,1,2,2,8,51,37,182,13,201,39,91,46,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,48,129,150,49,11,48,9,6,3,85,4,6,19,2,85,83,49,19,48,17,6,3,85,4,10,12,10,65,112,112,108,101,32,73,110,99,46,49,44,48,42,6,3,85,4,11,12,35,65,112,112,108,101,32,87,111,114,108,100,119,105,100,101,32,68,101,118,101,108,111,112,101,114,32,82,101,108,97,116,105,111,110,115,49,68,48,66,6,3,85,4,3,12,59,65,112,112,108,101,32,87,111,114,108,100,119,105,100,101,32,68,101,118,101,108,111,112,101,114,32,82,101,108,97,116,105,111,110,115,32,67,101,114,116,105,102,105,...>>,...},...]},...]}}
16:31:55.765 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:97(<0.5496.33>) stacktrace:
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:alist/3 at (448)
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:alist/3 at (418)
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:print/3 at (168)
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:map_bodyc/3 at (359)
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:map_bodyc/3 at (361)
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:map_body/3 at (348)
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:print/3 at (285)
16:31:55.766 [error] |1aee60d7-7e93-4d70-8bbd-b1f647915d45|kz_util:104(<0.5496.33>) st: lager_trunc_io:list_body/4 at (311)

Sending the push mannualy, it works, so the certificate should be right.

Any advice? I did the same with FCM for Android and works like a charm.

Darion Badlydone
  • 897
  • 14
  • 37
  • 1
    It complains that the process `apns_sup` is not running. Is the `apns` application started? You can check with `application:which_applications()` in the Erlang shell. – legoscia Feb 16 '22 at 11:29
  • If I run `erl` and `application:which_applications().` I got this: `[{stdlib,"ERTS CXC 138 10","3.12.1"}, {kernel,"ERTS CXC 138 10","6.5.2.1"}]`. So, it seems not running. How do I can start it? Thank you – Darion Badlydone Feb 16 '22 at 13:14
  • You can start it with `apns:start()`. You may want to declare that your application depends on the `apns` application, in order to have it start automatically - if you're using rebar3, see the [Building a Project with Dependencies](https://adoptingerlang.org/docs/development/dependencies/#building-a-project-with-dependencies) section of "Adopting Erlang". – legoscia Feb 16 '22 at 14:26
  • You're right, the process is off because crash on start. It'a already included into the `pusher.app.src` between the applications. It give this error on start: `gen_statem 'apns' in state connected terminated with reason: {'function not exported',{string,lowercase,1}} in gun:normalize_headers/1 line 661` and `CRASH REPORT Process 'apns' with 0 neighbours crashed with reason: call to undefined function string:lowercase(<<"apns-expiration">>)` – Darion Badlydone Feb 16 '22 at 15:58
  • `string:lowercase` was added in Erlang/OTP 20.0. Are you using an earlier Erlang release? – legoscia Feb 16 '22 at 16:25
  • erl console give me `Erlang/OTP 22 [erts-10.7.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]`. If I execute `string:lowercase("apns-expiration").` in console it return the right result. – Darion Badlydone Feb 16 '22 at 16:32
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/242077/discussion-between-darion-badlydone-and-legoscia). – Darion Badlydone Feb 16 '22 at 16:43

0 Answers0