send fax Action
Starts a fax session on an outbound call and sends a tif file. This can be the name of a file in the Aculab media file store or the URL of a remote file.
language wrappers and examples
The send fax properties are:
Property | Required/Optional | Default | Description |
---|---|---|---|
fax to send | required | The tif file to send. This can be the file name or a web page request. If a file name is given the file must be present in the Aculab media file store. If a web page request object is given it must identify a suitable media file that is available on the web. The web page request method defaults to GET. | |
progress page | optional | - | A web page request object that defines where fax progress reports are to be sent. |
next page | optional | - | A web page request object that defines the 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. |
decryption cipher | optional | - | A cipher object to be used to decrypt the tif file to send, if it is encrypted. Cannot be used if fax to send is a web page request. |
If a web page request is supplied for fax to send
, the URL supplied should point to a page that will upload a tif file. The URL can be a relative or full path. The request method defaults to GET. Only GET is supported.
When the URL is accessed, Aculab Cloud will expect to receive image data. No information will be sent to the URL, i.e., instance info will NOT be sent, and no actions can be returned from the URL. Aculab Cloud implements cacheing, so HTTP cache-control headers will be honoured. The maximum size of a file to be uploaded is five megabytes, which is at least thirty fax pages. If your file has been cached and you need it to be refreshed immediately you can force a refresh by changing the url. An easy way to do this is to add a version number to your url.
For example, if your URL is http://Badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1
it will be easy to change version to 2 and force a refresh.
Progress
The progress page
is called after initial negotiation and then after each page that is sent. It contains updated information regarding the outbound fax. The progress page will receive instance information
containing an action progress object that contains details for the fax as follows:
Property | Availability | Description |
---|---|---|
negotiated settings | always | A negotiated fax settings object containing fax negotiation details, e.g., the modem and data rate. |
pages sent | always | The number of pages that have been sent. |
reconnects | always | An integer. The number of times the outbound fax session has had to place a new call (normally 0). For longer faxes, the outbound call can disconnect if the line experiences a glitch or noise. The outbound fax session will automatically call again and continue the fax from where it left off. |
Returns
The http request to the next page
will provide final termination details of the fax session in action result
as follows:
Property | Availability | Description |
---|---|---|
description | always | A string describing whether the fax was sent successfully. The string will be one of 'fax delivered', 'partial delivery', 'not delivered' or 'not a fax machine'. |
seconds duration | always | A floating point value to one decimal place. The number of seconds for which the fax session was active. |
pages sent | always | An integer. The number of pages that were sent. |
-
Examples:
Send a fax using the defaults:
"send_fax": { "fax_to_send": "my_fax.tif" }
Note that by default there is noprogress page
defined. Also, note that by default there is nonext page
defined, so noaction result
is returned.To send a remote fax using the defaults:
"send_fax": { "fax_to_send": { "url" : "http://Badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1" } }
Send a fax and specify a next page to receive the result of the send:
"send_fax": { "fax_to_send": "my_fax.tif", "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": "send_fax", "result": { "description": "fax delivered", "seconds_duration": 21.5, "pages_sent": 2 } }
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
"send_fax": { "fax_to_send": "my_encrypted_fax.tif", "decryption_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": "send_fax", "result": { "description": "fax delivered", "seconds_duration": 21.5, "pages_sent": 2 } }
Send a fax, specify a progress page and a next page:
"send_fax": { "fax_to_send": "my_fax.tif", "progress_page": { "url": "my_progress_handler_page" }, "next_page": { "url": "my_fax_handler_page" } }
The following may be returned to the
progress page
after the first page has been sent:"action_progress": { "action": "send_fax", "progress": { "negotiated_settings": { "data_rate": 9600, "modem": "V17", "remote_subscriber_id": "12345" }, "pages_sent": 1, "reconnects": 0 } }
The following may be returned to the
next page
once the fax session has terminated:"action_result": { "action": "send_fax", "result": { "description": "fax delivered", "seconds_duration": 21.5, "pages_sent": 2 } }
-
SendFax Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllAn action to start a fax session on an outbound call and send a tif file from the Aculab media file store or from a location on the web.
-
public class SendFax : TelephonyAction { // Constructors public SendFax(Uri faxToSend, WebPageRequest nextPage = null, WebPageRequest progressPage = null, Cipher decryptionCipher = null); public SendFax(string faxToSend, WebPageRequest nextPage = null, WebPageRequest progressPage = null, Cipher decryptionCipher = null); // Members public Cipher DecryptionCipher; public WebPageRequest NextPage; public WebPageRequest ProgressPage; }
Examples:
-
Send a fax using the defaults:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif"); actions.Add(sendFax);
To send a remote fax using the defaults:
var sendRemoteFax = new SendFax("http://badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1"); actions.Add(sendRemoteFax);
-
Send a fax and specify a next page to receive the result of the send:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif", new WebPageRequest("MyFaxHandlerPage.aspx")); actions.Add(sendFax);
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
List<TelephonyAction> actions = new List<TelephonyAction>(); byte[] key = new byte[] { 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0xB6, 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 }; var cipher = new AesCbcCipher(key, initialisationVector); var sendFax = new SendFax("my_encrypted_fax.tif", new WebPageRequest("MyFaxHandlerPage.aspx"), decryptionCipher: cipher); actions.Add(sendFax);
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
Send a fax, specify a progress page and a next page:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif", progressPage: new WebPageRequest("MyProgressHandlerPage.aspx")); actions.Add(sendFax);
Get the negotiated data rate from the action's progress page request:
// Unpack the request var telRequest = new TelephonyRequest(Request); var sendFaxProgress = (SendFaxProgress)telRequest.InstanceInfo.ActionProgress; var negotiatedFaxSettings = sendFaxProgress.NegotiatedSettings; var dataRate = negotiatedFaxSettings.DataRate;
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
-
public class SendFax : TelephonyAction { // Constructors public SendFax(Uri faxToSend, WebPageRequest nextPage = null, WebPageRequest progressPage = null, Cipher decryptionCipher = null); public SendFax(string faxToSend, WebPageRequest nextPage = null, WebPageRequest progressPage = null, Cipher decryptionCipher = null); // Members public Cipher DecryptionCipher; public WebPageRequest NextPage; public WebPageRequest ProgressPage; }
Examples:
-
Send a fax using the defaults:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif"); actions.Add(sendFax);
To send a remote fax using the defaults:
var sendRemoteFax = new SendFax("http://badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1"); actions.Add(sendRemoteFax);
-
Send a fax and specify a next page to receive the result of the send:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif", new WebPageRequest("MyFaxHandlerPage.aspx")); actions.Add(sendFax);
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
List<TelephonyAction> actions = new List<TelephonyAction>(); byte[] key = new byte[] { 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0xB6, 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 }; var cipher = new AesCbcCipher(key, initialisationVector); var sendFax = new SendFax("my_encrypted_fax.tif", new WebPageRequest("MyFaxHandlerPage.aspx"), decryptionCipher: cipher); actions.Add(sendFax);
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
Send a fax, specify a progress page and a next page:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif", progressPage: new WebPageRequest("MyProgressHandlerPage.aspx")); actions.Add(sendFax);
Get the negotiated data rate from the action's progress page request:
// Unpack the request var telRequest = new TelephonyRequest(Request); var sendFaxProgress = (SendFaxProgress)telRequest.InstanceInfo.ActionProgress; var negotiatedFaxSettings = sendFaxProgress.NegotiatedSettings; var dataRate = negotiatedFaxSettings.DataRate;
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
-
public class SendFax : TelephonyAction { // Constructors public SendFax(Uri faxToSend, WebPageRequest nextPage = null, WebPageRequest progressPage = null, Cipher decryptionCipher = null); public SendFax(string faxToSend, WebPageRequest nextPage = null, WebPageRequest progressPage = null, Cipher decryptionCipher = null); // Members public Cipher DecryptionCipher; public WebPageRequest NextPage; public WebPageRequest ProgressPage; }
Examples:
-
Send a fax using the defaults:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif"); actions.Add(sendFax);
To send a remote fax using the defaults:
var sendRemoteFax = new SendFax("http://badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1"); actions.Add(sendRemoteFax);
-
Send a fax and specify a next page to receive the result of the send:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif", new WebPageRequest("MyFaxHandlerPage.aspx")); actions.Add(sendFax);
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
List<TelephonyAction> actions = new List<TelephonyAction>(); byte[] key = new byte[] { 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0xB6, 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 }; var cipher = new AesCbcCipher(key, initialisationVector); var sendFax = new SendFax("my_encrypted_fax.tif", new WebPageRequest("MyFaxHandlerPage.aspx"), decryptionCipher: cipher); actions.Add(sendFax);
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
Send a fax, specify a progress page and a next page:
List<TelephonyAction> actions = new List<TelephonyAction>(); var sendFax = new SendFax("my_fax.tif", progressPage: new WebPageRequest("MyProgressHandlerPage.aspx")); actions.Add(sendFax);
Get the negotiated data rate from the action's progress page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var sendFaxProgress = (SendFaxProgress)telRequest.InstanceInfo.ActionProgress; var negotiatedFaxSettings = sendFaxProgress.NegotiatedSettings; var dataRate = negotiatedFaxSettings.DataRate;
Get the number of pages sent from the action's next page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var sendFaxResult = (SendFaxResult)telephonyRequest.InstanceInfo.ActionResult; var numberPagesSent = sendFaxResult.PagesSent;
-
-
-
SendFax Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllAn action to start a fax session on an outbound call and send a tif file from the Aculab media file store or from a location on the web.
-
Public Class SendFax Inherits TelephonyAction ' Constructors Public Sub New (faxToSend As Uri, Optional nextPage As Webpagerequest = Nothing, Optional progressPage As Webpagerequest = Nothing, Optional decryptionCipher As Cipher = Nothing) Public Sub New (faxToSend As String, Optional nextPage As Webpagerequest = Nothing, Optional progressPage As Webpagerequest = Nothing, Optional decryptionCipher As Cipher = Nothing) ' Members Public Property DecryptionCipher As Cipher Public Property NextPage As Webpagerequest Public Property ProgressPage As Webpagerequest End Class
Examples:
-
Send a fax using the defaults:
Dim actions = New List(Of TelephonyAction) Dim sendFax = New SendFax("my_fax.tif") actions.Add(sendFax)
To send a remote fax using the defaults:
Dim sendRemoteFax = New SendFax("http://badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1") actions.Add(sendRemoteFax)
-
Send a fax and specify a next page to receive the result of the send:
Dim actions = New List(Of TelephonyAction) Dim sendFax = New SendFax("my_fax.tif", New WebPageRequest("MyFaxHandlerPage.aspx")) actions.Add(sendFax)
Get the number of pages sent from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim sendFaxResult As SendFaxResult = telephonyRequest.InstanceInfo.ActionResult Dim numberPagesSent = sendFaxResult.PagesSent
-
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
Dim actions = New List(Of TelephonyAction) Dim key As Byte() = { &H1F, &H2D, &HEB, &H2E, &H50, &H2A, &H4C, &H8C, &HBA, &H58, &HAB, &H50, &H18, &HBD, &H15, &H6, &H41, &H9E, &HEA, &HB6, &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 cipher = New AesCbcCipher(key, initialisationVector) Dim sendFax = New SendFax("my_encrypted_fax.tif", New WebPageRequest("MyFaxHandlerPage.aspx"), decryptionCipher:=cipher) actions.Add(sendFax)
Get the number of pages sent from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim sendFaxResult As SendFaxResult = telephonyRequest.InstanceInfo.ActionResult Dim numberPagesSent = SendFaxResult.PagesSent
-
Send a fax, specify a progress page and a next page:
Dim actions = New List(Of TelephonyAction) Dim sendFax = New SendFax("my_fax.tif", progressPage:=New WebPageRequest("MyProgressHandlerPage.aspx")) actions.Add(sendFax)
Get the negotiated data rate from the action's progress page request:
' Unpack the request Dim telRequest = New TelephonyRequest(Request) Dim sendFaxProgress As SendFaxProgress = telRequest.InstanceInfo.ActionProgress Dim negotiatedFaxSettings = sendFaxProgress.NegotiatedSettings Dim dataRate = negotiatedFaxSettings.DataRate
Get the number of pages sent from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim sendFaxResult As SendFaxResult = telephonyRequest.InstanceInfo.ActionResult Dim numberPagesSent = sendFaxResult.PagesSent
-
-
Public Class SendFax Inherits TelephonyAction ' Constructors Public Sub New (faxToSend As Uri, Optional nextPage As Webpagerequest = Nothing, Optional progressPage As Webpagerequest = Nothing, Optional decryptionCipher As Cipher = Nothing) Public Sub New (faxToSend As String, Optional nextPage As Webpagerequest = Nothing, Optional progressPage As Webpagerequest = Nothing, Optional decryptionCipher As Cipher = Nothing) ' Members Public Property DecryptionCipher As Cipher Public Property NextPage As Webpagerequest Public Property ProgressPage As Webpagerequest End Class
Examples:
-
Send a fax using the defaults:
Dim actions = New List(Of TelephonyAction) Dim sendFax = New SendFax("my_fax.tif") actions.Add(sendFax)
To send a remote fax using the defaults:
Dim sendRemoteFax = New SendFax("http://badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1") actions.Add(sendRemoteFax)
-
Send a fax and specify a next page to receive the result of the send:
Dim actions = New List(Of TelephonyAction) Dim sendFax = New SendFax("my_fax.tif", New WebPageRequest("MyFaxHandlerPage.aspx")) actions.Add(sendFax)
Get the number of pages sent from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim sendFaxResult As SendFaxResult = telephonyRequest.InstanceInfo.ActionResult Dim numberPagesSent = sendFaxResult.PagesSent
-
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
Dim actions = New List(Of TelephonyAction) Dim key As Byte() = { &H1F, &H2D, &HEB, &H2E, &H50, &H2A, &H4C, &H8C, &HBA, &H58, &HAB, &H50, &H18, &HBD, &H15, &H6, &H41, &H9E, &HEA, &HB6, &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 cipher = New AesCbcCipher(key, initialisationVector) Dim sendFax = New SendFax("my_encrypted_fax.tif", New WebPageRequest("MyFaxHandlerPage.aspx"), decryptionCipher:=cipher) actions.Add(sendFax)
Get the number of pages sent from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim sendFaxResult As SendFaxResult = telephonyRequest.InstanceInfo.ActionResult Dim numberPagesSent = SendFaxResult.PagesSent
-
Send a fax, specify a progress page and a next page:
Dim actions = New List(Of TelephonyAction) Dim sendFax = New SendFax("my_fax.tif", progressPage:=New WebPageRequest("MyProgressHandlerPage.aspx")) actions.Add(sendFax)
Get the negotiated data rate from the action's progress page request:
' Unpack the request Dim telRequest = New TelephonyRequest(Request) Dim sendFaxProgress As SendFaxProgress = telRequest.InstanceInfo.ActionProgress Dim negotiatedFaxSettings = sendFaxProgress.NegotiatedSettings Dim dataRate = negotiatedFaxSettings.DataRate
Get the number of pages sent from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim sendFaxResult As SendFaxResult = telephonyRequest.InstanceInfo.ActionResult Dim numberPagesSent = sendFaxResult.PagesSent
-
-
-
class SendFax extends TelephonyAction
Represents a send fax action.
Class synopsis:
// Constructors: public SendFax(URI faxToSend) public SendFax(WebPageRequest faxToSend) public SendFax(String faxToSend) public SendFax(URI faxToSend, WebPageRequest nextPage, WebPageRequest progressPage) public SendFax(String faxToSend, WebPageRequest nextPage, WebPageRequest progressPage) public SendFax(WebPageRequest faxToSend, WebPageRequest nextPage, WebPageRequest progressPage) // Members: public void setNextPage(WebPageRequest nextPage) public void setProgressPage(WebPageRequest progressPage) public void setDecryptionCipher(Cipher decryptionCipher)
class SendFaxProgress extends ActionProgress
Represents the progress of a send fax action.
Class synopsis:
// Members: public int getPagesSent() public int getReconnects() public NegotiatedFaxSettings getNegotiatedSettings()
class SendFaxResult extends ActionResult
Represents the result of a send fax action.
Class synopsis:
// Members: public String getDescription() public double getSecondsDuration() public int getPagesSent()
Examples:
Send a fax using the defaults:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); actions.add(new SendFax("my_fax.tif"));
To send a remote fax using the defaults:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); actions.add(new SendFax(new URI("http://Badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1")));
Send a fax and specify a next page to receive the result of the send:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); WebPageRequest nextPage = new WebPageRequest("my_fax_handler_page"); actions.add(new SendFax("my_fax.tif", nextPage, null));
Get the number of pages sent from the action's next page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); SendFaxResult sendFaxResult = (SendFaxResult)ourRequest.getInstanceInfo().getActionResult(); int pagesSent = sendFaxResult.getPagesSent();
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); // Specify a 256 bit cipher to be used to encrypt the received fax byte[] key = new byte[] { (byte)0x1F, (byte)0x2D, (byte)0xEB, (byte)0x2E, (byte)0x50, (byte)0x2A, (byte)0x4C, (byte)0x8C, (byte)0xBA, (byte)0x58, (byte)0xAB, (byte)0x50, (byte)0x18, (byte)0xBD, (byte)0x15, (byte)0x06, (byte)0x41, (byte)0x9E, (byte)0xEA, (byte)0x86, (byte)0xDF, (byte)0x59, (byte)0x5D, (byte)0x3A, (byte)0x43, (byte)0x1F, (byte)0x43, (byte)0xFA, (byte)0xF5, (byte)0x75, (byte)0x34, (byte)0xC9 }; byte[] initialisationVector = new byte[] { (byte)0x9B, (byte)0x85, (byte)0xFA, (byte)0xED, (byte)0x9A, (byte)0xB1, (byte)0x75, (byte)0x70, (byte)0xD5, (byte)0xA8, (byte)0x2A, (byte)0x31, (byte)0xF8, (byte)0x46, (byte)0x44, (byte)0x3B }; Cipher encryptionCipher = new AesCbcCipher(key, initialisationVector); SendFax sendFaxAction = new SendFax("my_encrypted_fax.tif"); sendFaxAction.setNextPage(new WebPageRequest("my_fax_handler_page")); sendFaxAction.setDecryptionCipher(encryptionCipher); actions.add(sendFaxAction);
Get the number of pages sent from the action's next page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); SendFaxResult sendFaxResult = (SendFaxResult)ourRequest.getInstanceInfo().getActionResult(); int pagesSent = sendFaxResult.getPagesSent();
Send a fax, specify a progress page and a next page:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); WebPageRequest nextPage = new WebPageRequest("my_fax_handler_page"); WebPageRequest progressPage = new WebPageRequest("my_progress_handler_page"); actions.add(new SendFax("my_fax.tif", nextPage, progressPage));
Get the negotiated data rate from the action's progress page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); SendFaxProgress sendFaxProgress = (SendFaxProgress)ourRequest.getInstanceInfo().getActionProgress(); NegotiatedFaxSettings settings = sendFaxProgress.getNegotiatedSettings(); int dataRate = settings.getDataRate();
Get the number of pages sent from the action's next page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); SendFaxResult sendFaxResult = (SendFaxResult)ourRequest.getInstanceInfo().getActionResult(); int pagesSent = sendFaxResult.getPagesSent();
-
class SendFax
Represents a send fax action.
Class synopsis:
# SendFax object: SendFax(fax_to_send, progress_page=None, next_page=None, decryption_cipher=None) # Instance methods: SendFax.set_fax_to_send(fax_to_send) SendFax.set_next_page(next_page) SendFax.set_progress_page(progress_page) SendFax.set_decryption_cipher(decryption_cipher)
Send Fax Progress
The Send Fax Progress is represented by a dictionary. It is found within the
action progress
for theprogress page
.Obtaining the Send Fax Progress dictionary:
my_request = TelephonyRequest(request) action_result = my_request.get_action_progress() if action_result.get("action") == "send_fax": txfax_progress = action_result.get("progress")
Send Fax Result
The Send Fax Result is represented by a dictionary. It is found within the
action result
for thenext page
.Obtaining the Send Fax Result dictionary:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "send_fax": txfax_result = action_result.get("result")
Examples:
Send a fax using the defaults:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] list_of_actions.append(SendFax('my_fax.tif'))
To send a remote fax using the defaults:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] list_of_actions.append(SendFax(WebPage(url="http://Badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1")))
Send a fax and specify a next page to receive the result of the send:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] send_fax_action = SendFax('my_fax.tif') send_fax_action.set_next_page(WebPage(url="my_fax_handler_page")) list_of_actions.append(send_fax_action)
Get the number of pages sent from the action's next page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "send_fax": txfax_result = action_result.get("result") description = txfax_result.get("description") seconds_duration = txfax_result.get("seconds_duration") pages_sent = txfax_result.get("pages_sent") # Your code here...
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] my_cipher = AESCBCCipher(key='1F2DEB2E502A4C8CBA58AB5018BD1506419EEA86DF595D3A431F43FAF57534C9', initialisation_vector='9B85FAED9AB17570D5A82A31F846443B') send_fax_action = SendFax('my_encrypted_fax.tif') send_fax_action.set_next_page(WebPage(url="my_fax_handler_page")) send_fax_action.set_decryption_cipher(my_cipher) list_of_actions.append(send_fax_action)
Get the number of pages sent from the action's next page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "send_fax": txfax_result = action_result.get("result") description = txfax_result.get("description") seconds_duration = txfax_result.get("seconds_duration") pages_sent = txfax_result.get("pages_sent") # Your code here...
Send a fax, specify a progress page and a next page:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] send_fax_action = SendFax('my_encrypted_fax.tif') send_fax_action.set_next_page(WebPage(url="my_fax_handler_page")) send_fax_action.set_progress_page(WebPage(url="my_progress_handler_page")) list_of_actions.append(send_fax_action)
Get the negotiated data rate from the action's progress page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_progress() if action_result.get("action") == "send_fax": txfax_progress = action_result.get("progress") settings = txfax_progress.get("negotiated_settings") data_rate = settings.get("data_rate") # Your code here...
Get the number of pages sent from the action's next page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "send_fax": txfax_result = action_result.get("result") description = txfax_result.get("description") seconds_duration = txfax_result.get("seconds_duration") pages_sent = txfax_result.get("pages_sent") # Your code here...
-
The SendFax class
Introduction
Represents a send fax action.
Class synopsis
class SendFax extends ActionBase { /* methods */ public __construct() public static SendFax tiffFile(string $fax_to_send, Cipher $cipher = null) public static SendFax tiffUrl(WebPageRequest|string $fax_to_send, string $method = null) public self setTiffFile(string $fax_to_send, Cipher $cipher = null) public self setTiffUrl(WebPageRequest|string $fax_to_send, string $method = null) public self setNextPage(WebPageRequest|string $next_page, string $method = null) public self setProgressPage(WebPageRequest|string $progress_page, string $method = null) }
The SendFaxProgress class
Introduction
Represents the progress of a send fax action.
Class synopsis
class SendFaxProgress extends ActionProgress { /* methods */ public int getPagesSent() public int getReconnects() public NegotiatedFaxSettings getNegotiatedFaxSettings() /* inherited methods */ public string getAction() }
The SendFaxResult class
Introduction
Represents the result of a send fax action.
Class synopsis
class SendFaxResult extends ActionResult { /* methods */ public string getDescription() public int getPagesSent() public float getSecondsDuration() /* inherited methods */ public string getAction() public boolean getInterrupted() }
Examples:
Send a fax using the defaults:
$r = new Aculab\TelephonyRestAPI\SendFax(); $r->setTiffFile('my_fax.tif'); $response->addAction($r);
To end a remote fax using the defaults
$r = new Aculab\TelephonyRestAPI\SendFax(); $r->setTiffUrl('http://Badger.set.com:80/my_tif_page?filename=my_fax.tif&version=1'); $response->addAction($r);
Send a fax and specify a next page to receive the result of the send:
$r = new Aculab\TelephonyRestAPI\SendFax(); $r->setTiffFile('my_fax.tif'); $r->setNextPage('my_fax_handler_page'); $response->addAction($r);
Get the number of pages sent from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $sendFaxResult = $info->getActionResult(); $numberPagesSent = $sendFaxResult->getPagesSent();
Send a fax from an encrypted file and specify a next page to receive the result of the send. Supply a cipher to decrypt the fax:
$cipher = new Aculab\TelephonyRestAPI\AesCbcCipher( "1F2DEB2E502A4C8CBA58AB5018BD1506419EEA86DF595D3A431F43FAF57534C9", "9B85FAED9AB17570D5A82A31F846443B" ); $sf = new Aculab\TelephonyRestAPI\SendFax(); $sf->setTiffFile('my_encrypted_fax.tif', $cipher); $sf->setNextPage('my_fax_handler_page'); $response->addAction($sf);
Get the number of pages sent from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $sendFaxResult = $info->getActionResult(); $numberPagesSent = $sendFaxResult->getPagesSent();
Send a fax, specify a progress page and a next page:
$r = new Aculab\TelephonyRestAPI\SendFax(); $r->setTiffFile('my_fax.tif'); $r->setProgressPage('my_progress_handler_page'); $r->setNextPage('my_fax_handler_page'); $response->addAction($r);
Get the negotiated data rate from the action's progress page request:
$info = InstanceInfo::getInstanceInfo(); $sendFaxProgress = $info->getActionProgress(); $negotiatedFaxSettings = $sendFaxProgress->getNegotiatedFaxSettings(); $dataRate = $negotiatedFaxSettings->getDataRate();
Get the number of pages sent from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $sendFaxResult = $info->getActionResult(); $numberPagesSent = $sendFaxResult->getPagesSent();