Sylk Pushserver was designed to act as a central dispatcher for mobile push
notifications inside RTC provider infrastructures. Both the provider and
the mobile application customer, in the case of a shared infrastructure, can
easily audit problems related to the processing of push notifications.
Authors:
* Bibiana Rivadeneira
* Tijmen de Mes
## License
Sylk Pushserver is licensed under GNU General Public License version 3.
[Copy of the license](http://www.fsf.org/licensing/licenses/gpl-3.0.html)
## Deployment scenarios
Sylk Pushserver can be deployed together with WebRTC server applications or
VoIP servers like SIP Proxies and PBXs. Its main purpose is to act as a
central entity inside RTC provider infrastructures. Without such a
component, the same functionality must be built inside multiple servers and
as the number of mobile applications increases, the need for such central
component becomes obvious.
### Integration examples
* OpenSIPS: **config/opensips.cfg**
* SylkServer: built-in support
## Design
Sylk Pushserver can handle an arbitrary number of different combinations of
push notification service and mobile applications. It and can be extended
by using Python programming language to support new push notification
services and applications. Sample applications are provided to handle Sylk
and Linphone mobile applications for Apple and Firebase push notification
services.
For each configured Apple application, the server maintains a persistent
connection by using HTTP/2 over TLS 1.2 and reuses that connection for
sending notifications related to the application. Latest voip functionality
for iOS 13 or later is also suported.
Each outgoing connection can use its own set of credentials, X.509
certificates and urls. The connection failures are properly handled and
incoming requests remained queued for later by using a timer dependent on
the payload type.
### Logging
All incoming and outgoing requests, including HTTP headers and bodies, can
be logged for troubleshooting purposes in the system journal and in a
separate log file. These logs can easily be correlated with the logs from
the server that generated the request by using the call-id key.
Remote HTTP logging of the results is possible so that one or more
third-parties can receive information about the individual push requests and
responses for each application.
## API
Sylk Pushserver expects a json over HTTP POST requests and translates it
into a correspondent outgoing push notifications request to Apple Push
Notifications or Firebase FCM servers.
Json object structure:
```{
'app-id': 'com.agprojects.sylk-ios',
'platform': 'apple',
'token': '6688-71a883fe',
'device-id': 'accc8375125582aae062353',
'call-id': '4dbe8-7a53-42bd-95f3-9a7d43938',
'from': 'alice@example.com',
'from_display_name': 'Alice',
'to': 'bob@biloxi.com',
'media-type':'audio',
'event': 'incoming_session'
'silent': True
'reason': None
"badge": "number"
}
```
Where:
* `app-id: str`, id provided by the mobile application (e.g. mobile bundle ID)
* `platform: str`, 'firebase', 'android', 'apple' or 'ios'
* `token: str`, destination device token,
* *iOS device tokens* are strings with 64 hexadecimal symbols
* *Android device push tokens* can differ in length`.
* `device-id: str`, the device that generated the token
* `call-id: str`, the unique session id for each call
* `from: str`, address of the caller
* `from_display_name`, (mandatory)*, display name of the caller
* `to`, address of the callee
* `media-type: str`: 'audio', 'video', 'chat', 'sms' or 'file-transfer'
* `silent: bool`: *(optional, default `True`)* True for silent notification
* `reason:str`: *(optional)* Cancel reason
* `event: str`, type of event:
* For *Sylk app* must be 'incoming_session', 'incoming_conference', 'cancel' or 'message'
* For *Linphone app* must be 'incoming_session'
* `badge: int`: optional badge to display
The response is a json with the following structure:
```
{
'code': 'a numeric code equal to the HTTP response code',
'description': 'a detailed text description',
'data' : {}
}
```
*data* contains an arbitrary dictionary with a structure depending on the
request type and the remote server response.
### V2
API version 2 supports storage of the push tokens in a Apache Cassandra Cluster
or locally in a pickle file. The elements in the API methods are the same type
and values as in API version 1. The API has the following methods:
**POST** `/v2/tokens/{account}` - Stores a token for `{account}`
```
{
"app-id": "string",
"platform": "string",
"token": "string",
"device-id": "string",
"silent": true,
"user-agent": "string"
}
```
**DELETE** `/v2/tokens/{account}` - Removes a token for `{account}`
```
{
"app-id": "string",
"device-id": "string"
}
```
**POST** `/v2/tokens/{account}/push` - Sends a push notification(s) for `{account}`
```
{
"event": "string",
"call-id": "string",
"from": "string",
"from-display-name": "string",
"to": "string",
"media-type": "string",
"reason": "string",
"badge": "number"
}
```
**POST** `/v2/tokens/{account}/push/{device}` - Sends a push notification for `{account}` and `{device}`
```
{
"event": "string",
"call-id": "string",
"from": "string",
"from-display-name": "string",
"to": "string",
"media-type": "string",
"reason": "string",
"badge": "number"
}
```
### Sample client code
* See [sylk-pushclient](scripts/sylk-pushclient)
* See [sylk-pushclient-v2](scripts/sylk-pushclient-v2)
### External APIs
For documentation related to the API used by Apple and Firebase push
notifications services you must consult their respective websites. For
reference, the following APIs were used for developing the server, but these
links may change:
* [Sending Apple VoIp notifications](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns)
-To use it for debian you should put the following in /etc/apt/sources.list.d/ag-projects.list. Substitute `__DISTRO__` with your distribution name, e.g. buster, bookworm...
-
-#### Debian
-
-
-```
-deb [signed-by=/usr/share/keyrings/agp-debian-key.gpg] https://packages.ag-projects.com/debian/ __DISTRO__ main contrib
-deb-src [signed-by=/usr/share/keyrings/agp-debian-key.gpg] https://packages.ag-projects.com/debian/ __DISTRO__ main contrib
-```
-
-#### Ubuntu
-
-To use it for ubuntu you should put the following in /etc/apt/sources.list.d/ag-projects.list. Substitute `__DISTRO__` with your distribution name, e.g. focal, jammy...
-
-```
-deb [signed-by=/usr/share/keyrings/agp-debian-key.gpg] https://packages.ag-projects.com/ubuntu/ __DISTRO__ main contrib
-deb-src [signed-by=/usr/share/keyrings/agp-debian-key.gpg] https://packages.ag-projects.com/ubuntu/ __DISTRO__ main contrib
-```
+Follow instruction from https://packages.ag-projects.com
Update the list of available packages:
`sudo apt-get update`
`sudo apt-get install sylk-pushserver`
### From source
The source code is managed using darcs version control tool. The darcs