Setup Push notifications for iOS or Android

From Sky Networks Wiki
Revision as of 08:22, 1 August 2019 by Nathan (talk | contribs)
Jump to navigation Jump to search

Click Here to return to the the SkyPhone Main Screen: Back

Push notifications are used to notify the user of incoming calls and start SkyPhone when it is not running. If Skyphone is running, it will simply receive the call and start ringing.

To setup push notifications requires 2 things:

1. An updated mod_sofia.so module which you can obtain from Sky Networks.

2. This module must be configured as follows:

Click here for instructions on how to setup firebase cloud messaging on your app. https://firebase.google.com/docs/cloud-messaging


Click here for instructions on how to setup your push notification certificate for Apple. This is required for apple notifications even if you use firebase for the push instead of APN (Apple Push Notifications) https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns


Once it's setup you can access a) For google firebase you will need your Legacy server key - which can be found under your project settings, cloud messaging tab. b) For Apple you will need the push certificate from their developer console. This file should be put into he ios push certification is put into the /home/skynet/sky/bin/Certs folder There is a script (genpems) to convert the downloaded .p12 files into the required pem certificates. Edit the script as necessary to create production or dev certificates. The files that are needed for push are:

apns-dis-key.pem
apns-dis-cert.pem

or

apns-dev-key.pem
apns-dev-cert.pem

The configuration file is located in /home/skynet/sky/conf/autoload_configs/sofia.conf.xml

 '
   '<esc></esc>
   '<param name="is-ios-encode" value="1"/>
   '
   '<param name="is-android-encode" value="0"/>
   '
   '<param name="is-push-every-call" value="1"/>
   '
   '<param name="is-dev-cert" value="1"/>
   '
   '<param name="push-method" value="1"/>
   '
   '<param name="ios-push-use-fcm" value="0"/>
   '
   '<param name="android-push-url" value="https://fcm.googleapis.com/fcm/send"/>
   '
   '<param name="android-api-key" value="AIzaSyCE5l74KKPbOyWMZ-l2raqtUaD6FY2X0Y8"/>
   '
   '<param name="push-log-file" value="/home/skynet/sky/log/sky_push.log"/>
   '
   '<param name="fs-cli" value="/home/skynet/sky/bin/fs_cli"/>
   '
   '<param name="invite-wait-time" value="10"/>
 '</global_settings>


2. push server Usage.

  There should be a script called pushtest to try it in the sky/bin directory
 Here is the source:
  1. !/bin/bash
  2. Send a push notify to a client
  3. $1 - calling number
  4. $2 - called number

fsc "sofia_push external2 $1 $2

 skydance push is an API command. It has 3 argments. The usage is:
  sofia_push <profile_name> <calling_number> <called number>


  2.1 The push can be used in diaplan like:
   <action application="lua" data="/home/skynet/sky/scripts/sofia_push.lua internal 1001 1002"/>