Interest in implementing SIP push notification

I don’t have a vanilla Android to play with, but I would assume the problem only arises because of the operation of the power monitor.

Yeah, you are right about that. Unfortunately, Android has progressively become more and more aggressive in battery optimization by curtailing what apps in the background can do. This thread tells the story pretty well.

Since Android 8 there is very little chance that an app can reliably maintain a network connection when it is not active and in the foreground. This pretty much leaves us with push notifications as the only option to receive calls. The other frustrating thing about this is that the only push system I am aware of that will actually work reliably on Android is Google’s FCM. So, we are forced to bring a 3rd party into the process of receiving every single call.

Hi ringdom,

Maybe you can try Zoiper.

In zopier, Setting->Connectivity->Enable Keep Alive WiFi & Run in background is on
And Setting->Connectivity->Background Mode -> Select 『Wake Lock』
Successfully answer calls on Samsung J4 mobile phones for a long time

Thanks for the suggestion. I have played with it a bit. It seemed to ring fairly reliably in my testing, but it’s been a while so I can’t remember if I ran into any other issues with it. Being closed source was the main deal killer for me there.

Thanks for sharing.
My understanding is this addresses Android issue only; would this work with iOS 12 (iPhone)?

Cheers,

I don’t have as much experience with iOS, but I understand the situation is very similar there (aggressive battery saving prevents background apps). The RFC linked in the OP even mentions iOS specifically in the Introduction.

Thank you @Dilbert66 for sharing the script, really appreciate it.
I am trying to implement this code to work with my asterisk 16 to make push to my ios sip client. As it is shown here, it work with Google Firebase and android only. Any suggestion on what modifications needed to work the script with Apple Push Notification (APN)?

I’ve not done it myself but am curious about better solutions to the problem, after being frustrated in the past with battery and disconnect issues on some SIP soft phone clients, so, here are some APN docs you might consider:

https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html

Also the RFC draft that OP linked to is, as of last month, now a proposed standard # 8599:

https://tools.ietf.org/html/rfc8599

One decent Java implementation of push over GCM/APN/WebSockets can be found in the open source Signal-Server project:

HTH

1 Like

Hello @Dilbert66 Can you please explain how client will get INVITE retransmitd untill phone wake up and ready for accepting calls?

  • what is rt in Dial(SIP/${ph},30,rt)?
  • What is 30 in Dial(SIP/${ph},30,rt)?

The SIP protocol itself will ensure that the INVITE is transmitted.

Type “show application dial” at the CLI prompt, or look it up in the wiki, on at asteriskdocs.org.

sometime if i do not dial direct extension number and using DTMF which is a extension for another party. How can i get that DTMF digits? How to check DTMF digit is equal to extension. I want send notification on that extension.

Have you made any progress on this?
Have you tried to receive notifications with flexisip when the android application is completely closed?
this is what i was looking for!
In new versions of linphone, it keeps the application open by using the foreground service and thus calls can be received. but this is not what is desired.
Did you find a way to wake up the application when the application is completely closed?

Unfortunately, I had to abandon Linphone on Android for my use case. Now we use good old fashioned WiFi SIP phones. They are a bit more cumbersome to use, but they actually ring when calls come in, so that’s a plus.

I do think the foreground service, as annoying as it is, is the only way that this is going to work on Android (and maybe if that had been around I would have stuck with Linphone). Without that, the system is just going to kill the app eventually. The other idea I had but never pursued was to customize Linphone to be a “Launcher” which I don’t believe the system ever kills.Obviously, that approach has a lot of draw backs. For example, you would have to build actual app launcher functionality into your softphone which is kind of silly, but it might have worked.

Of course, if RFC 8599 is ever implemented in Asterisk, that could solve the problem as well.

Have you made any progress on this?
Have you tried to receive notifications with flexisip when the android application is completely closed?
this is what i was looking for!
In new versions of linphone, it keeps the application open by using the foreground service and thus calls can be received. but this is not what is desired.
Did you find a way to wake up the application when the application is completely closed?

Hey @Dilbert66 or @ringdom , this is an old script, do you guys still use it?
I dont believe it works on pjsip right? the only thing left for me is to grab the token
I already recompiled linhome or linphone, with my own google-services.json file, and also grabbed the token
By sending it in a curl script, i can wake the app so it registers… but i grab the token manually from the app… if i update it or renstall, te token changes, so i was looking for a script to grab the token…
the rest of the dialplan is ready… i work with a while loop, i check for 45 seconds, if the extension registers, then i dial out…
normally after sending the push, it takes about 2-3 sec for the registraion to come in…

tnx for feedback

Unfortunately, as I mentioned before, I had to abandon by original set up here, so I am not currently using this script. We switched to dedicated devices to avoid this hassle.

ok, thnx for feedback
maybe someone else can provide feedback , the only part mising for me is to grab the token , rest of the stuff works :slight_smile:

Sorry, this is a really old post. I have not touched this or used it in a fairly long time and no, it was never tested with pjsip unfortunately. This was done with my initial newby forays into Asterisk setups so was not optimum. It did work but I was not happy with the Linphone push response at the time so I moved on.

Ah, yeah, I have loaded my own google-services file, I see the push coming in very fast, the reg time takes about 2 sec after I send the curl…

I just need to find a way to get the token, I now grab that manually from the app, added a new text field in it to see the token… But it changes on reinstall or clear settings…

What do you use now instead then? I