receive fax Action
Starts a fax session on an inbound call and receives a tif file to the Aculab media file store.
Received tif files are available immediately to play within an application, but generally take a few seconds to become available elsewhere. See Media File Availability for more details.
The receive fax properties are:
Property | Required/Optional | Default | Description |
---|---|---|---|
progress page | optional | null | A web page request object that defines the web page to be requested for fax progress reports. |
next page | optional | null | A web page request object that defines the web page to be requested once the fax session has finished. If null or no page is specified then the subsequent action in the action array will be executed. |
encryption cipher | optional | null | The cipher object to be used to encrypt the received fax. |
web page request defines how a specific web page is requested:
Property | Required/Optional | Default | Description |
---|---|---|---|
url | required | - | The address of the web page to request. |
method | optional | POST | One of "GET" or "POST". The HTTP request method to use when requesting the url . |
Progress
Theprogress page
is called after initial negotiation and then after each page that is received. It contains updated information regarding the inbound fax. The progress page will receive instance information
containing the property action progress
which has details for the fax as follows:Property | Description |
---|---|
action | A string. The name of the action for which progress information is being supplied. |
progress | An object containing the progress information supplied for the current action. |
The progress property will have the following properties:
Property | Description |
---|---|
negotiated settings | An object containing the fax negotiation details, e.g., the modem and data rate. See below. |
pages received | The number of pages that have been received. |
The negotiated settings object will contain the following properties:
Property | Description |
---|---|
data rate | An integer. The negotiated baud rate in bps, e.g., 9600 or 4800. |
modem | A string. The modem being used, e.g., V.17 or V.29. |
remote subscriber id | The remote end ID string. |
encryption cipher contains the details of a cipher used to encrypt media files:
Property | Required/Optional | Description |
---|---|---|
type | required | The cipher type, currently only "aescbc" (AES algorithm, CBC mode) is supported. |
For the aescbc cipher the following properties must be supplied in the cipher object:
Property | Required/Optional | Description |
---|---|---|
key | required | The cipher key as a string, either 128, 192 or 256 bits represented as 16, 24 or 32 hexadecimal bytes. |
initialisation vector | required | The initialisation vector as a string, 128 bits represented as 16 hexadecimal bytes. |
Returns
The http request to thenext page
will provide final termination details of the fax session in action result
. The filename of the received fax is generated automatically and is sent to the next page
. The details are as follows:Property | Description |
---|---|
description | A string describing whether the fax was received successfully. The string will be one of 'fax received', 'partial reception', 'not received' or 'not a fax machine'. |
seconds duration | A floating point value to one decimal place. The number of seconds for which the fax session was active. |
pages received | An integer. The number of pages that were received. |
fax filename | A string. The name of the fax tif file in the media file store. |
-
Examples:
-
Receive a fax and specify a next page to access the received fax filename:
"receive_fax": { "next_page": { "url": "my_fax_handler_page" } }
The following may be returned to the
next page
once the fax session has terminated:"action_result": { { "action": "receive_fax", "result": { "description": "fax received", "seconds_duration": 120.5, "pages_received": 2, "fax_filename": "rest_api/received_faxes/2014/04/22/14_49_10_065ef40a36c312db.44237.tif" } } }
-
Receive a fax and save it to an encrypted file, specifying a next page to access the received fax filename. Supply a cipher to encrypt the received fax:
"receive_fax": { "encryption_cipher": { "type" : "aescbc", "key" : "1F2DEB2E502A4C8CBA58AB5018BD1506419EEA86DF595D3A431F43FAF57534C9", "initialisation_vector" : "9B85FAED9AB17570D5A82A31F846443B" }, "next_page": { "url": "my_fax_handler_page" } }
The following may be returned to the
next page
once the fax session has terminated:"action_result": { { "action": "receive_fax", "result": { "description": "fax received", "seconds_duration": 120.5, "pages_received": 2, "fax_filename": "rest_api/received_faxes/2014/04/22/14_49_10_065ef40a36c312db.44237.tif" } } }
-
Receive a fax and specify a next page and a progress page:
"receive_fax": { "next_page": { "url": "my_fax_handler_page" }, "progress_page": { "url": "my_progress_handler_page" } }
The following may be returned to the
progress page
after the first page has been received:"action_progress": { "action": "receive_fax", "progress": { "negotiated_settings": { "data_rate": 9600, "modem": "V17", "remote_subscriber_id": "12345" }, "pages_received": 1 } }
The following may be returned to the
next page
once the fax session has terminated:"action_result": { { "action": "receive_fax", "result": { "description": "fax received", "seconds_duration": 120.5, "pages_received": 2, "fax_filename": "rest_api/received_faxes/2014/04/22/14_49_10_065ef40a36c312db.44237.tif" } } }
-
-
API Reference:
class ReceiveFax : TelephonyAction
Represents a receive fax action.
Constructors:
ReceiveFax(WebPageRequest nextPage); ReceiveFax(WebPageRequest nextPage, WebPageRequest progressPage);
Members:
Cipher EncryptionCipher; WebPageRequest NextPage; WebPageRequest ProgressPage;
class WebPageRequest
Represents a request to a web page.
Constructors:
WebPageRequest(String url); WebPageRequest(String url, String method);
Members:
String Method;
class Cipher
Represents a cipher to be used for file encryption/decryption.
Members:
String Type;
class AesCbcCipher : Cipher
Represents the AES cipher in CBC mode.
Constructors:
AesCbcCipher(byte[] key, byte[] initialisationVector);
Members:
byte[] InitialisationVector;
class ReceiveFaxProgress : ActionProgress
Represents the progress of a receive fax action.
Members:
int PagesReceived; NegotiatedFaxSettings NegotiatedSettings;
class NegotiatedFaxSettings
Represents the settings negotiated during a fax send or receive.
Members:
int DataRate; String Modem; String RemoteSubscriberId;
class ReceiveFaxResult : ActionResult
Represents the result of a receive fax action.
Members:
String Description; double SecondsDuration; int PagesReceived; String FaxFilename;
Examples:
-
Receive a fax and specify a next page to access the received fax filename:
WebPageRequest nextPage = new WebPageRequest("MyReceiveFaxNextPage.aspx"); actions.Add(new ReceiveFax(nextPage));
The receive fax result is obtained from the request to the next page:
ReceiveFaxResult receiveFaxResult = (ReceiveFaxResult)ourRequest.InstanceInfo.ActionResult; int pagesReceived = receiveFaxResult.PagesReceived; double secondsDuration = receiveFaxResult.SecondsDuration; if (receiveFaxResult.Description.CompareTo("fax received") == 0) { ...
-
Receive a fax and save it to an encrypted file, specifying a next page to access the received fax filename. Supply a cipher to encrypt the received fax:
WebPageRequest nextPage = new WebPageRequest("MyReceiveFaxNextPage.aspx"); ReceiveFax receiveFaxAction = new ReceiveFax(nextPage); // Specify a 256 bit cipher to be used to encrypt the received fax byte[] key = new byte[] { 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0x86, 0xDF, 0x59, 0x5D, 0x3A, 0x43, 0x1F, 0x43, 0xFA, 0xF5, 0x75, 0x34, 0xC9 }; byte[] initialisationVector = new byte[] { 0x9B, 0x85, 0xFA, 0xED, 0x9A, 0xB1, 0x75, 0x70, 0xD5, 0xA8, 0x2A, 0x31, 0xF8, 0x46, 0x44, 0x3B }; Cipher encryptionCipher = new AesCbcCipher(key, initialisationVector); receiveFaxAction.EncryptionCipher = encryptionCipher; actions.Add(receiveFaxAction);
The receive fax result is obtained from the request to the next page:
ReceiveFaxResult receiveFaxResult = (ReceiveFaxResult)ourRequest.InstanceInfo.ActionResult; int pagesReceived = receiveFaxResult.PagesReceived; double secondsDuration = receiveFaxResult.SecondsDuration; if (receiveFaxResult.Description.CompareTo("fax received") == 0) { ...
-
Receive a fax specifying a next page and a progress page:
WebPageRequest nextPage = new WebPageRequest("MyReceiveFaxNextPage.aspx"); WebPageRequest progressPage = new WebPageRequest("MyProgressHandlerPage.aspx"); actions.Add(new ReceiveFax("myFax.tif", nextPage, progressPage));
The receive fax progress is obtained from the request to the progress page:
ReceiveFaxProgress receiveFaxProgress = (ReceiveFaxProgress)ourRequest.InstanceInfo.ActionProgress; int pagesReceived = receiveFaxProgress.PagesReceived; String remoteSubscriberId = receiveFaxProgress.NegotiatedSettings.RemoteSubscriberId; ...
The receive fax result is obtained from the request to the next page:
ReceiveFaxResult receiveFaxResult = (ReceiveFaxResult)ourRequest.InstanceInfo.ActionResult; int pagesReceived = receiveFaxResult.PagesReceived; double secondsDuration = receiveFaxResult.SecondsDuration; if (receiveFaxResult.Description.CompareTo("fax received") == 0) { ...
-
-
API Reference:
Class ReceiveFax Inherits TelephonyAction
Represents a receive fax action.
Constructors:
New(nextPage As RestAPIWrapper.WebPageRequest) New(nextPage As RestAPIWrapper.WebPageRequest, progressPage As RestAPIWrapper.WebPageRequest)
Members:
EncryptionCipher As RestAPIWrapper.Cipher NextPage As RestAPIWrapper.WebPageRequest ProgressPage As RestAPIWrapper.WebPageRequest
Class WebPageRequest
Represents a request to a web page.
Constructors:
New(url As String) New(url As String, method As String)
Members:
Method As String
class Cipher
Represents a cipher to be used for file encryption/decryption.
Members:
Type As String
class AesCbcCipher : Cipher
Represents the AES cipher in CBC mode.
Constructors:
AesCbcCipher(ByVal key As Byte(), ByVal initialisationVector As Byte())
Members:
InitialisationVector As Byte()
Class ReceiveFaxProgress Inherits ActionProgress
Represents the progress of a receive fax action.
Members:
PagesReceived As Integer NegotiatedSettings As RestAPIWrapper.NegotiatedFaxSettings
Class NegotiatedFaxSettings
Represents the settings negotiated during a fax send or receive.
Members:
DataRate As Integer Modem As String RemoteSubscriberId As String
Class ReceiveFaxResult Inherits RestAPIWrapper.ActionResult
Represents the result of a receive fax action.
Members:
Description As String SecondsDuration As Double PagesReceived As Integer FaxFilename As String
Examples:
-
Receive a fax and specify a next page to access the received fax filename:
Dim nextPage As WebPageRequest = New WebPageRequest("MyReceiveFaxNextPage.aspx") actions.Add(New ReceiveFax(nextPage))
The receive fax result is obtained from the request to the next page:
Dim receiveFaxResult As ReceiveFaxResult = ourRequest.InstanceInfo.ActionResult Dim pagesReceived As Integer = receiveFaxResult.PagesReceived Dim secondsDuration As Double = receiveFaxResult.SecondsDuration if receiveFaxResult.Description.CompareTo("fax received") = 0 Then ...
-
Receive a fax and save it to an encrypted file, specifying a next page to access the received fax filename. Supply a cipher to encrypt the received fax:
Dim nextPage As WebPageRequest = New WebPageRequest("MyReceiveFaxNextPage.aspx") Dim receiveFaxAction As ReceiveFax = New ReceiveFax(nextPage) ' Specify a 256 bit cipher to be used to encrypt the received fax Dim key As Byte() = { &H1F, &H2D, &HEB, &H2E, &H50, &H2A, &H4C, &H8C, &HBA, &H58, &HAB, &H50, &H18, &HBD, &H15, &H06, &H41, &H9E, &HEA, &H86, &HDF, &H59, &H5D, &H3A, &H43, &H1F, &H43, &HFA, &HF5, &H75, &H34, &HC9 } Dim initialisationVector As Byte() = { &H9B, &H85, &HFA, &HED, &H9A, &HB1, &H75, &H70, &HD5, &HA8, &H2A, &H31, &HF8, &H46, &H44, &H3B } Dim encryptionCipher As Cipher = New AesCbcCipher(key, initialisationVector) receiveFaxAction.EncryptionCipher = encryptionCipher actions.Add(receiveFaxAction)
The receive fax result is obtained from the request to the next page:
Dim receiveFaxResult As ReceiveFaxResult = ourRequest.InstanceInfo.ActionResult Dim pagesReceived As Integer = receiveFaxResult.PagesReceived Dim secondsDuration As Double = receiveFaxResult.SecondsDuration if receiveFaxResult.Description.CompareTo("fax received") = 0 Then ...
-
Receive a fax specifying a next page and a progress page:
Dim nextPage As WebPageRequest = New WebPageRequest("MyReceiveFaxNextPage.aspx") Dim progressPage As WebPageRequest = New WebPageRequest("MyProgressHandlerPage.aspx") actions.Add(New ReceiveFax("myFax.tif", nextPage, progressPage))
The receive fax progress is obtained from the request to the progress page:
Dim receiveFaxProgress As ReceiveFaxProgress = ourRequest.InstanceInfo.ActionProgress Dim pagesReceived As Integer = receiveFaxProgress.PagesReceived Dim remoteSubscriberId As String = receiveFaxProgress.NegotiatedSettings.RemoteSubscriberId ...
The receive fax result is obtained from the request to the next page:
Dim receiveFaxResult As ReceiveFaxResult = ourRequest.InstanceInfo.ActionResult Dim pagesReceived As Integer = receiveFaxResult.PagesReceived Dim secondsDuration As Double = receiveFaxResult.SecondsDuration if receiveFaxResult.Description.CompareTo("fax received") = 0 Then ...
-
-
API Reference:
class ReceiveFax extends TelephonyAction
Represents a receive fax action.
Constructors:
ReceiveFax(WebPageRequest nextPage); ReceiveFax(WebPageRequest nextPage, WebPageRequest progressPage);
Members:
setEncryptionCipher(Cipher encryptionCipher); setNextPage(WebPageRequest nextPage); setProgressPage(WebPageRequest progressPage);
class WebPageRequest
Represents a request to a web page.
Constructors:
WebPageRequest(String url); WebPageRequest(String url, String method);
Members:
setMethod(String method);
class Cipher
Represents a cipher to be used for file encryption/decryption.
Members:
String getType();
class AesCbcCipher extends Cipher
Represents the AES cipher in CBC mode.
Constructors:
AesCbcCipher(byte[] key, byte[] initialisationVector);
Members:
byte[] getInitialisationVector(); setInitialisationVector(byte[] iv);
class ReceiveFaxProgress extends ActionProgress
Represents the progress of a receive fax action.
Members:
int getPagesReceived(); NegotiatedFaxSettings getNegotiatedSettings();
class NegotiatedFaxSettings
Represents the settings negotiated during a fax send or receive.
Members:
int getDataRate(); String getModem(); String getRemoteSubscriberId();
class ReceiveFaxResult extends ActionResult
Represents the result of a receive fax action.
Members:
String getDescription(); double getSecondsDuration(); int getPagesReceived(); String getFaxFilename();
Examples:
-
Receive a fax and specify a next page to access the received fax filename:
WebPageRequest nextPage = new WebPageRequest("MyReceiveFaxNextPage"); actions.add(new ReceiveFax(nextPage));
The receive fax result is obtained from the request to the next page:
public void doGet(HttpServletRequest request, HttpServletResponse response) { TelephonyRequest ourRequest = new TelephonyRequest(request); ReceiveFaxResult receiveFaxResult = (ReceiveFaxResult)ourRequest.getInstanceInfo().getActionResult(); int pagesReceived = receiveFaxResult.getPagesReceived(); double secondsDuration = ReceiveFaxResult.getSecondsDuration(); if (ReceiveFaxResult.getDescription().CompareTo("fax received") == 0) { String faxFilename = ReceiveFaxResult.getFaxFilename(); ... }
-
Receive a fax and save it to an encrypted file, specifying a next page to access the received fax filename. Supply a cipher to encrypt the received fax:
WebPageRequest nextPage = new WebPageRequest("MyReceiveFaxNextPage"); ReceiveFax receiveFaxAction = new ReceiveFax(nextPage); // Specify a 256 bit cipher to be used to encrypt the received fax byte[] key = new byte[] { 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0x86, 0xDF, 0x59, 0x5D, 0x3A, 0x43, 0x1F, 0x43, 0xFA, 0xF5, 0x75, 0x34, 0xC9 }; byte[] initialisationVector = new byte[] { 0x9B, 0x85, 0xFA, 0xED, 0x9A, 0xB1, 0x75, 0x70, 0xD5, 0xA8, 0x2A, 0x31, 0xF8, 0x46, 0x44, 0x3B }; Cipher encryptionCipher = new AesCbcCipher(key, initialisationVector); receiveFaxAction.setEncryptionCipher(encryptionCipher); actions.Add(receiveFaxAction);
The receive fax result is obtained from the request to the next page:
public void doGet(HttpServletRequest request, HttpServletResponse response) { TelephonyRequest ourRequest = new TelephonyRequest(request); ReceiveFaxResult receiveFaxResult = (ReceiveFaxResult)ourRequest.getInstanceInfo().getActionResult(); int pagesReceived = receiveFaxResult.getPagesReceived(); double secondsDuration = ReceiveFaxResult.getSecondsDuration(); if (ReceiveFaxResult.getDescription().CompareTo("fax received") == 0) { String faxFilename = ReceiveFaxResult.getFaxFilename(); ... }
-
Receive a fax specifying the next page:
WebPageRequest nextPage = new WebPageRequest("MyReceiveFaxNextPage"); WebPageRequest progressPage = new WebPageRequest("MyProgressHandlerPage"); actions.add(new ReceiveFax(nextPage, progressPage));
The receive fax progress is obtained from the request to the progress page:
public void doGet(HttpServletRequest request, HttpServletResponse response) { TelephonyRequest ourRequest = new TelephonyRequest(request); ReceiveFaxProgress receiveFaxProgress = (ReceiveFaxProgress)ourRequest.getInstanceInfo().getActionProgress(); int pagesReceived = ReceiveFaxProgress.getPagesReceived(); String remoteSubscriberId = ReceiveFaxProgress.getNegotiatedSettings().getRemoteSubscriberId(); ... }
The receive fax result is obtained from the request to the next page:
public void doGet(HttpServletRequest request, HttpServletResponse response) { TelephonyRequest ourRequest = new TelephonyRequest(request); ReceiveFaxResult receiveFaxResult = (ReceiveFaxResult)ourRequest.getInstanceInfo().getActionResult(); int pagesReceived = receiveFaxResult.getPagesReceived(); double secondsDuration = ReceiveFaxResult.getSecondsDuration(); if (ReceiveFaxResult.getDescription().CompareTo("fax received") == 0) { String faxFilename = ReceiveFaxResult.getFaxFilename(); ... }
-
-
API Reference:
class ReceiveFax
Represents a receive fax action.
Constructors:
ReceiveFax(progress_page=None, # A WebPage object, see Redirect() for details next_page=None, # A WebPage object, see Redirect() for details encryption_cipher=None)
Members:
def set_progress_page(next_page) # A WebPage object def set_next_page(next_page) # A WebPage object def set_encryption_cipher(encryption_cipher)
Examples:
-
Receive a fax using the default parameters:
from aculab.telephony_rest_api import Actions, ReceiveFax my_actions = Actions('Usage example 1: Receive fax.') my_actions.add(ReceiveFax()) response_body = my_actions.get_json()
-
Receive a fax and specify the progress page:
from aculab.telephony_rest_api import Actions, ReceiveFax, WebPage my_actions = Actions('Usage example 2: Receive fax.') my_actions.add(ReceiveFax(progress_page=WebPage(url='fax_progress_page', method='POST'))) response_body = my_actions.get_json()
-
Receive a fax and specify the progress page. Also, supply a cipher to encrypt the received fax:
from aculab.telephony_rest_api import Actions, ReceiveFax, WebPage, AESCBCCipher my_actions = Actions('Usage example 3: Receive fax.') my_cipher = AESCBCCipher(key='407e4cc1a732cb2ac1b84395488f3322404e414ffeba8a8d692c034d608d9cc8', initialisation_vector='3bfd048ecaad5515f1ca7b9b58302c04') my_actions.add(ReceiveFax(progress_page=WebPage(url='fax_progress_page', method='POST'), encryption_cipher=my_cipher)) response_body = my_actions.get_json()
-
Receive a fax, specify the progress page and the next page:
from aculab.telephony_rest_api import Actions, ReceiveFax, WebPage my_actions = Actions('Usage example 4: Receive fax.') my_actions.add(ReceiveFax(progress_page=WebPage(url='fax_progress_page', method='POST'), next_page=WebPage(url='receive_fax_complete', method='POST'))) response_body = my_actions.get_json()
-
-
API Reference:
The ReceiveFax class
Introduction
Represents a receive fax action.Class synopsis
class ReceiveFax extends ActionBase { /* methods */ public __construct() public void setProgressPage(string $progress_page, string $method = null) public void setNextPage(string $next_page, string $method = null) public void setEncryptionCipher(Cipher $cipher) }
The ReceiveFaxResult class
Introduction
Represents the result of a receive fax action.Class synopsis
class ReceiveFaxResult extends ActionResult { /* Methods */ public string getDescription() public string getFaxFilename() public int getPagesReceived() public float getSecondsDuration() /* inherited methods */ public string getAction() public boolean getInterrupted() }
The ReceiveFaxProgress class
Introduction
Represents the progress information of a receive fax action.Class synopsis
class ReceiveFaxProgress extends ActionProgress { /* Methods */ public int getPagesReceived() public NegotiatedFaxSettings getNegotiatedFaxSettings() /* inherited methods */ public string getAction() }
The NegotiatedFaxSettings class
Introduction
Represents the negotiated fax settings.Class synopsis
class NegotiatedFaxSettings { /* Methods */ public int getDataRate() public string getModem() public string getRemoteSubscriberId() }
The Cipher class
Introduction
An abstract class to represent ciphers.Class synopsis
abstract class Cipher { /* methods */ public __construct(string $type) }
The AesCbcCipher class
Introduction
A class to represent a cipher using AES in CBC mode.Class synopsis
$key
and$initialisation_vector
are strings of hexadecimal bytes.class AesCbcCipher extends Cipher{ /* methods */ public __construct(string $key, string $initialisation_vector) }
Examples:
-
Receive a fax and specify a next page to access the received fax filename:
$r = new Aculab\TelephonyRestAPI\ReceiveFax(); $r->setNextPage('my_fax_handler_page'); $actions->add($r);
Get the filename of the received fax from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $receiveFaxResult = $info->getActionResult(); $receivedFaxFilename = $receiveFaxResult->getFaxFilename();
-
Receive a fax and save it to an encrypted file, specifying a next page to access the received fax filename. Supply a cipher to encrypt the received fax:
$r = new Aculab\TelephonyRestAPI\ReceiveFax(); $r->setNextPage('my_fax_handler_page'); $cipher = new Aculab\TelephonyRestAPI\AesCbcCipher( "1F2DEB2E502A4C8CBA58AB5018BD1506419EEA86DF595D3A431F43FAF57534C9", "9B85FAED9AB17570D5A82A31F846443B" ); $r->setEncryptionCipher($cipher); $actions->add($r);
Get the filename of the received fax from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $receiveFaxResult = $info->getActionResult(); $receivedFaxFilename = $receiveFaxResult->getFaxFilename();
-
Receive a fax and specify a next page and a progress page:
$r = new Aculab\TelephonyRestAPI\ReceiveFax(); $r->setProgressPage('my_progress_handler_page'); $r->setNextPage('my_fax_handler_page'); $actions->add($r);
Get the negotiated data rate from the action's progress page request:
$info = InstanceInfo::getInstanceInfo(); $receiveFaxProgress = $info->getActionProgress(); $negotiatedFaxSettings = $receiveFaxProgress->getNegotiatedFaxSettings(); $dataRate = $negotiatedFaxSettings->getDataRate();
Get the filename of the received fax from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $receiveFaxResult = $info->getActionResult(); $receivedFaxFilename = $receiveFaxResult->getFaxFilename();
-