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

  1. <?php
  2.    $postVariables = array(
  3.      ‘action’         => ‘Forward_Fax’,
  4.      ‘access_id’      => ‘12345’,
  5.      ‘access_pwd’     => ‘myPassword’,
  6.      ‘sCallerID’      => ‘5551234567’,
  7.      ‘sSenderEmail’   => ‘myfax [at] example [dot] com’,
  8.      ‘sFaxType’       => ‘SINGLE’,
  9.      ‘sToFaxNumber’   => ‘15554567890’,
  10.      ‘sDirection’     => ‘IN’,
  11.      ‘sFaxDetailsID’  => ‘123456789’
  12.    );
  13.    $curlDefaults = array(
  14.        CURLOPT_POST           => 1,
  15.        CURLOPT_HEADER         => 0,
  16.        CURLOPT_URL            => “https://secure.srfax.com/SRF_SecWebSvc.php”,
  17.        CURLOPT_FRESH_CONNECT  => 1,
  18.        CURLOPT_RETURNTRANSFER => 1,
  19.        CURLOPT_FORBID_REUSE   => 1,
  20.        CURLOPT_TIMEOUT        => 60,
  21.        CURLOPT_SSL_VERIFYPEER => true,
  22.        CURLOPT_SSL_VERIFYHOST => 2,
  23.        CURLOPT_POSTFIELDS     => http_build_query($postVariables),
  24.    );
  25.    $ch = curl_init();
  26.    curl_setopt_array($ch, $curlDefaults);
  27.    $result = curl_exec($ch);
  28.    if (curl_errno($ch)) {
  29.        echo “Error – “ . curl_error($ch);
  30.    }
  31.    else {
  32.        echo “Result:” . print_r( json_decode($result, true), 1 );
  33.    }
  34. ?>

 

PHP using SRFax Object

  1. <?php
  2.   require_once (“srFax_class.php”);
  3.   $accountID        = “12345”;
  4.   $accountPassword  = “myPassword”;
  5.   // instantiate object with Account ID and Password
  6.   $srFax = new srFax ( $accountID, $accountPassword );
  7.   //Setup required variables
  8.   $senderFaxNumber   = “5551234567”;
  9.   $senderEmail       = “myfax [at] example [dot] com”;
  10.   $receiverFaxNumber = “15554567890”;
  11.   try {
  12.       // attempt to queue a fax
  13.       $srFax->Forward_Fax(array(
  14.         ‘sCallerID’      => $senderFaxNumber,
  15.         ‘sSenderEmail’   => $senderEmail,
  16.         ‘sFaxType’       => ‘SINGLE’,
  17.         ‘sToFaxNumber’   => $receiverFaxNumber,
  18.         ‘sDirection’     => ‘IN’,
  19.         ‘sFaxDetailsID’  => ‘123456789’,
  20.       ));
  21.   }
  22.   catch (Exception $e) { // display error when exception is thrown
  23.       die(“Error: $e);
  24.   }
  25.   if ( $srFax->getRequestStatus () ) {
  26.       echo “Success! Fax Details ID = “ . $srFax->getRequestResponse ();
  27.   } else {
  28.       echo “ERROR: “ . $srFax->getRequestResponse ();
  29.   }
  30. ?>