PushNotification

Last modified by Buildbot on 2024/04/25 01:13

 Documentation based on repostory git version commit 2.4.0-alpha-163-g766e8a2f 

Module PushNotification

This module performs push notifications to mobile phone notification systems: apple, android, as well as a generic http get/post to a custom server to which actual sending of the notification is delegated. The push notification is sent when an INVITE or MESSAGE request is not answered by the destination of the request within a certain period of time, configurable hereunder by 'timeout' parameter. The PushNotification has an implicit dependency on the Router module, which is in charge of creating the incoming and outgoing transactions and the context associated with the request forking process. No push notification can hence be sent if the Router module isn't activated. The time-to-live of the push notification depends on event for which the push notification is generated.  - if it is for a call (INVITE), it will be set equal 'call-fork-timeout' property of the Router module, which corresponds to the maximum time for a call attempt.
 - if it is for an IM (MESSAGE or INVITE for a text session), then it will be set equal to the 'message-time-to-live' property.
----

Configuration options:

NameDescriptionDefault ValueDefault UnitType
enabled

Indicate whether the module is activated.

 false Boolean
filter

A request/response enters module if the boolean filter evaluates to true. Ex: from.uri.domain contains 'sip.linphone.org', from.uri.domain in 'a.org b.org c.org', (to.uri.domain in 'a.org b.org c.org') && (user-agent == 'Linphone v2'). You can consult the full filter documentation here : https://wiki.linphone.org/xwiki/wiki/public/view/Flexisip/Configuration/Filter%20syntax/

  BooleanExpr
timeout

Time to wait before sending a push notification to device. A value lesser or equal to zero will make the push notification to be sent immediately, which is recommended since most of the time devices can't have a permanent connection with the Flexisip server.

 0 secondDurationS
message-time-to-live

Time to live for the push notifications related to IM messages. The default value '0' is interpreted as using the same value as for message-delivery-timeout of Router module.

 0 secondDurationS
max-queue-size

Maximum number of notifications queued for each push notification service

 100 Integer
retransmission-count

Number of push notification request retransmissions sent to a client for a same event (call or message). Retransmissions cease when a response is received from the client. Setting a value of zero disables retransmissions.

 0 Integer
retransmission-interval

Retransmission interval for push notification requests, when a retransmission-count has been specified above.

 5 secondDurationS
call-remote-push-interval

Default interval between to subsequent PNs when remote push notifications are used to notify a call invite to a clients that haven't published any token for VoIP and background push notifications. In that case, several PNs are sent subsequently until the call is picked up, declined or canceled. This parameter can be overridden by the client by using the 'pn-call-remote-push-interval' push parameter.
A value of zero will cause the deactivation of push notification repetitions and the sending of thefinal notification. Thus, only the first push notification will be sent.
The value must be in [0;30]

 0 secondDurationS
display-from-uri

If true, the following key in the payload of the push request will be set:
 * 'from-uri': the SIP URI of the caller or the message sender.
 * 'display-name': the display name of the caller or the message sender.
 * 'loc-args': the display name if not empty or the SIP URI instead.

If false, the keys will be set but as empty.

 false Boolean
apple

Enable push notification for apple devices

 true Boolean
apple-certificate-dir

Path to directory where to find Apple Push Notification service certificates. They should bear the appid of the application, suffixed by the release mode and .pem extension. For example: org.linphone.dev.pem org.linphone.prod.pem com.somephone.dev.pem etc... The files should be .pem format, and made of certificate followed by private key.
This is also the path to the directory where to find Voice Over IP certificates (certicates to use PushKit). They should bear the appid of the application, suffixed by the release mode and .pem extension, and made of certificate followed by private key. For example: org.linphone.voip.dev.pem org.linphone.voip.prod.pem com.somephone.voip.dev.pem etc...

 /etc/flexisip/apn String
no-badge

Set the badge value to 0 for Apple push

 false Boolean
firebase

Enable push notification for Android devices.

 true Boolean
firebase-projects-api-keys

List of pairs of <Firebase Project Number>:<Firebase Cloud Messaging API (Legacy) Server Key> for each Android project that supports push notifications.

  StringList
firebase-service-accounts

List of pairs of <Firebase Project Number>:<Path to service account json file> for each Android project that supports push notifications.

  StringList
firebase-token-expiration-anticipation-time

Represents the time in seconds to execute the access token refresh operation just before the current access token expires. This parameter is used to control overlapping access token lifetimes.

 300 Integer
firebase-default-refresh-interval

Default interval in seconds to execute the access token refresh operation in the event that the access token has not been successfully obtained.

 60 Integer
external-push-uri

Instead of having Flexisip sending the push notification directly to the Google/Apple/Microsoft push servers, send an http request to a server with all required information encoded in the URL, to which the actual sending of the push notification is delegated. The following arguments can be substituted in the http request uri, with the following values:
 - $type      : apple, google, wp, firebase
 - $token     : device token
 - $api-key   : the api key to use (google and firebase only)
 - $app-id    : application ID
 - $from-name : the display name in the from header
 - $from-uri  : the sip uri of the from header
 - $from-tag  : the tag of the from header
 - $to-uri    : the sip uri of the to header
 - $call-id   : the call-id of the INVITE or MESSAGE request
 - $event     : call, message
 - $sound     : the sound file to play with the notification
 - $msgid     : the message id to put in the notification
 - $uid       :

The content of the text message is put in the body of the http request as text/plain, if any.
Example: http://292.168.0.2/$type/$event?from-uri=$from-uri&tag=$from-tag&callid=$callid&to=$to-uri

  String
external-push-method

Method for reaching external-push-uri, typically GET or POST

 GET String
external-push-protocol

Protocol used for reaching external-push-uri, http2 or http (deprecated)

 http2 String
register-wakeup-interval

Send service push notification periodically to all devices that are about to expire and should wake up to REGISTER back. 0 to disable. Recommended value: 30

 0 minuteDurationMIN
register-wakeup-threshold

Start sending wake-up push notifications to contacts when they pass that percentage of their lifetime.

 50 Integer