Skip to main content

Relay.Calling.HangupResult

This object returned from hangup method.

Methods​

getEvent​

Returns the last Relay Event arrived for this operation.

Parameters

None

Returns

Relay.Event - Last Relay Event.

Examples

Hangup the call and inspect the retrieve the last Relay event.

<?php

$call->hangup()->done(function($result) {
$event = $result->getEvent();
// Inspect $event->payload ..
});

getReason​

Returns the reason why the call has ended.

Parameters

None

Returns

string - Possible values: hangup, cancel, busy, noAnswer, decline, error

Examples

<?php

$call->hangup()->done(function($result) {
$reason = $result->getReason();
});

isSuccessful​

Return true if the call was answered without errors, false otherwise.

Parameters

None

Returns

boolean - Whether the call has been answered successfully.

Examples

Hangup the call and check if the operation succeeded.

<?php

$call->hangup()->done(function($result) {
if ($result->isSuccessful()) {
// $call has been hung up successfully!
}
});