public function addNumber(
        array $numbers, $carrier, $region, array $optionalArgs = [])
    {
        $mandatoryArgs = [
            'numbers' => join(',', $numbers),
            'carrier' => $carrier,
            'region' => $region
        ];

        if (ArrayOperations::checkNull($mandatoryArgs)) {
            throw new PlivoValidationException(
                "Mandatory parameters cannot be null");
        }

        $response = $this->client->update(
            $this->uri,
            array_merge($mandatoryArgs, $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 addNumber(
        array $numbers, $carrier, $region, array $optionalArgs = [])
    {
        $mandatoryArgs = [
            'numbers' => join(',', $numbers),
            'carrier' => $carrier,
            'region' => $region
        ];

        if (ArrayOperations::checkNull($mandatoryArgs)) {
            throw new PlivoValidationException(
                "Mandatory parameters cannot be null");
        }

        $response = $this->client->update(
            $this->uri,
            array_merge($mandatoryArgs, $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 addNumber ( array $ numbers , $ carrier , $ region , array $ optionalArgs = [ ] ) { $ mandatoryArgs = [ 'numbers' => join ( ',' , $ numbers ) , 'carrier' => $ carrier , 'region' => $ region ] ; if ( ArrayOperations :: checkNull ( $ mandatoryArgs ) ) { throw new PlivoValidationException ( "Mandatory parameters cannot be null" ) ; } $ response = $ this -> client -> update ( $ this -> uri , array_merge ( $ mandatoryArgs , $ 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 ( ) ) ; } }
Buy a new number

@param array $numbers
@param $carrier
@param $region
@param array $optionalArgs
+ Valid arguments
+ [string] number_type - This field does not impact the way Plivo uses this number. It is primarily adding more information about your number. You may use this field to categorize between local and tollfree numbers. Default is local.
+ [string] app_id - The application id of the application that is to be linked.
+ [string] subaccount - The auth_id of the subaccount to which this number should be added. This can only be performed by a main account holder.
@return ResponseUpdate
@throws PlivoValidationException
Buy a new number