Relay.Calling.TapAction
This object returned from tapAsync
method that represents the running media tapping active on a call.
Methods
getControlId
Return the UUID to identify the action.
Available In:
Parameters
None
Returns
string
- UUID to identify the action.
Examples
<?php
$tap = [
'target_type' => 'rtp',
'target_addr' => '192.168.1.1',
'target_port' => 1234
];
$call->tapAsync($tap)->done(function($action) {
echo $action->getControlId();
});
getResult
Returns the final result of this tapping
action.
Available In:
Parameters
None
Returns
Relay.Calling.TapResult
- Final tap
result.
Examples
<?php
$tap = [
'target_type' => 'rtp',
'target_addr' => '192.168.1.1',
'target_port' => 1234
];
$call->tapAsync($tap)->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
$tap = [
'target_type' => 'rtp',
'target_addr' => '192.168.1.1',
'target_port' => 1234
];
$call->tapAsync($tap)->done(function($action) {
print_r($action->getPayload());
});
getState
Return the current tapping
state.
Available In:
Parameters
None
Returns
string
- The current state.
Examples
<?php
$tap = [ 'type' => 'audio' ];
$device = [ 'type' => 'rtp', 'addr' => '192.168.1.1', 'port' => 1234 ];
$call->tapAsync($tap, $device)->done(function($action) {
echo $action->getState();
});
isCompleted
Return true
if tapping has finished, false
otherwise.
Available In:
Parameters
None
Returns
Boolean
- True/False accordingly to the state.
Examples
<?php
$tap = [
'target_type' => 'rtp',
'target_addr' => '192.168.1.1',
'target_port' => 1234
];
$call->tapAsync($tap)->done(function($action) {
if ($action->isCompleted()) {
}
});
getSourceDevice
Return the source device sending media.
Available In:
Parameters
None
Returns
Object
- The source device.
Examples
<?php
$tap = [
'target_type' => 'rtp',
'target_addr' => '192.168.1.1',
'target_port' => 1234
];
$call->tapAsync($tap)->done(function($action) {
$source = $action->getSourceDevice();
});
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
$tap = [
'target_type' => 'rtp',
'target_addr' => '192.168.1.1',
'target_port' => 1234
];
$call->tapAsync($tap)->done(function($action) {
// For demonstration purposes only..
$action->stop()->done(function($stopResult) {
});
});