*** id: 8b1ebe4e-90b9-4fa7-a773-c42bfab1f03b title: Relay.Calling.ConnectAction slug: /php/reference/calling/actions/connect description: The ConnectAction object is returned when connecting a call. max-toc-depth: 3 ---------------- [call]: /docs/server-sdk/v2/php/reference/calling/call#connectasync [relay-calling-connectresult]: /docs/server-sdk/v2/php/reference/calling/results/connect This object returned from [`connectAsync`][call] method that represents a connecting attempt that is currently active on a call. ## Methods ### getResult Returns the final result of the connect attempt. **Returns** [`Relay.Calling.ConnectResult`][relay-calling-connectresult] - Final result of the connect attempt. **Examples** Trying to connect two numbers in series and grab the result when it's completed. ```php "phone", "to" => "+18991114444", "timeout" => 30 ], [ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ] ]; $call->connectAsync(...$devices)->done(function($action) { // .. later in the code since it's an async method if ($action->isCompleted()) { $result = $action->getResult(); } }); ``` ### getState Return the current state of the connect attempt. **Returns** `string` - Current state of the connect attempt. **Examples** Trying to connect two numbers in series and print the state. ```php "phone", "to" => "+18991114444", "timeout" => 30 ], [ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ] ]; $call->connectAsync(...$devices)->done(function($action) { echo $action->getState(); }); ``` ### getPayload Return the payload sent to Relay to initiate the request. Useful to inspect what you sent to perform this action. **Returns** `Object` - Payload sent to Relay. **Examples** Trying to connect two numbers in series and print out the payload. ```php "phone", "to" => "+18991114444", "timeout" => 30 ], [ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ] ]; $call->connectAsync(...$devices)->done(function($action) { print_r($action->getPayload()); }); ``` ### isCompleted Return `true` if the connect attempt has finished, `false` otherwise. **Returns** `Boolean` - True/False accordingly to the state. **Examples** Trying to connect two numbers in series and check if it has finished. ```php "phone", "to" => "+18991114444", "timeout" => 30 ], [ "type" => "phone", "to" => "+18991114445", "timeout" => 20 ] ]; $call->connectAsync(...$devices)->done(function($action) { if ($action->isCompleted()) { } }); ```