Relay.Calling.RecordAction

View as Markdown

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.

Parameters

None

Returns

string - UUID to identify the action.

Examples

Start recording in stereo mode and print the controlId.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->recordAsync($params)->done(function($action) {
7 echo $action->getControlId();
8});

getResult

Returns the final result of the recording.

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.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->recordAsync($params)->done(function($action) {
7 // .. later in the code since it's an async method
8 if ($action->isCompleted()) {
9 $result = $action->getResult();
10 }
11});

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 recording in stereo mode and print out the payload.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->recordAsync($params)->done(function($action) {
7 print_r($action->getPayload());
8});

getState

Return the current state of recording.

Parameters

None

Returns

string - Current state of recording.

Examples

Start recording in stereo mode and print the state.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->recordAsync($params)->done(function($action) {
7 echo $action->getState();
8});

getUrl

Returns the HTTPS URL to the recording file.

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

Parameters

None

Returns

string - HTTPS URL to the file.

Examples

Start recording and print the URL.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->recordAsync($params)->done(function($action) {
7 echo $result->getUrl();
8});

isCompleted

Return true if the recording has finished, false otherwise.

Parameters

None

Returns

Boolean - True/False accordingly to the state.

Examples

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

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->recordAsync($params)->done(function($action) {
7 if ($action->isCompleted()) {
8
9 }
10});

stop

Stop the action immediately.

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.

1<?php
2
3$params = [
4 "audio" => [
5 "stereo" => true
6 ]
7];
8$call->recordAsync($params)->done(function($action) use ($globalAgent) {
9 if ($globalAgent->isAvailable() === false) {
10 $action->stop()->done(function($stopResult) {
11
12 });
13 }
14});