Relay.Calling.FaxAction

View as Markdown

This object returned from faxReceiveAsync and faxSendAsync methods represents a receiving or sending Fax on the call.

Methods

getControlId

Return the UUID to identify the fax action.

Parameters

None

Returns

string - UUID to identify the action.

Examples

Start faxing and print the controlId.

1<?php
2
3$call->faxSendAsync('https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf')->done(function ($action) {
4 echo $action->getControlId();
5});

getPayload

Return the payload sent to Relay to initiate the request. Useful to inspect what you sent to perform this action.

Parameters

None

Returns

Object - Payload sent to Relay.

Examples

Start sending a fax and print out the payload.

1<?php
2
3$call->faxSendAsync('https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf', '+1888222111', 'Custom Header')->done(function ($action) {
4 print_r($action->getPayload());
5});

getResult

Returns the final result of the faxing.

Parameters

None

Returns

Relay.Calling.FaxResult - Final result of the faxing.

Examples

Trying receiving a Fax and grab the result when it’s completed.

1<?php
2
3$call->faxReceiveAsync()->done(function($action) {
4 // .. later in the code since it's an async method
5 if ($action->isCompleted()) {
6 $faxResult = $action->getResult();
7 }
8});

isCompleted

Return true if faxing has finished, false otherwise.

Parameters

None

Returns

Boolean - True/False accordingly to the state.

Examples

Trying receiving a Fax and check if it has finished.

1<?php
2
3$call->faxReceiveAsync()->done(function($action) {
4 // .. later in the code since it's an async method
5 if ($action->isCompleted()) {
6
7 }
8});

stop

Stop the action immediately.

Parameters

None

Returns

React\Promise\Promise - A React Promise that will be resolved with the Relay response.

Examples

Trying to receive a Fax and then stop the attempt.

1<?php
2
3$call->faxReceiveAsync()->done(function ($faxAction) {
4 // For demonstration purposes only..
5 $faxAction->stop();
6});