Forward a fax to another number
POST Variables
Variable Name | Var Type | Type | Description |
action | String | Required | Must be “Forward_Fax” |
access_id | Integer | Required | Account Number |
access_pwd | String | Required | Password on the user’s account |
sCallerID | Integer | Required | Sender’s Fax Number (must be 10 digits) |
sSenderEmail | String | Required | Sender’s Email Address |
sFaxType | String | Required | “SINGLE” or “BROADCAST” |
sToFaxNumber | String | Required | 11 digit number or up to 50 11 digit fax numbers separated by a “|” (pipe) |
sDirection | String | Required | “IN” or “OUT” for inbound or outbound fax |
sFaxFileName | String | Required* | sFaxFileName returned from Get_Fax_Inbox or Get_Fax_Outbox |
sFaxDetailsID | String | Required* | sFaxDetailsID of the fax – the ID is located after the “|” (pipe) character of the sFaxFileName |
sSubUserID | Integer | Optional | The account number of a sub account, if you want to use a master account to download a sub account’s fax |
sResponseFormat | String | Optional | “XML” or “JSON” – Default is JSON |
sAccountCode | String | Optional | Internal Reference Number (Maximum of 20 characters) |
sRetries | Integer | Optional | Number of times the system is to retry a number if busy or an error is encountered – number from 0 to 6 |
sFaxFromHeader | String | Optional | From: On the Fax Header Line(Maximum of 30 characters) |
sNotifyURL | String | Optional | Provide an absolute URL (beginning with https:// or https://) and the SRFax system will POST back the fax status record when the fa completes. (See below for more details) |
sQueueFaxDate | String | Optional | The date you want to schedule a future fax for. Must be in the format YYYY-MM-DD. Required if using sQueueFaxTime |
sQueueFaxTime | String | Optional | The time you want to schedule a future fax for. Must be in the format HH:MM, using 24 hour time (ie, 00:00 – 23:59). Required if using sQueueFaxTime |
Notes:
- *Either the sFaxFileName or the sFaxDetailsID must be supplied
- sQueueFaxDate/sQueueFaxTime must be for a future time. The timezone set on the account will be used when scheduling.
Returned Variables (JSON or XML Encoded)
Status | string | “Success” or “Failed” |
Result | string | Queued Fax ID (FaxDetailsID) or Reason for failure |
NOTIFY URL POST Response
If the sNotifyURL is provided in the initial Queue_Fax call, the same variables returned from Get_Fax_Status will be sent the URL you provide as POST variables. At any time you are still able to poll the fax status by calling Get_Fax_Status if the sNotifyURL is missed for any reason. The variables sent are as follows:
Variable Name | Var Type | Size | Description |
FaxDetailsID | Integer | – | Fax Job ID |
FileName | String | 50 | Name of the fax file |
SentStatus | String | 15 | Status of the fax |
AccountCode | String | 20 | Account Code provided when fax was scheduled |
DateQueued | String | – | Date the fax was queued for delivery |
DateSent | String | – | Date the fax was sent |
ToFaxNumber | String | 20 | Recipient Fax Number |
Pages | Integer | – | Total number of pages |
Duration | Integer | – | Call length for transmission |
RemoteID | String | 40 | Remote Fax ID |
ErrorCode | String | 75 | Error message in the event of a failed fax |
Size | Integer | – | Size of the file |
NOTES:
- You have to setup the URL provided in sNotifyURL so that it can handle a POST of the variables listed above
- The DateQueued and DateSent variables will reflect your accountds timzone settings
- The error code will be a string describing the error encountered. There is a wide range of possible errors, the most frequent of which are “No Answer”, “Busy”, and “No Remote Fax”
Examples
PHP using cURL
-
<?php
-
‘action’ => ‘Forward_Fax’,
-
‘access_id’ => ‘12345’,
-
‘access_pwd’ => ‘myPassword’,
-
‘sCallerID’ => ‘5551234567’,
-
‘sSenderEmail’ => ‘myfax [at] example [dot] com’,
-
‘sFaxType’ => ‘SINGLE’,
-
‘sToFaxNumber’ => ‘15554567890’,
-
‘sDirection’ => ‘IN’,
-
‘sFaxDetailsID’ => ‘123456789’
-
);
-
CURLOPT_POST => 1,
-
CURLOPT_HEADER => 0,
-
CURLOPT_URL => “https://secure.srfax.com/SRF_SecWebSvc.php”,
-
CURLOPT_FRESH_CONNECT => 1,
-
CURLOPT_RETURNTRANSFER => 1,
-
CURLOPT_FORBID_REUSE => 1,
-
CURLOPT_TIMEOUT => 60,
-
CURLOPT_SSL_VERIFYPEER => true,
-
CURLOPT_SSL_VERIFYHOST => 2,
-
);
-
}
-
else {
-
}
-
?>
PHP using SRFax Object
-
<?php
-
require_once (“srFax_class.php”);
-
$accountID = “12345”;
-
$accountPassword = “myPassword”;
-
// instantiate object with Account ID and Password
-
$srFax = new srFax ( $accountID, $accountPassword );
-
//Setup required variables
-
$senderFaxNumber = “5551234567”;
-
$senderEmail = “myfax [at] example [dot] com”;
-
$receiverFaxNumber = “15554567890”;
-
try {
-
// attempt to queue a fax
-
‘sCallerID’ => $senderFaxNumber,
-
‘sSenderEmail’ => $senderEmail,
-
‘sFaxType’ => ‘SINGLE’,
-
‘sToFaxNumber’ => $receiverFaxNumber,
-
‘sDirection’ => ‘IN’,
-
‘sFaxDetailsID’ => ‘123456789’,
-
));
-
}
-
catch (Exception $e) { // display error when exception is thrown
-
}
-
if ( $srFax->getRequestStatus () ) {
-
echo “Success! Fax Details ID = “ . $srFax->getRequestResponse ();
-
} else {
-
echo “ERROR: “ . $srFax->getRequestResponse ();
-
}
-
?>