Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated using 4PSA automated script

...

Click2Fax is an App written in PHP that allows anyone to send faxes using the UnifiedAPI. It uses the Fax resource Fax resource exposed by Unified API and the following request:

  •  Create Faxes - Send fax to any number without need of approval

...

STEP 1: Download the files.

Download the the archive, extract the files, and copy them to a directory that can be accessed over the Web.

STEP 2:  Configure the App.

In order to use the App,  you you must configure it. To do so, you must open the file file config.php in the  in the <PATH_TO_Click2FAX>/interface/config/config.php and and change the following settings:

...

Note
Please note that the newly created app will not work properly unless you check the App is trusted option in the Add App form.

STEP 3:  Proceed to allowing permissions and ownership rights.

...

As soon as the setup process is complete, you can access the interface at https://<IP>/<PATH_TO_CLICK2FAX>/interface/. The page displays a single button that the user can click in order to send the faxes. Once the button is clicked the following form appears:

 

 

 

 

 

 

 

 

 

To send the fax a user must enter the information in the form fields as described below:

...

Internal Flow

When the Send Fax button button is pressed the scripts makes a Create Faxes request to the VoipNow server using UnifiedAPI.  It It uses the extension defined in the global variable variable VN_EXTENSION as as the source of the fax call.

...

Code Block
languagephp
// Fetch token
$token = getToken();
$headers = array(
   'Authorization' => $token
);
 
$request = new cURLRequest();
				
//Fax Create uses POST
$request->setMethod(cURLRequest::METHOD_POST);
$request->setHeaders($headers);
$request->setBody(array('recipients' => array($_POST['to'])), cURLRequest::ENCODER_JSON); 

The The HTTP Request made by the App looks like this:

Code Block
POST /uapi/faxes/@me/0003*210 HTTP/1.1
HOST x.x.x.x
Authorization: <OAUTH_ACCESS_TOKEN>
Content-Length:469
Content-Type: multipart/form-data; boundary=------------325343636
------------325343636-------- 
Content-Disposition:form-data; name="files"; filename="/path/to/file/file.ext"
Content-Type;application/octet-stream
  
This is my fax
------------325343636
Content-Disposition:form-data; name="request";
{
  "recipients":[<FAX_EXTENSION_TO>]
}
------------325343636

Then sets the files which have which have been uploaded through the browser:

...

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.