PushNotification

Last modified by Buildbot on 2020/10/14 13:59

 Documentation based on repostory git version commit 2.0.1 

Module PushNotification

This module performs push notifications to mobile phone notification systems: apple, android, windows, 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 ValueType
enabledIndicate whether the module is activated. falseBoolean
filterA 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') BooleanExpr
timeoutNumber of seconds 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. 0Integer
message-time-to-liveTime to live for the push notifications related to IM messages, in seconds. The default value '0' is interpreted as using the same value as for message-delivery-timeout of Router module. 0Integer
max-queue-sizeMaximum number of notifications queued for each push notification service 100Integer
retransmission-countNumber 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. 0Integer
retransmission-intervalRetransmission interval in seconds for push notification requests, when a retransmission-count has been specified above. 5Integer
display-from-uriIf 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
appleEnable push notification for apple devices trueBoolean
apple-certificate-dirPath 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/apnString
no-badgeSet the badge value to 0 for Apple push falseBoolean
firebaseEnable push notification for Android devices (new method for Android) trueBoolean
firebase-projects-api-keysList of couples projectId:ApiKey for each Android project that supports push notifications (new method for Android) StringList
windowsphoneEnable push notification for Windows Phone 8 devices trueBoolean
windowsphone-package-sidUnique identifier for your Windows Store app.
 For example: ms-app://s-1-15-2-2345030743-3098444494-743537440-5853975885-5950300305-5348553438-505324794
 String
windowsphone-application-secretClient secret. For example: Jrp1UoVt4C6CYpVVJHUPdcXLB1pEdRoB String
external-push-uriInstead 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 substitued 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-methodMethod for reaching external-push-uri, typically GET or POST GETString