The fax solution is available in Pro and Carrier only
update /etc/ngcp-config/config.yml with the correct fax options
faxserver: enable: yes fail_attempts: '3' fail_retry_secs: '60' mail_from: 'Sipwise NGCP FaxServer <voipfax@ngcp.sipwise.local>'
Note: either add the "Secret key" to the body or attach it. Never add both as only one will be recognized and removed, leaving the other one to be sent as a part of the fax.
Example:
To: 43130111 Subject: 43130222 MySecretKey This is a test fax. Cheers
You can send and receive faxes using the built-in REST API interface and configure fax settings.
The following example retrieves the fax settings for the subscriber with ID 3.
Method: GET Content-Type: application/hal+json
https://127.0.0.1:1443/api/faxserversettings/3
The output format is as follows (only the relevant output data is shown):
"active" : true, "destinations" : [ { "destination" : "user@company.com", "filetype" : "PDF14", "incoming" : true, "outgoing" : true, "status" : true } ], "name" : null, "password" : null
The following example updates a specific parameter, Namely, it deactivates the fax feature for the particular subscriber.
Method: PATCH Content-Type: application/json-patch+json
https://127.0.0.1:1443/api/faxserversettings/3
--data-binary [ { "op" : "replace", "path" : "/active", "value" : 0 } ]
The following request sends a pdf file located at /tmp/test_fax.pdf as fax to 431110002 from the subscriber with ID 3.
Method: POST Content-Type: multipart/form-data
https://127.0.0.1:1443/api/faxes/
--form json={"destination" : "431110002", "subscriber_id" : 3} --form faxfile=@/tmp/test_fax.pdf
All received faxes are stored on the server and can be retrieved on demand. You can retrieve a stored fax by following these steps:
Firstly, obtain the internal ID of the fax
Method: GET Content-Type: application/json
https://127.0.0.1:1443/api/faxes/3
This request returns the list of stored faxes for the subscriber with ID 3.
One of the available faxes is returned like this:
"callee" : "431110002", "caller" : "431110001", "direction" : "out", "duration" : "0", "filename" : "d9799276-b7d9-454f-98c3-714edf7e3072.tif", "id" : 5, "pages" : "1", "quality" : "8031x7700", "reason" : "Normal Clearing / SIP 200 OK [1/3]", "signal_rate" : "14400", "status" : "SUCCESS", "subscriber_id" : 1, "time" : "2016-07-30 09:49:59"
Now, to retrieve the fax with ID 5, use the following request:
Method: GET Content-Type: application/hal+json
https://127.0.0.1:1443/api/faxerecordings/5
By default, the fax is in the TIFF format. It is also possible to request it in a different format (currently supported formats are: PS, PDF, PDF14).
To retrieve the same fax in PDF14, use the following request:
The configuration of mail2fax settings via the REST API is similar to the fax settings configuration.
To get the mail2fax configuration for the subscriber with id 3, use the following request:
Method: GET Content-Type: application/hal+json
https://127.0.0.1:1443/api/mailtofaxsettings/3
The output format is as follows (only the relevant output data is shown):
"acl" : [], "active" : false, "secret_key" : "secretkeypassword", "secret_key_renew" : "daily", "secret_renew_notify" : [ { "destination" : "user1@company.com" } ]
The following set of requests changes the mail2fax configuration:
Method: PATCH Content-Type: application/json-patch+json
https://127.0.0.1:1443/api/faxserversettings/3
--data-binary [ { "op" : "replace", "path" : "/secret_key", "value" : "newsecretkeypassword" } ]
--data-binary [ { "op" : "replace", "path" : "/secret_key_renew", "value" : "monthly" } ]
--data-binary [ { "op" : "replace", "path" : "/secret_renew_notify", "value" : [ { "destination": "user2@company.com" }, { "destination": "user3@company.com" } ] } ]
On the NGCP REST API documentation web page you can find the complete list of available faxserver and mail2fax configuration parameters: https://127.0.0.1:1443/api/ The information on the web page is relevant for your paltform version and may change in next releases.