public function transfer($liveCallUuid, array $optionalArgs = [])
    {

        if (empty($liveCallUuid)) {
            throw new PlivoValidationException(
                "Which call to transfer? No callUuid given");
        }

        if (isset($optionalArgs['legs'])) 
        {
            switch ($optionalArgs['legs']) {
                case 'aleg':
                    if (!isset($optionalArgs['aleg_url'])) {
                        throw new PlivoValidationException(
                            "alegUrl is mandatory"
                        );
                    }
                    break;
                case 'bleg':
                    if (!isset($optionalArgs['bleg_url'])) {
                        throw new PlivoValidationException(
                            "blegUrl is mandatory"
                        );
                    }
                    break;
                case 'both':
                    if (!(isset($optionalArgs['aleg_url']) &&
                          isset($optionalArgs['bleg_url']))) {
                        throw new PlivoValidationException(
                            "alegUrl and blegUrl are mandatory"
                        );
                    }
                    break;
                default:
                    throw new PlivoValidationException(
                        "Only aleg, bleg or both are allowed"
                    );
            }
        } else {
            throw new PlivoValidationException(
                "default is aleg, hence alegUrl is mandatory"
            );
        }

        $response = $this->client->update(
            $this->uri . $liveCallUuid . '/',
            $optionalArgs
        );

        $responseContents = $response->getContent();

        if(!array_key_exists("error",$responseContents)){
            return new ResponseUpdate(
                $responseContents['api_id'],
                $responseContents['message'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }

        
    }
public function transfer($liveCallUuid, array $optionalArgs = [])
    {

        if (empty($liveCallUuid)) {
            throw new PlivoValidationException(
                "Which call to transfer? No callUuid given");
        }

        if (isset($optionalArgs['legs'])) 
        {
            switch ($optionalArgs['legs']) {
                case 'aleg':
                    if (!isset($optionalArgs['aleg_url'])) {
                        throw new PlivoValidationException(
                            "alegUrl is mandatory"
                        );
                    }
                    break;
                case 'bleg':
                    if (!isset($optionalArgs['bleg_url'])) {
                        throw new PlivoValidationException(
                            "blegUrl is mandatory"
                        );
                    }
                    break;
                case 'both':
                    if (!(isset($optionalArgs['aleg_url']) &&
                          isset($optionalArgs['bleg_url']))) {
                        throw new PlivoValidationException(
                            "alegUrl and blegUrl are mandatory"
                        );
                    }
                    break;
                default:
                    throw new PlivoValidationException(
                        "Only aleg, bleg or both are allowed"
                    );
            }
        } else {
            throw new PlivoValidationException(
                "default is aleg, hence alegUrl is mandatory"
            );
        }

        $response = $this->client->update(
            $this->uri . $liveCallUuid . '/',
            $optionalArgs
        );

        $responseContents = $response->getContent();

        if(!array_key_exists("error",$responseContents)){
            return new ResponseUpdate(
                $responseContents['api_id'],
                $responseContents['message'],
                $response->getStatusCode()
            );
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }

        
    }
public function transfer ( $ liveCallUuid , array $ optionalArgs = [ ] ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to transfer? No callUuid given" ) ; } if ( isset ( $ optionalArgs [ 'legs' ] ) ) { switch ( $ optionalArgs [ 'legs' ] ) { case 'aleg' : if ( ! isset ( $ optionalArgs [ 'aleg_url' ] ) ) { throw new PlivoValidationException ( "alegUrl is mandatory" ) ; } break ; case 'bleg' : if ( ! isset ( $ optionalArgs [ 'bleg_url' ] ) ) { throw new PlivoValidationException ( "blegUrl is mandatory" ) ; } break ; case 'both' : if ( ! ( isset ( $ optionalArgs [ 'aleg_url' ] ) && isset ( $ optionalArgs [ 'bleg_url' ] ) ) ) { throw new PlivoValidationException ( "alegUrl and blegUrl are mandatory" ) ; } break ; default : throw new PlivoValidationException ( "Only aleg, bleg or both are allowed" ) ; } } else { throw new PlivoValidationException ( "default is aleg, hence alegUrl is mandatory" ) ; } $ response = $ this -> client -> update ( $ this -> uri . $ liveCallUuid . '/' , $ optionalArgs ) ; $ responseContents = $ response -> getContent ( ) ; if ( ! array_key_exists ( "error" , $ responseContents ) ) { return new ResponseUpdate ( $ responseContents [ 'api_id' ] , $ responseContents [ 'message' ] , $ response -> getStatusCode ( ) ) ; } else { throw new PlivoResponseException ( $ responseContents [ 'error' ] , 0 , null , $ response -> getContent ( ) , $ response -> getStatusCode ( ) ) ; } }
Transfer a live call

@param string $liveCallUuid
@param array $optionalArgs
+ Valid arguments with their types
+ [string] legs - aleg, bleg or both Defaults to aleg. aleg will transfer call_uuid ; bleg will transfer the bridged leg (if found) of call_uuid ; both will transfer call_uuid and bridged leg of call_uuid
+ [string] aleg_url - URL to transfer for aleg, if legs is aleg or both, then aleg_url has to be specified.
+ [string] aleg_method - HTTP method to invoke aleg_url. Defaults to POST.
+ [string] bleg_url - URL to transfer for bridged leg, if legs is bleg or both, then bleg_url has to be specified.
+ [string] bleg_method - HTTP method to invoke bleg_url. Defaults to POST.
@return ResponseUpdate
@throws PlivoValidationException
Transfer a live call