Relay.Calling.ConnectResult

View as Markdown

This object returned from the connect method that represents the final result of a connection between your call and a remote one.

Methods

getCall

Return the Call object connected with yours, if the connection succeeded.

Parameters

None

Returns

Relay.Calling.Call - The remote Call.

Examples

Trying to connect two devices and then use the remote Call.

1<?php
2
3$devices = [
4 [ "type" => "phone", "to" => "+18991114444", "timeout" => 30 ],
5 [ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ]
6];
7$call->connect(...$devices)->done(function($result) {
8 if ($result->isSuccessful()) {
9 $remoteCall = $result->getCall();
10 // Use $remoteCall as a normal Relay.Calling.Call object...
11 }
12});

getEvent

Returns the last Relay Event arrived for this operation.

Parameters

None

Returns

Relay.Event - Last Relay Event.

Examples

Trying to connect two devices and then grab the Relay event to inspect the payload.

1<?php
2
3$devices = [
4 [ "type" => "phone", "to" => "+18991114444", "timeout" => 30 ],
5 [ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ]
6];
7$call->connect(...$devices)->done(function($result) {
8 $event = $result->getEvent();
9 // Inspect $event->payload ..
10});

isSuccessful

Return true if the call has connected with a remote party, false otherwise.

Parameters

None

Returns

boolean - Whether the call has been connected successfully.

Examples

Trying to connect two devices and then check if your call has been connected.

1<?php
2
3$devices = [
4 [ "type" => "phone", "to" => "+18991114444", "timeout" => 30 ],
5 [ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ]
6];
7$call->connect(...$devices)->done(function($result) {
8 if ($result->isSuccessful()) {
9 // Your call has been connected..
10 }
11});