BelledonneCommunications / linphone-android

Linphone.org mirror for linphone-android (https://gitlab.linphone.org/BC/public/linphone-android)
https://linphone.org
GNU General Public License v3.0
1.13k stars 692 forks source link

Documentation about PUSH-notifications #805

Closed SomeGeek closed 5 years ago

SomeGeek commented 5 years ago

Is there any documentation about push notifications available for Linphone?

What should be the right content of such a message to 'wake up' Linphone? And would it be a good idea to have a option inside the UI to define your FCM tokens?

For clarity: I'm talking about push notifications sent from my own PBX, not sip.linphone.org!

Viish commented 5 years ago

Yes there is documentation inside the README file on how to configure the app for your own push notifications. We can't have a UI option for that as it requires a specific file at compilation time.

SomeGeek commented 5 years ago

Yep, it's how to include your own FCM keys. It doesn't mention anything about the server side of things. What kind of notification do I need to send?

This piece of code shines some light on the subject.

- $type      : apple, google, wp, firebase\n"
- $token     : device token\n"
- $api-key   : the api key to use (google and firebase only)\n"
- $app-id    : application ID\n"
- $from-name : the display name in the from header\n"
- $from-uri  : the sip uri of the from header\n"
- $from-tag  : the tag of the from header \n"
- $to-uri    : the sip uri of the to header\n"
- $call-id   : the call-id of the INVITE or MESSAGE request\n"
- $event     : call, message\n"
- $sound     : the sound file to play with the notification\n"
- $msgid     : the message id to put in the notification\n"
- $uid       : \n"

But how does this need to be placed inside such a request?

Viish commented 5 years ago

That a look at flexisip pusher tool : https://github.com/BelledonneCommunications/flexisip/blob/23af6b202bb9b74c865d2dce86eb65eb69fc4a96/src/tools/pusher.cc Also you can look at the firebase documentation because flexisip code won't help you much to do the work in Asterisk...

SomeGeek commented 5 years ago

Let's distinguish three things here.

The only reason I looked into Flexisip code is to find out what kind of information I need to have inside my push message. At some point in the dialplan, I need to sent out a push message. How to sent a push message is out of scope for this question.

Linphone recognizes some specific push message as a wakeup call. When I get to send the right message (and putting the right content in that message), it will do so. After that, it's a SIP configuration matter.

This pusher tool seems to differ from the Flexisip one, as I don't see any SIP addresses being sent out. Is that correct?

Viish commented 5 years ago

For Android we don't care about the content of the push, it only has to be a high priority data message.

SomeGeek commented 5 years ago

Great, that's the information I'm looking for. Some reference to this in the readme would be great.

sercangoger commented 2 years ago

@SomeGeek hello, what is the solution for this problem? how to wake app with firebase notification? do you have a sample json format?

Viish commented 2 years ago

@sercan447 take a look at our wiki https://wiki.linphone.org/xwiki/wiki/public/view/Lib/Features/Push%20notifications/

sercangoger commented 2 years ago

@Viish

With this data format that I have thrown with Firebase, I can wake up the closed linphone application (foreground service is closed. I am talking about closing the application completely with "quit").

{ "to": "x7NrNknM8thlNA3PDZrjf0ETggm2Tvxq_hvI20QTk0uRwuoR5MgXUDYNU", "time_to_live": 0, "priority": "high", "data": { "uuid": "", "form-uri": "", "display-name": "", "call-id": "", "sip-from": "", "loc-key": "", "loc-args": "", "send-time": "" } }

I don't know how to fill in data like "form-uri", "sip-from" for example here. If I can fill this data correctly, I can also receive the incoming call after waking the application. Can you help me?

Viish commented 2 years ago

@sercan447 For Android these information aren't used, only call-id is used. If it matches the call-id of the message or call that triggered the push sending and that will be received when the Core will be waken up it will terminate the background task faster than if this information isn't set or doesn't match the reality.

sercangoger commented 2 years ago

here just sending call-Id didn't solve my problem. I'm passing the rest of the parameters empty.

{ "to": "8thlNA3PDZrjf0ETggm2Tvxq_hvI20QTk0uRwuoR5MgXUDYNUyJ-KMprbluyoy5FX63Pl-uP9HyQFHFidLm3vkZSh4IQzY", "time_to_live": 0, "priority": "high", "data": { "uuid": "", "form-uri": "", "display-name": "", "call-id": "abd77cd7-48e0-4baf-bcee-81ffcb3a78c2", "sip-from": "", "loc-key": "", "loc-args": "", "send-time": "" } }

sercangoger commented 2 years ago

I initiate a call while the application is closed, that is, "quit". When the call is coming, I take the "call-id" and send it to firebase with postman. My linphone app foreground service starts running. but it cannot find the incoming call and show it to me.

Viish commented 2 years ago

Please attach logs showing what happens when a push is received.

sercangoger commented 2 years ago

Can we talk privately with you? sercan.goger@gmail.com can you reach me here?

Viish commented 2 years ago

@sercan447 you can send me your logs at sylvain.berfini@belledonne-communications.com

Viish commented 2 years ago

Your log stops suddenly when the Core starts during the registration process, and given the startup logs showing previous exit reasons it seems it crashes. Can you catch the crash stacktrace using adb logcat tool? Also why do you make LIME requests to our server? If that's a mistake, simply any mention of lime.linphone.org from your app.

sercangoger commented 2 years ago

"Also why do you make LIME requests to our server?" we don't do anything like that. listen;

-We have two phones. -linphone app is installed on both phones. -Both phones are registered to the same account. -Now we open one of the applications on the phone and close the other completely. -then we look for the account where the phones are registered from a third account. -When a call is made, the first phone receives the call directly because the linphone application is open. but the linphone app on the other phone is completely closed. and we take the "call-id" information from the first phone's logs via android studio and send it to the second phone as a notification. -We want to continue the call when we click on the notification on the second phone. -We are trying to do this with FREEBPX ip server. -but this scenario I described above can only be done by flexisip. freepbx or similar servers with other sip servers cannot do this.

Viish commented 2 years ago

@sercan447 if your proxy server (FreePBX in your case) can't send push notifications itself, you can always install a flexisip as "push gateway". You can find a documentation about it here: https://wiki.linphone.org/xwiki/wiki/public/view/Flexisip/HOWTOs/Push%20Gateway/

pergolafabio commented 1 year ago

Guys, was reading this thread.... Am i correct saying that the pusher tool is a seperate tool? No flexisip is needed?

If yes, that means i can execute the tool to wake up linhome/linphone with a push message , with the original json supplied by the app? If yes, how can i execute this command? Any example is very welcome

thnx!!

Viish commented 1 year ago

@pergolafabio No, the pusher relies on flexisip so you can't have one without the other.

And for push to work, you need push certificates to match the ones your app has been build for.

iamhalje commented 10 months ago

@Viish Hello, after reading all the documentation/articles/maillists I found, it remains unclear to me whether it is possible to download the application from the "Play Store" and which API to send a request from my SIP proxy(without or with flexisip if this required), or for this I need to create a project in Firebase, rename the project, replace app/google-services .json, and only after that will I be able to send Push notifications to client who use Linphone mobile app?

only in the second case, again, need this rebuilding Linphone, install it for all clients, which in total is not desirable, I would like to be able to send push-notification using the API installed to clients from the official Google store on Android. .which ideally, of course, would be desirable. (or is this beyond open source)

Best Regards!

Viish commented 10 months ago

Hi @iamhalje,

You can't send push notifications from your server to our app on the Play Store because our server push certificate is private and we currently don't offer a public API to trigger push notifications from third party components.

You need to rebuild our app with your own google-services.json file that contains your own push certificate matching the one configured in your SIP server.

Cheers,