Hangup Result

View as Markdown

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.

1<?php
2
3$call->hangup()->done(function($result) {
4 $event = $result->getEvent();
5 // Inspect $event->payload ..
6});

getReason

Returns the reason why the call has ended.

Parameters

None

Returns

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

Examples

1<?php
2
3$call->hangup()->done(function($result) {
4 $reason = $result->getReason();
5});

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.

1<?php
2
3$call->hangup()->done(function($result) {
4 if ($result->isSuccessful()) {
5 // $call has been hung up successfully!
6 }
7});