How to send push notification from Kamailio? Both GCM and APNS - push-notification

I am creating custom SIP client (Android & IOS), which uses Kamailio as a proxy and it's required to send push notification from Kamailio to the clients when a call towards that client reached on Kamailio.
I found a module for APNS here https://github.com/tvntsr/push. But I am developing both Android and IOS clients.
So What mechanism can I use on the Android side?
Is there any module available for GCM(Google Cloud Messaging) in Kamailio?
Or is there any other mechanism for availing both GCM & APNS on Kamailio?

Reasonable version is write custom module or do insert into mongodb or mysql )with event message), after that process it by external script.
Also possible do curl(http) request to external module, but that block core in kamailio. Avoid block core, result is zero perfomance.
Unfortanly any method also require delay and re-invite after push done, so this project is doable, but not for average kamailio "expert" (for sure not for novice).

Related

Webrtc sending call offer over FCM

I want to send the call offer message (sdp) over fcm to offline users. But the issue is the limit of fcm is 4096 bytes and the sdp of call offer exceeds this limit in case of video calls.
My mechanism for call offer: User creates a call offer message for remote peer, get the message and emit it to server via SocketIO. Server then checks if the remote peer is online (connected via socket).
Now if the remote user is offline I need to send the sdp to the user via push notification.
Is my approach to this problem correct? Or do I need to change the mechanism to first signal the call offer and then when the remote user get notified, I generate call offer and use my SocketIO to transmit the sdp
Or do I need to change the mechanism to first signal the call offer and then when the remote user get notified, I generate call offer and use my SocketIO to transmit the sdp
I would suggest the above approach instead. Use the push notification to "wake" the remote user (callee) and make them connect via SocketIO. Then, make the caller generate the offer SDP and send the SDP via SocketIO to the callee.
you can reduce the amount of information with some of the techniques described in https://webrtchacks.com/the-minimum-viable-sdp/
Given that the information in the SDP is somewhat time-critical a small push notification and then fetching the full SDP from your local server is the better approach.
In case of iOS, You can use VOIP notification. Also you need to increase VOIP push notification size while sending the notification from server side(e.g. java).

Is it possible to broadcast messages in a production PWA using FCM for Web without having a dedicated XMPP server?

This is an architectural question. I haven't implemented FCM yet, but as far as I understand someone needs to deploy an XMPP server in a real world scenario which provisions the inventory of the registered device tokens.
In my use case I'd like to just broadcast short messages about important update information, like "XY presenter's session at 15:00 got cancelled" and I'm not interested in the device tokens. My application is a Progressive Web App, so I would use FCM for Web.
The demos I saw so far showed a client receiving the device token, then that specific device token was picked up from the debug environment and used to send the demo message to the client - thus bypassing the need of a deployed stand-alone XMPP server, but just for demo purposes.
I'd want to avoid the use of an XMPP server, I'm not interested in dealing with the device tokens at all - if possible. Firebase's FCM/GCM server have them anyway. My plan is to pick a single topic name for that channel (the only topic what my app would use actually at this point), and push messages to the devices who listen to that topic. Is this a viable plan? I haven't found any mention of this whatsoever. Firebase knows all the tokens internally and it would make the architecture simpler if I don't have to deploy a server.
I don't know how the decomission/expiration of the device tokens would happen on Firebase's side, but that's another issue I'd have to deal with if I'll run my own XMPP server and provision tokens.
To send messages to a device (so-called downstream messages), you need to specify the server key. As its name implies, this key should only be present on a server or in some other trusted environment. So to send messages to devices you will need to run code in a trusted environment.
The server doesn't have to speak the XMPP protocol however. You can also just use HTTP to call the FCM servers. But a server will be needed, simply because sending downstream messages can only be done from a server.
For a simple example of sending device-to-device messages with this approach, see my blog post Sending notifications between Android devices with Firebase Database and Cloud Messaging. It's about Android, but the same approach of using the Firebase Database as a message queue will work across all platforms.
The tricky bit to map will be (as you already mention) the fact that topics are not available to FCM for the web yet. Last time I tested, you could call a server-side end-point to subscribe to a topic, like described in this answer: GCM: How do you subscribe a device to a topic?.

How to build push notification in mobile application using mosquitto?

I learned that PUSH NOTIFICATION service is like a persistent TCP connection.
But I don't know how maintain the connection even if the phone terminate the app.
In mobile application, if the subscription is destroyed, how we publish and deliver the message?
Should I use GCM, APNS or SMS? And wait until client subscribe the topic?
That's correct, you have to be connected with the broker (mosquitto broker in this case) to receive the push notification (you also must be subscribed to topic).
In Android I'm using paho client libray, a Service for keep connection in background, and BroadcastReceiver to start service at reboot.
For iOS you can find swift and Objetive-C MQTT-client librarys (I'm using CocoaMQTT) but you can't keep connection in background indefinitely. You have to use APNS.

How does Tweetdeck do it's push notifications?

Without polling how does the Flex application receive push notices?
I assume Tweetdeck didn't do push notifications. I assumed it made API calls on a timer. When I have Tweetdeck and ServiceCapture up at the same time, tweetdeck sure does send a lot of traffic. I assume it is server pings looking for more data to retrieve.
That said, to do push notifications You need a socket server; so that the client is perpetually connected to the server. A few options for servers that support this are Adobe's LiveCycle, BlazeDS, GraniteDS, or WebORB.
I understand that GraniteDS uses a technique called long polling. BlazeDS uses the same approach. LiveCycle--and I believe WebORB--can use RTMP to do push notifications.

push notification explanation

What are push notifications and how do they work? Also what is the difference with googles cloud to device messaging? Is c2dm also a push notification? Also do I need Special server setup to implement push notification?are push standard or every device has different implementation?
Basically the server maintains a list of connected clients. Whenever something of interest occurs, the server sends the data/notification/updated state to the connected clients. This is in contrast with pull, where the clients poll the server for changes.

Resources