SOLVED Push Notification.

Status
Not open for further replies.

Dee

Member
Jun 7, 2019
50
3
8
35
Hello house, Does this push notification also work with IOS?

Basically being able to recieve call in background on linphone IOS with fusionpbx
 

topogigio

Member
Jun 17, 2019
68
0
6
58
I'm also looking for a way to send push to Linphone to allow it to work on IOS (when now is not possible to receive calls without push)
thanks
 

toolfolks

Member
May 1, 2020
73
5
8
65
Hi guys,

I am trying to get the php code to run and send a notification from the web browsers internally before adding to a dial plan.
I have created push_notification.php in the www folder ( for now ) and made it an Hello World script.
I ran http://192.168.1.2/push_notification.php
and got the hello world text so php is running okay.

I have updated your script as follows:
added after <?php

error_reporting(E_ALL);
ini_set('display_errors','on');

added my firebase API key

I have placed the php file in the var/www/fusionpbx folder ( is this location okay ??)

From the internal network when I run with http://192.168.1.2/push_notification.php/extent=1005

I get the push notification to my android device ( as I have used the Android tokenID )

1. In my dial plan I manually edit the type to system. Leave the field and save. The type just changes back to whichever one I selected.

2. When I want to updated my script what things do I stop / refresh in Sip status ( at the moment I'm doing all )
 

Attachments

  • Screenshot 2020-05-24 at 16.55.21.jpg
    Screenshot 2020-05-24 at 16.55.21.jpg
    62.5 KB · Views: 97
  • Screenshot 2020-05-24 at 16.52.16.jpg
    Screenshot 2020-05-24 at 16.52.16.jpg
    61.5 KB · Views: 95

toolfolks

Member
May 1, 2020
73
5
8
65
I found the following on the Freeswitch site:

mod_dptools: system
Skip to end of metadata
Created by Jonatas Oliveira, last modified by John Boteler on 2016.12.15
Go to start of metadata
About
Execute an operating system command and wait for the result (blocking).

Click here to expand Table of Contents
Usage
system <command>
Because this command blocks further execution of the dialplan until it completes, do not execute long-running commands this way. An alternative is the 'bgsystem' dialplan app to run the command in the background.

I have bgsystem in my type list.

I have the same issue ( selecting bgsystem doesn't stick ).
 
  • Like
Reactions: abelitouci

Amit Iyer

Member
Feb 6, 2018
60
11
8
29
Hi, Amit,

What do we write in the fields below? Where will I find it?

define("FIREBASE_API_KEY","firebase key");
define("REGISTRATION_ID","REgistrarion ID");
You will find it in your firebase console.
Go to your project -> Project settings -> Cloud Messaging
Server key is your Firebase API KEY
Sender ID is your Registration_ID
 

Edson

Member
Aug 1, 2017
59
4
8
47
Dears,

I am not following the discussion, cause i dont know nothing about Firebase as well Android app dev. I have one initial question:

Do i have to rebuild Linphone to get push-notification to work on whatever smartphone i want? Or Linphone push notification will work only on my smartphone as it is logged in the same google account i have firebase service configured?

I do know that Linphone has a solution to do it, but it uses Flexisp push/sip gateway. It is confusing.

Regards!
 

John

Member
Jan 23, 2017
97
8
8
Dears,

I am not following the discussion, cause i dont know nothing about Firebase as well Android app dev. I have one initial question:

Do i have to rebuild Linphone to get push-notification to work on whatever smartphone i want? Or Linphone push notification will work only on my smartphone as it is logged in the same google account i have firebase service configured?

I do know that Linphone has a solution to do it, but it uses Flexisp push/sip gateway. It is confusing.

Regards!
Good question. I also wonder about this.
 

tjfayaz

New Member
Apr 20, 2021
15
1
3
46
I have attached the push notification file and in the local_ext dialplan i have changed the below.

View attachment 645
Hi Amit thanks for this, I implemented in the same way in local_ext and the push notification works but the app does not ring (the caller hears ringing but thew app is just waiting for a call). Even after waiting for the delay. It's as if after the delay the system is not sending the call. Any ideas? I wonder how it works for you or if you had a similar problem? Dialling non push extensions works as normal (after the delay).
 

tjfayaz

New Member
Apr 20, 2021
15
1
3
46
Hi Amit thanks for this, I implemented in the same way in local_ext and the push notification works but the app does not ring (the caller hears ringing but thew app is just waiting for a call). Even after waiting for the delay. It's as if after the delay the system is not sending the call. Any ideas? I wonder how it works for you or if you had a similar problem? Dialling non push extensions works as normal (after the delay).
ok I solved the not ringing issue by changing my dialplan to use sofia_contact instead of user (so all multiple registrations ring)
 

Vishal Pai

Member
May 2, 2017
35
1
8
34
Hi @Amit Iyer

I was looking at the file which you shared in the group. Is there any additional field added to v_extensions table to store the token for Ext.

"PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column "token" does not exist
LINE 1: SELECT token FROM v_extensions WHERE extension='101'
^ in /var/www/fusionpbx/pushapi/push_notification.php:257

Can you please help me out with the same.

Thanks.
 
Last edited:

Amit Iyer

Member
Feb 6, 2018
60
11
8
29
Hi Vishal, Yes I have added a 2 new columns in v_extensions one for token and one for the platform.
the token will be your app's Device token
platform will be your Device type ios or android.
 
  • Like
Reactions: Vishal Pai

Vishal Pai

Member
May 2, 2017
35
1
8
34
@Amit Iyer Thanks for the prompt reply.

Ok understood now so we need to store each token extension wise along with device type.

Now when i run this php file i am getting error

//require_once __DIR__ . '/config.php';
require_once 'conn.php';

"PHP message: PHP Warning: require_once(conn.php): failed to open stream: No such file or directory in /var/www/fusionpbx/app/destinations/restapi/push_notification.php on line 70

Seems something is breaking in code.

Thanks.
 

Amit Iyer

Member
Feb 6, 2018
60
11
8
29
do you have a file called conn.php ? the file conn.php contains the database connection, also if you don't have conn.php file you can just add the db config on push_notification.php file and then use that connection for the process.
 

Vishal Pai

Member
May 2, 2017
35
1
8
34
Ok got it, I can comment it out just need to update the parameter at the top

$host = "localhost";
$port = "5432";
$dbname = "fusionpbx";
$usernames = "fusionpbx";
$password = "My_Password";

Thanks.
 
Status
Not open for further replies.