Home-made push notifications service for Android
For the ones who can't build Linphone, this is how to build an "home-made" push notifications service, which launch an Android VoIP client, by pushing incoming calls notifications trough GCM.
NOTE: It requires two paid Android app: Pushover and Tasker.
Step 1: Create Pushover account and register application
Create a Pushover account (
https://pushover.net/)
Register an application:
https://pushover.net/api
Write the app token and the user key
Step 2: Setup bash shell script to send pushover notifications (credits to akusei
https://github.com/akusei/pushover-bash)
Download the bash script:
https://raw.githubusercontent.com/akusei/pushover-bash/master/pushover.sh
Put the script in "/usr/share/freeswitch/scripts/"
Be sure to make the file "pushover.sh" executable (
chmod 755 pushover.sh
)
Download the config file:
https://raw.githubusercontent.com/akusei/pushover-bash/master/pushover-config
Put "pushover-config" in "/etc/pushover/" and fill it with your own Pushover api token and user key
Step 3: Install Pushover app (you can try the app before buying)
Install Pushover for Android on your device (
https://play.google.com/store/apps/details?id=net.superblock.pushover) and insert username and password
Step 4: Test notifications
Run "pushover.sh" script in a bash shell:
pushover.sh -m "TEST"
Step 4: Install Tasker app
Install Tasker on your device:
https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm
Step 5: Create Tasker triggering profile (img 1)
Create a new Profile: Event: Pushover notification
Configure the triggering event: Message matches "Inbound call" (img 2)
Step 6: Create Tasker task
In order to launch an Android app while the device is locked, we can use a Java trick to wake up the device.
Import (or crete a new one task following the img 3) the attached "WakeUpDevice" task by long pressing on the "Tasks" tab (it is a zip file, because the forum does not allow to attach xml files, extract it before importing).
Edit the WakeUpDevice task and add an new action at the bottom of the task: Plus icon, App, Launc App and choose the VoIP client.
(A t this point, you can use AutoNotification cancel to auto dismiss the incoming call notification).
Set up a task to kill the VoIP client after a call is ended (in my case I set up Profile triggered by Sate: Display off, which run a task for killing the VoIP client)
Step 7: Configure Fusionpbx
Edit the Fusionpbx dialplan for the inbound route and insert the system action to send push notifications:
/usr/share/freeswitch/scripts/pushover.sh -s none -m 'Inbound call from ${caller_id_number}'
Set the proper ringback option and sleep or call timeout (img 4 is an example of a dialplan based on the destination number which works for me).
Step 8: Final test
Test the system by runnig "pushover.sh" in a bash shell:
pushover.sh -m "Inbound call from"
or by calling your phone number.
If everything works, you should get a Pushover notifications on your phone and the VoIP client should start.
Of course, edit names and commands according to your needs.