Skip to main content

Relay.Calling.RecordAction

This object returned from recordAsync method that represents a recording that is currently active on a call.

Methods

getControlId

Return the UUID to identify the recording.

Available In:

Parameters

None

Returns

string - UUID to identify the action.

Examples

Start recording in stereo mode and print the controlId.
<?php

$params = [
'stereo' => true
];
$call->recordAsync($params)->done(function($action) {
echo $action->getControlId();
});

getResult

Returns the final result of the recording.

Available In:

Parameters

None

Returns

Relay.Calling.RecordResult - Final result of the recording.

Examples

Start recording in stereo mode and grab the result when it's completed.
<?php

$params = [
'stereo' => true
];
$call->recordAsync($params)->done(function($action) {
// .. later in the code since it's an async method
if ($action->isCompleted()) {
$result = $action->getResult();
}
});

getPayload

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

Available In:

Parameters

None

Returns

Object - Payload sent to Relay.

Examples

Start recording in stereo mode and print out the payload.
<?php

$params = [
'stereo' => true
];
$call->recordAsync($params)->done(function($action) {
print_r($action->getPayload());
});

getState

Return the current state of recording.

Available In:

Parameters

None

Returns

string - Current state of recording.

Examples

Start recording in stereo mode and print the state.
<?php

$params = [
'stereo' => true
];
$call->recordAsync($params)->done(function($action) {
echo $action->getState();
});

getUrl

Returns the HTTPS URL to the recording file.

Note: the recording may not be present at the URL until the recording is finished.

Available In:

Parameters

None

Returns

string - HTTPS URL to the file.

Examples

Start recording and print the URL.
<?php

$params = [
'stereo' => true
];
$call->recordAsync($params)->done(function($action) {
echo $result->getUrl();
});

isCompleted

Return true if the recording has finished, false otherwise.

Available In:

Parameters

None

Returns

Boolean - True/False accordingly to the state.

Examples

Start recording in stereo mode and check if it has finished.
<?php

$params = [
'stereo' => true
];
$call->recordAsync($params)->done(function($action) {
if ($action->isCompleted()) {

}
});

stop

Stop the action immediately.

Available In:

Parameters

None

Returns

React\Promise\Promise - Promise object that will be fulfilled with a Relay.Calling.StopResult object.

Examples

Start recording in stereo mode and stop it an 'Agent' is not available.
<?php

$params = [
"audio" => [
"stereo" => true
]
];
$call->recordAsync($params)->done(function($action) use ($globalAgent) {
if ($globalAgent->isAvailable() === false) {
$action->stop()->done(function($stopResult) {

});
}
});