AGProjects / sylk-pushserver

Mobile push notifications for RTC infrastructures
Other
13 stars 8 forks source link

Add fcm as a platform #7

Closed hasanr68 closed 1 year ago

hasanr68 commented 2 years ago

Hi all. It seems the newer Linphone sends out "fcm" as the platform. I think the same platform (fcm vs. firebase) needs to be stated in the applications.ini file. Would it make sense to add fcm as an accepted platform too? Or did I miss something?

tijmenNL commented 2 years ago

Hi,

Can you show me an example of the PN parameters which it sends out?

hasanr68 commented 2 years ago

Sure:

pn-prid=long token; pn-provider=fcm; pn-param=our firebase ID; pn-silent=1; pn-timeout=0;

I can email actual parameters if you like.

tijmenNL commented 2 years ago

Ok I will add support for the platform name.

tijmenNL commented 2 years ago

But what do you send to the push server, pn-provider, or pn-platform?

What i mean is, do you put pn-provider in platform for the wake up request?

hasanr68 commented 2 years ago

We would use the default script for opensips.cfg. (And push_tokens table). That would autopopulate the table with (firebase in platform column).

Applications.ini had firebase as platform, so we did not have to chose pn-provider/platform manually. Does that help or did I misunderstand the question?

tijmenNL commented 2 years ago

If you use the default, that means that Linphone sends pn-provider=fcm to OpenSIPS, then in in your OpenSIPS script you would map pn-provider to pn-platform? So:

Linphone [REGISTER] -----------------> OpenSIPS store it in the database
pn-provider=fcm                        map pn-provider to pn-platform
no pn-platform       

Is this correct?

Then on an INVITE you would send out:

OpenSIPS (pn-plaform=fcm...) ---> Pushserver

Is that correct?

If so the only thing that need changing in the pushserver is allowing the platform name 'fcm' and point it to 'firebase'

hasanr68 commented 2 years ago

Hi there.

Thanks a lot for the detailed explanation. I would have thought the same from my limited understanding of the system. Just enable platform name to be fcm and maybe send push to both firebase + fcm?

Thanks again for updating the system.

tijmenNL commented 2 years ago

If I map fcm-> firebase in the platform name there is no need to send two requests to the push server. I will commit a fix that does exactly this.

If you send platform='fcm' in the wake up request, it will use application=firebase

hasanr68 commented 2 years ago

Wow - it seems to be done already?

tijmenNL commented 2 years ago

Please test if it works and if this can be closed

hasanr68 commented 2 years ago

Will do and close if all is good.

hasanr68 commented 2 years ago

Just to confirm, apt-get install isn't working. Do I reinstall everything? Or some easy way of updating please?

tijmenNL commented 2 years ago

I did not make any new package.

Just fetch this:

wget https://github.com/AGProjects/sylk-pushserver/commit/029eceaf383a8b2114d0232fd2dce65190449f45.patch

Then apply it:

cd /usr/lib/python3/dist-packages/sylk-pushserver/lib/python3.7/site-packages/pushserver
sudo patch -p2 < /PLACE_OFF_PATCH/029eceaf383a8b2114d0232fd2dce65190449f45.patch

It could be that your path is slightly different, depending on distro

hasanr68 commented 2 years ago

Ok - thanks a lot..

hasanr68 commented 2 years ago

Hi there. Done as you said, updated platform column (push_tokens) to be fcm, following is the error: push rejected: platform must be 'apple', 'android' or 'firebase'

tijmenNL commented 2 years ago

If you apply https://github.com/AGProjects/sylk-pushserver/commit/ae61721911ac498bfe1793841c43803893e186ca.patch it should fix it.

hasanr68 commented 2 years ago

Great - that worked. Out of curiousity, do you think a new package might help? Manually pulling all the patches might be error-prone. Thanks again.

hasanr68 commented 2 years ago

Hi again. Wanted to pull all the updates - is there an easy way of doing that (outside of doing manually) please?