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
<?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
<?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
<?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
<?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
<?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
<?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
<?php
$params = [
"audio" => [
"stereo" => true
]
];
$call->recordAsync($params)->done(function($action) use ($globalAgent) {
if ($globalAgent->isAvailable() === false) {
$action->stop()->done(function($stopResult) {
});
}
});